install.txt 78 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797
  1. Installing PHP
  2. __________________________________________________________________
  3. Table of Contents
  4. Preface
  5. 1. General Installation Considerations
  6. 2. Installation on Windows systems
  7. Manual Installation Steps
  8. ActiveScript
  9. Microsoft IIS
  10. Apache 1.3.x on Microsoft Windows
  11. Apache 2.0.x on Microsoft Windows
  12. Sun, iPlanet and Netscape servers on Microsoft Windows
  13. OmniHTTPd Server
  14. Sambar Server on Microsoft Windows
  15. Xitami on Microsoft Windows
  16. Installation of extensions on Windows
  17. 3. Installation of PECL extensions
  18. Introduction to PECL Installations
  19. Downloading PECL extensions
  20. PECL for Windows users
  21. Compiling shared PECL extensions with the pecl command
  22. Compiling shared PECL extensions with phpize
  23. Compiling PECL extensions statically into PHP
  24. 4. Problems?
  25. Read the FAQ
  26. Other problems
  27. Bug reports
  28. 5. Runtime Configuration
  29. The configuration file
  30. How to change configuration settings
  31. 6. Installation FAQ
  32. __________________________________________________________________
  33. Preface
  34. These installation instructions were generated from the HTML version of
  35. the PHP Manual so formatting and linking have been altered. See the
  36. online and updated version at: http://php.net/install.windows
  37. __________________________________________________________________
  38. Chapter 1. General Installation Considerations
  39. Before starting the installation, first you need to know what do you
  40. want to use PHP for. There are three main fields you can use PHP, as
  41. described in the What can PHP do? section:
  42. * Websites and web applications (server-side scripting)
  43. * Command line scripting
  44. * Desktop (GUI) applications
  45. For the first and most common form, you need three things: PHP itself,
  46. a web server and a web browser. You probably already have a web
  47. browser, and depending on your operating system setup, you may also
  48. have a web server (e.g. Apache on Linux and MacOS X; IIS on Windows).
  49. You may also rent webspace at a company. This way, you don't need to
  50. set up anything on your own, only write your PHP scripts, upload it to
  51. the server you rent, and see the results in your browser.
  52. In case of setting up the server and PHP on your own, you have two
  53. choices for the method of connecting PHP to the server. For many
  54. servers PHP has a direct module interface (also called SAPI). These
  55. servers include Apache, Microsoft Internet Information Server, Netscape
  56. and iPlanet servers. Many other servers have support for ISAPI, the
  57. Microsoft module interface (OmniHTTPd for example). If PHP has no
  58. module support for your web server, you can always use it as a CGI or
  59. FastCGI processor. This means you set up your server to use the CGI
  60. executable of PHP to process all PHP file requests on the server.
  61. If you are also interested to use PHP for command line scripting (e.g.
  62. write scripts autogenerating some images for you offline, or processing
  63. text files depending on some arguments you pass to them), you always
  64. need the command line executable. For more information, read the
  65. section about writing command line PHP applications. In this case, you
  66. need no server and no browser.
  67. With PHP you can also write desktop GUI applications using the PHP-GTK
  68. extension. This is a completely different approach than writing web
  69. pages, as you do not output any HTML, but manage Windows and objects
  70. within them. For more information about PHP-GTK, please visit the site
  71. dedicated to this extension. PHP-GTK is not included in the official
  72. PHP distribution.
  73. From now on, this section deals with setting up PHP for web servers on
  74. Unix and Windows with server module interfaces and CGI executables. You
  75. will also find information on the command line executable in the
  76. following sections.
  77. PHP source code and binary distributions for Windows can be found at
  78. http://www.php.net/downloads.php. We recommend you to choose a mirror
  79. nearest to you for downloading the distributions.
  80. __________________________________________________________________
  81. Chapter 2. Installation on Windows systems
  82. This section applies to Windows 98/Me and Windows NT/2000/XP/2003. PHP
  83. will not work on 16 bit platforms such as Windows 3.1 and sometimes we
  84. refer to the supported Windows platforms as Win32. Windows 95 is no
  85. longer supported as of PHP 4.3.0.
  86. If you have Microsoft Visual Studio, you can also build PHP from the
  87. original source code.
  88. Once you have PHP installed on your Windows system, you may also want
  89. to load various extensions for added functionality.
  90. Warning
  91. There are several all-in-one installers over the Internet, but none of
  92. those are endorsed by PHP.net, as we believe that the manual
  93. installation is the best choice to have your system secure and
  94. optimised.
  95. __________________________________________________________________
  96. Manual Installation Steps
  97. This install guide will help you manually install and configure PHP
  98. with a web server on Microsoft Windows. To get started you'll need to
  99. download the zip binary distribution from the downloads page at
  100. http://www.php.net/downloads.php.
  101. Although there are many all-in-one installation kits, we recommend you
  102. take the time to setup PHP yourself as this will provide you with a
  103. better understanding of the system, and enables you to install PHP
  104. extensions easily when needed.
  105. Upgrading from a previous PHP version: Previous editions of the
  106. manual suggest moving various ini and DLL files into your SYSTEM
  107. (i.e. C:\WINDOWS) folder and while this simplifies the installation
  108. procedure it makes upgrading difficult. We advise you remove all of
  109. these files (like php.ini and PHP related DLLs from the Windows
  110. SYSTEM folder) before moving on with a new PHP installation. Be sure
  111. to backup these files as you might break the entire system. The old
  112. php.ini might be useful in setting up the new PHP as well. And as
  113. you'll soon learn, the preferred method for installing PHP is to
  114. keep all PHP related files in one directory and have this directory
  115. available to your systems PATH.
  116. MDAC requirements: If you use Microsoft Windows 98/NT4 download the
  117. latest version of the Microsoft Data Access Components (MDAC) for
  118. your platform. MDAC is available at http://msdn.microsoft.com/data/.
  119. This requirement exists because ODBC is built into the distributed
  120. Windows binaries.
  121. The following steps should be completed on all installations before any
  122. server specific instructions are performed:
  123. Extract the distribution file into a directory of your choice. If you
  124. are installing PHP 4, extract to C:\, as the zip file expands to a
  125. foldername like php-4.3.7-Win32. If you are installing PHP 5, extract
  126. to C:\php as the zip file doesn't expand as in PHP 4. You may choose a
  127. different location but do not have spaces in the path (like C:\Program
  128. Files\PHP) as some web servers will crash if you do.
  129. The directory structure extracted from the zip is different for PHP
  130. versions 4 and 5 and look like as follows:
  131. Example 2-2. PHP 5 package structure
  132. c:\php
  133. |
  134. +--dev
  135. | |
  136. | |-php5ts.lib
  137. |
  138. +--ext -- extension DLLs for PHP
  139. | |
  140. | |-php_bz2.dll
  141. | |
  142. | |-php_cpdf.dll
  143. | |
  144. | |-..
  145. |
  146. +--extras
  147. | |
  148. | +--mibs -- support files for SNMP
  149. | |
  150. | +--openssl -- support files for Openssl
  151. | |
  152. | +--pdf-related -- support files for PDF
  153. | |
  154. | |-mime.magic
  155. |
  156. +--pear -- initial copy of PEAR
  157. |
  158. |
  159. |-go-pear.bat -- PEAR setup script
  160. |
  161. |-fdftk.dll
  162. |
  163. |-..
  164. |
  165. |-php-cgi.exe -- CGI executable
  166. |
  167. |-php-win.exe -- executes scripts without an opened command prompt
  168. |
  169. |-php.exe -- CLI executable - ONLY for command line scripting
  170. |
  171. |-..
  172. |
  173. |-php.ini-development -- development php.ini settings
  174. |
  175. |-php.ini-production -- recommended php.ini settings for production
  176. |
  177. |-php5activescript.dll
  178. |
  179. |-php5apache2_4.dll
  180. |
  181. |-..
  182. |
  183. |-php5ts.dll -- core PHP DLL
  184. |
  185. |-...
  186. Notice the differences and similarities. Both PHP 4 and PHP 5 have a
  187. CGI executable, a CLI executable, and server modules, but they are
  188. located in different folders and/or have different names. While PHP 4
  189. packages have the server modules in the sapi folder, PHP 5
  190. distributions have no such directory and instead they're in the PHP
  191. folder root. The supporting DLLs for the PHP 5 extensions are also not
  192. in a separate directory.
  193. Note: In PHP 4, you should move all files located in the dll and
  194. sapi folders to the main folder (e.g. C:\php).
  195. Here is a list of server modules shipped with PHP 5:
  196. * php5apache2_4.dll - Apache 2.4.x module.
  197. Server modules provide significantly better performance and additional
  198. functionality compared to the CGI binary. The FastCGI is significantly
  199. more stable and can be faster than the ISAPI module with IIS.
  200. The CLI version is designed to let you use PHP for command line
  201. scripting. More information about CLI is available in the chapter
  202. about using PHP from the command line.
  203. Warning
  204. The SAPI modules have been significantly improved as of the 4.1
  205. release, however, in older systems you may encounter server errors or
  206. other server modules failing, such as ASP.
  207. The CGI and CLI binaries, and the web server modules all require the
  208. php5ts.dll file to be available to them. You have to make
  209. sure that this file can be found by your PHP installation. The search
  210. order for this DLL is as follows:
  211. * The same directory from where php.exe is called, or in case you use
  212. a SAPI module, the web server's directory (e.g. C:\Program
  213. Files\Apache Group\Apache2\bin).
  214. * Any directory in your Windows PATH environment variable.
  215. To make php5ts.dll available you have three options: copy
  216. the file to the Windows system directory, copy the file to the web
  217. server's directory, or add your PHP directory, C:\php to the PATH. For
  218. better maintenance, we advise you to follow the last option, add C:\php
  219. to the PATH, because it will be simpler to upgrade PHP in the future.
  220. Read more about how to add your PHP directory to PATH in the
  221. corresponding FAQ entry (and then don't forget to restart the computer
  222. - logoff isn't enough).
  223. The next step is to set up a valid configuration file for PHP, php.ini.
  224. There are two ini files distributed in the zip file, php.ini-development
  225. and php.ini-production. We advise you to use php.ini-production,
  226. because we optimized the default settings in this file for performance,
  227. and security. Read this well documented file carefully because it has
  228. changes from php.ini-production that will drastically affect your setup.
  229. Some examples are display_errors being off and magic_quotes_gpc being off.
  230. In addition to reading these, study the ini settings and set every
  231. element manually yourself. If you would like to achieve the best
  232. security, then this is the way for you, although PHP works fine with
  233. these default ini files. Copy your chosen ini-file to a directory that
  234. PHP is able to find and rename it to php.ini. PHP searches for php.ini
  235. in the locations described in the Section called The configuration file
  236. in Chapter 5 section.
  237. If you are running Apache 2, the simpler option is to use the PHPIniDir
  238. directive (read the installation on Apache 2 page), otherwise your best
  239. option is to set the PHPRC environment variable. This process is
  240. explained in the following FAQ entry.
  241. Note: If you're using NTFS on Windows NT, 2000, XP or 2003, make
  242. sure that the user running the web server has read permissions to
  243. your php.ini (e.g. make it readable by Everyone).
  244. The following steps are optional:
  245. * Edit your new php.ini file. If you plan to use OmniHTTPd, do not
  246. follow the next step. Set the doc_root to point to your web servers
  247. document_root. For example:
  248. doc_root = c:\inetpub\wwwroot // for IIS
  249. doc_root = c:\apache\htdocs // for Apache
  250. * Choose the extensions you would like to load when PHP starts. See
  251. the section about Windows extensions, about how to set up one, and
  252. what is already built in. Note that on a new installation it is
  253. advisable to first get PHP working and tested without any
  254. extensions before enabling them in php.ini.
  255. PHP is now setup on your system. The next step is to choose a web
  256. server, and enable it to run PHP. Choose a web server from the table of
  257. contents.
  258. __________________________________________________________________
  259. ActiveScript
  260. This section contains notes specific to the ActiveScript installation.
  261. ActiveScript is a Windows only SAPI that enables you to use PHP script
  262. in any ActiveScript compliant host, like Windows Script Host,
  263. ASP/ASP.NET, Windows Script Components or Microsoft Scriptlet control.
  264. As of PHP 5.0.1, ActiveScript has been moved to the PECL repository.
  265. The DLL for this PECL extension may be downloaded from either the PHP
  266. Downloads page or from http://pecl4win.php.net/
  267. Note: You should read the manual installation steps first!
  268. After installing PHP, you should download the ActiveScript DLL
  269. (php5activescript.dll) and place it in the main PHP folder (e.g.
  270. C:\php).
  271. After having all the files needed, you must register the DLL on your
  272. system. To achieve this, open a Command Prompt window (located in the
  273. Start Menu). Then go to your PHP directory by typing something like cd
  274. C:\php. To register the DLL just type regsvr32 php5activescript.dll.
  275. To test if ActiveScript is working, create a new file, named test.wsf
  276. (the extension is very important) and type:
  277. <job id="test">
  278. <script language="PHPScript">
  279. $WScript->Echo("Hello World!");
  280. </script>
  281. </job>
  282. Save and double-click on the file. If you receive a little window
  283. saying "Hello World!" you're done.
  284. Note: In PHP 4, the engine was named 'ActivePHP', so if you are
  285. using PHP 4, you should replace 'PHPScript' with 'ActivePHP' in the
  286. above example.
  287. Note: ActiveScript doesn't use the default php.ini file. Instead, it
  288. will look only in the same directory as the .exe that caused it to
  289. load. You should create php-activescript.ini and place it in that
  290. folder, if you wish to load extensions, etc.
  291. __________________________________________________________________
  292. Microsoft IIS
  293. This section contains notes and hints specific to IIS (Microsoft
  294. Internet Information Server).
  295. Warning
  296. By using the CGI setup, your server is open to several possible
  297. attacks. Please read our CGI security section to learn how to defend
  298. yourself from those attacks.
  299. __________________________________________________________________
  300. General considerations for all installations of PHP with IIS
  301. * First, read the Manual Installation Instructions. Do not skip this
  302. step as it provides crucial information for installing PHP on
  303. Windows.
  304. * CGI users must set the cgi.force_redirect PHP directive to 0 inside
  305. php.ini. Read the faq on cgi.force_redirect for important details.
  306. Also, CGI users may want to set the cgi.redirect_status_env
  307. directive. When using directives, be sure these directives aren't
  308. commented out inside php.ini.
  309. * The PHP 4 CGI is named php.exe while in PHP 5 it's php-cgi.exe. In
  310. PHP 5, php.exe is the CLI, and not the CGI.
  311. * Modify the Windows PATH environment variable to include the PHP
  312. directory. This way the PHP DLL files and PHP executables can all
  313. remain in the PHP directory without cluttering up the Windows
  314. system directory. For more details, see the FAQ on Setting the
  315. PATH.
  316. * The IIS user (usually IUSR_MACHINENAME) needs permission to read
  317. various files and directories, such as php.ini, docroot, and the
  318. session tmp directory.
  319. * Be sure the extension_dir and doc_root PHP directives are
  320. appropriately set in php.ini. These directives depend on the system
  321. that PHP is being installed on. In PHP 4, the extension_dir is
  322. extensions while with PHP 5 it's ext. So, an example PHP 5
  323. extensions_dir value is "c:\php\ext" and an example IIS doc_root
  324. value is "c:\Inetpub\wwwroot".
  325. * PHP extension DLL files, such as php_mysql.dll and php_curl.dll,
  326. are found in the zip package of the PHP download. In PHP 5, many
  327. extensions are part of PECL and can be downloaded in the
  328. "Collection of PECL modules" package. Files such as php_zip.dll and
  329. php_ssh2.dll. Download PHP files here.
  330. * When defining the executable, the 'check that file exists' box may
  331. also be checked. For a small performance penalty, the IIS
  332. will check that the script file exists and sort out authentication
  333. before firing up PHP. This means that the web server will provide
  334. sensible 404 style error messages instead of CGI errors complaining
  335. that PHP did not output any data.
  336. __________________________________________________________________
  337. Windows NT/200x/XP and IIS 4 or newer
  338. PHP may be installed as a CGI binary, or with the ISAPI module. In
  339. either case, you need to start the Microsoft Management Console (may
  340. appear as 'Internet Services Manager', either in your Windows NT 4.0
  341. Option Pack branch or the Control Panel=>Administrative Tools under
  342. Windows 2000/XP). Then right click on your Web server node (this will
  343. most probably appear as 'Default Web Server'), and select 'Properties'.
  344. If you want to use the CGI binary, do the following:
  345. * Under 'Home Directory', 'Virtual Directory', or 'Directory', do the
  346. following:
  347. * Change the Execute Permissions to 'Scripts only'
  348. * Click on the 'Configuration' button, and choose the Application
  349. Mappings tab. Click Add and set the Executable path to the
  350. appropriate CGI file. An example PHP 5 value is: C:\php\php-cgi.exe
  351. Supply .php as the extension. Leave 'Method exclusions' blank, and
  352. check the 'Script engine' checkbox. Now, click OK a few times.
  353. * Set up the appropriate security. (This is done in Internet Service
  354. Manager), and if your NT Server uses NTFS file system, add execute
  355. rights for I_USR_ to the directory that contains php.exe /
  356. php-cgi.exe.
  357. To use the ISAPI module, do the following:
  358. * If you don't want to perform HTTP Authentication using PHP, you can
  359. (and should) skip this step. Under ISAPI Filters, add a new ISAPI
  360. filter. Use PHP as the filter name, and supply a path to the
  361. php5isapi.dll.
  362. * Under 'Home Directory', 'Virtual Directory', or 'Directory', do the
  363. following:
  364. * Change the Execute Permissions to 'Scripts only'
  365. * Click on the 'Configuration' button, and choose the Application
  366. Mappings tab. Click Add and set the Executable path to the
  367. appropriate ISAPI DLL. An example PHP 5 value is:
  368. C:\php\php5isapi.dll Supply .php as the extension. Leave 'Method
  369. exclusions' blank, and check the 'Script engine' checkbox. Now,
  370. click OK a few times.
  371. * Stop IIS completely (NET STOP iisadmin)
  372. * Start IIS again (NET START w3svc)
  373. With IIS 6 (2003 Server), open up the IIS Manager, go to Web Service
  374. Extensions, choose "Add a new Web service extension", enter in a name
  375. such as PHP, choose the Add button and for the value browse to either
  376. the ISAPI file (php5isapi.dll) or CGI (php.exe or
  377. php-cgi.exe) then check "Set extension status to Allowed" and click OK.
  378. In order to use index.php as a default content page, do the following:
  379. From within the Documents tab, choose Add. Type in index.php and click
  380. OK. Adjust the order by choosing Move Up or Move Down. This is similar
  381. to setting DirectoryIndex with Apache.
  382. The steps above must be repeated for each extension that is to be
  383. associated with PHP scripts. .php is the most common although .php3 may
  384. be required for legacy applications.
  385. If you experience 100% CPU usage after some time, turn off the IIS
  386. setting Cache ISAPI Application.
  387. __________________________________________________________________
  388. Windows and IIS
  389. See http://www.php.net/install.windows
  390. __________________________________________________________________
  391. Apache 1.3.x on Microsoft Windows
  392. This section contains notes and hints specific to Apache 1.3.x installs
  393. of PHP on Microsoft Windows systems. There are also instructions and
  394. notes for Apache 2 on a separate page.
  395. Note: Please read the manual installation steps first!
  396. There are two ways to set up PHP to work with Apache 1.3.x on Windows.
  397. One is to use the CGI binary (php.exe for PHP 4 and php-cgi.exe for PHP
  398. 5), the other is to use the Apache Module DLL. In either case you need
  399. to edit your httpd.conf to configure Apache to work with PHP, and then
  400. restart the server.
  401. It is worth noting here that now the SAPI module has been made more
  402. stable under Windows, we recommend it's use above the CGI binary, since
  403. it is more transparent and secure.
  404. Although there can be a few variations of configuring PHP under Apache,
  405. these are simple enough to be used by the newcomer. Please consult the
  406. Apache Documentation for further configuration directives.
  407. After changing the configuration file, remember to restart the server,
  408. for example, NET STOP APACHE followed by NET START APACHE, if you run
  409. Apache as a Windows Service, or use your regular shortcuts.
  410. Note: Remember that when adding path values in the Apache
  411. configuration files on Windows, all backslashes such as
  412. c:\directory\file.ext must be converted to forward slashes, as
  413. c:/directory/file.ext. A trailing slash may also be necessary for
  414. directories.
  415. __________________________________________________________________
  416. Installing as an Apache module
  417. You should add the following lines to your Apache httpd.conf file:
  418. Example 2-3. PHP as an Apache 1.3.x module
  419. This assumes PHP is installed to c:\php. Adjust the path if this is not
  420. the case.
  421. For PHP 5:
  422. # Add to the end of the LoadModule section
  423. LoadModule php5_module "C:/php/php5apache.dll"
  424. # Add to the end of the AddModule section
  425. AddModule mod_php5.c
  426. For both:
  427. # Add this line inside the <IfModule mod_mime.c> conditional brace
  428. AddType application/x-httpd-php .php
  429. # For syntax highlighted .phps files, also add
  430. AddType application/x-httpd-php-source .phps
  431. __________________________________________________________________
  432. Installing as a CGI binary
  433. If you unzipped the PHP package to C:\php\ as described in the Manual
  434. Installation Steps section, you need to insert these lines to your
  435. Apache configuration file to set up the CGI binary:
  436. Example 2-4. PHP and Apache 1.3.x as CGI
  437. ScriptAlias /php/ "c:/php/"
  438. AddType application/x-httpd-php .php
  439. # For PHP 4
  440. Action application/x-httpd-php "/php/php.exe"
  441. # For PHP 5
  442. Action application/x-httpd-php "/php/php-cgi.exe"
  443. # specify the directory where php.ini is
  444. SetEnv PHPRC C:/php
  445. Note that the second line in the list above can be found in the actual
  446. versions of httpd.conf, but it is commented out. Remember also to
  447. substitute the c:/php/ for your actual path to PHP.
  448. Warning
  449. By using the CGI setup, your server is open to several possible
  450. attacks. Please read our CGI security section to learn how to defend
  451. yourself from those attacks.
  452. If you would like to present PHP source files syntax highlighted, there
  453. is no such convenient option as with the module version of PHP. If you
  454. chose to configure Apache to use PHP as a CGI binary, you will need to
  455. use the highlight_file() function. To do this simply create a PHP
  456. script file and add this code: <?php
  457. highlight_file('some_php_script.php'); ?>.
  458. __________________________________________________________________
  459. Apache 2.0.x on Microsoft Windows
  460. This section contains notes and hints specific to Apache 2.0.x installs
  461. of PHP on Microsoft Windows systems. We also have instructions and
  462. notes for Apache 1.3.x users on a separate page.
  463. Note: You should read the manual installation steps first!
  464. Apache 2.2.x Support: Users of Apache 2.2.x may use the
  465. documentation below except the appropriate DLL file is named
  466. php5apache2_2.dll and it only exists as of PHP 5.2.0. See also
  467. http://snaps.php.net/
  468. Warning
  469. We do not recommend using a threaded MPM in production with Apache2.
  470. Use the prefork MPM instead, or use Apache1. For information on why,
  471. read the related FAQ entry on using Apache2 with a threaded MPM
  472. You are highly encouraged to take a look at the Apache Documentation to
  473. get a basic understanding of the Apache 2.0.x Server. Also consider to
  474. read the Windows specific notes for Apache 2.0.x before reading on
  475. here.
  476. PHP and Apache 2.0.x compatibility notes: The following versions of
  477. PHP are known to work with the most recent version of Apache 2.0.x:
  478. * PHP 4.3.0 or later available at http://www.php.net/downloads.php.
  479. * the latest stable development version. Get the source code
  480. http://snaps.php.net/php5-latest.tar.gz or download binaries for
  481. Windows http://snaps.php.net/win32/php5-win32-latest.zip.
  482. * a prerelease version downloadable from http://qa.php.net/.
  483. * you have always the option to obtain PHP through SVN.
  484. These versions of PHP are compatible to Apache 2.0.40 and later.
  485. Apache 2.0 SAPI-support started with PHP 4.2.0. PHP 4.2.3 works with
  486. Apache 2.0.39, don't use any other version of Apache with PHP 4.2.3.
  487. However, the recommended setup is to use PHP 4.3.0 or later with the
  488. most recent version of Apache2.
  489. All mentioned versions of PHP will work still with Apache 1.3.x.
  490. Warning
  491. Apache 2.0.x is designed to run on Windows NT 4.0, Windows 2000 or
  492. Windows XP. At this time, support for Windows 9x is incomplete. Apache
  493. 2.0.x is not expected to work on those platforms at this time.
  494. Download the most recent version of Apache 2.0.x and a fitting PHP
  495. version. Follow the Manual Installation Steps and come back to go on
  496. with the integration of PHP and Apache.
  497. There are two ways to set up PHP to work with Apache 2.0.x on Windows.
  498. One is to use the CGI binary the other is to use the Apache module DLL.
  499. In either case you need to edit your httpd.conf to configure Apache to
  500. work with PHP and then restart the server.
  501. Note: Remember that when adding path values in the Apache
  502. configuration files on Windows, all backslashes such as
  503. c:\directory\file.ext must be converted to forward slashes, as
  504. c:/directory/file.ext. A trailing slash may also be necessary for
  505. directories.
  506. __________________________________________________________________
  507. Installing as a CGI binary
  508. You need to insert these three lines to your Apache httpd.conf
  509. configuration file to set up the CGI binary:
  510. Example 2-5. PHP and Apache 2.0 as CGI
  511. ScriptAlias /php/ "c:/php/"
  512. AddType application/x-httpd-php .php
  513. # For PHP 4
  514. Action application/x-httpd-php "/php/php.exe"
  515. # For PHP 5
  516. Action application/x-httpd-php "/php/php-cgi.exe"
  517. Warning
  518. By using the CGI setup, your server is open to several possible
  519. attacks. Please read our CGI security section to learn how to defend
  520. yourself from those attacks.
  521. __________________________________________________________________
  522. Installing as an Apache module
  523. You need to insert these two lines to your Apache httpd.conf
  524. configuration file to set up the PHP module for Apache 2.0:
  525. Example 2-6. PHP and Apache 2.0 as Module
  526. # For PHP 5 do something like this:
  527. LoadModule php5_module "c:/php/php5apache2.dll"
  528. AddType application/x-httpd-php .php
  529. # configure the path to php.ini
  530. PHPIniDir "C:/php"
  531. Note: Remember to substitute your actual path to PHP for the c:/php/
  532. in the above examples. Take care to use either
  533. php5apache2.dll in your LoadModule directive and not php5apache.dll
  534. as the latter ones are designed to run with Apache 1.3.x.
  535. Note: If you want to use content negotiation, read related FAQ.
  536. Warning
  537. Don't mix up your installation with DLL files from different PHP
  538. versions. You have the only choice to use the DLL's and extensions that
  539. ship with your downloaded PHP version.
  540. __________________________________________________________________
  541. Sun, iPlanet and Netscape servers on Microsoft Windows
  542. This section contains notes and hints specific to Sun Java System Web
  543. Server, Sun ONE Web Server, iPlanet and Netscape server installs of PHP
  544. on Windows.
  545. From PHP 4.3.3 on you can use PHP scripts with the NSAPI module to
  546. generate custom directory listings and error pages. Additional
  547. functions for Apache compatibility are also available. For support in
  548. current web servers read the note about subrequests.
  549. __________________________________________________________________
  550. CGI setup on Sun, iPlanet and Netscape servers
  551. To install PHP as a CGI handler, do the following:
  552. * Copy php5ts.dll to your systemroot (the directory where you
  553. installed Windows)
  554. * Make a file association from the command line. Type the following
  555. two lines:
  556. assoc .php=PHPScript
  557. ftype PHPScript=c:\php\php.exe %1 %*
  558. * In the Netscape Enterprise Administration Server create a dummy
  559. shellcgi directory and remove it just after (this step creates 5
  560. important lines in obj.conf and allow the web server to handle
  561. shellcgi scripts).
  562. * In the Netscape Enterprise Administration Server create a new mime
  563. type (Category: type, Content-Type: magnus-internal/shellcgi, File
  564. Suffix:php).
  565. * Do it for each web server instance you want PHP to run
  566. More details about setting up PHP as a CGI executable can be found
  567. here: http://benoit.noss.free.fr/php/install-php.html
  568. __________________________________________________________________
  569. NSAPI setup on Sun, iPlanet and Netscape servers
  570. To install PHP with NSAPI, do the following:
  571. * Copy php5ts.dll to your systemroot (the directory where you
  572. installed Windows)
  573. * Make a file association from the command line. Type the following
  574. two lines:
  575. assoc .php=PHPScript
  576. ftype PHPScript=c:\php\php.exe %1 %*
  577. * In the Netscape Enterprise Administration Server create a new mime
  578. type (Category: type, Content-Type: magnus-internal/x-httpd-php,
  579. File Suffix: php).
  580. * Edit magnus.conf (for servers >= 6) or obj.conf (for servers < 6)
  581. and add the following: You should place the lines after mime types
  582. init.
  583. Init fn="load-modules" funcs="php5_init,php5_execute,php5_auth_trans" shlib="c:/
  584. php/sapi/php5nsapi.dll"
  585. Init fn="php5_init" LateInit="yes" errorString="Failed to initialise PHP!" [php_
  586. ini="c:/path/to/php.ini"]
  587. The php_ini parameter is optional but with it you
  588. can place your php.ini in your web server configuration directory.
  589. * Configure the default object in obj.conf (for virtual server
  590. classes [Sun Web Server 6.0+] in their vserver.obj.conf): In the
  591. <Object name="default"> section, place this line necessarily after
  592. all 'ObjectType' and before all 'AddLog' lines:
  593. Service fn="php5_execute" type="magnus-internal/x-httpd-php" [inikey=value inike
  594. y=value ...]
  595. As additional parameters you can add some special
  596. php.ini-values, for example you can set a
  597. docroot="/path/to/docroot" specific to the context php5_execute is
  598. called. For boolean ini-keys please use 0/1 as value, not
  599. "On","Off",... (this will not work correctly), e.g.
  600. zlib.output_compression=1 instead of zlib.output_compression="On"
  601. * This is only needed if you want to configure a directory that only
  602. consists of PHP scripts (same like a cgi-bin directory):
  603. <Object name="x-httpd-php">
  604. ObjectType fn="force-type" type="magnus-internal/x-httpd-php"
  605. Service fn=php5_execute [inikey=value inikey=value ...]
  606. </Object>
  607. After that you can configure a directory in the Administration
  608. server and assign it the style x-httpd-php. All files in it will
  609. get executed as PHP. This is nice to hide PHP usage by renaming
  610. files to .html.
  611. * Restart your web service and apply changes
  612. * Do it for each web server instance you want PHP to run
  613. Note: More details about setting up PHP as an NSAPI filter can be
  614. found here: http://benoit.noss.free.fr/php/install-php4.html
  615. Note: The stacksize that PHP uses depends on the configuration of
  616. the web server. If you get crashes with very large PHP scripts, it
  617. is recommended to raise it with the Admin Server (in the section
  618. "MAGNUS EDITOR").
  619. __________________________________________________________________
  620. CGI environment and recommended modifications in php.ini
  621. Important when writing PHP scripts is the fact that Sun JSWS/Sun ONE
  622. WS/iPlanet/Netscape is a multithreaded web server. Because of that all
  623. requests are running in the same process space (the space of the web
  624. server itself) and this space has only one environment. If you want to
  625. get CGI variables like PATH_INFO, HTTP_HOST etc. it is not the correct
  626. way to try this in the old PHP 3.x way with getenv() or a similar way
  627. (register globals to environment, $_ENV). You would only get the
  628. environment of the running web server without any valid CGI variables!
  629. Note: Why are there (invalid) CGI variables in the environment?
  630. Answer: This is because you started the web server process from the
  631. admin server which runs the startup script of the web server, you
  632. wanted to start, as a CGI script (a CGI script inside of the admin
  633. server!). This is why the environment of the started web server has
  634. some CGI environment variables in it. You can test this by starting
  635. the web server not from the administration server. Use the command
  636. line as root user and start it manually - you will see there are no
  637. CGI-like environment variables.
  638. __________________________________________________________________
  639. Special use for error pages or self-made directory listings (PHP >= 4.3.3)
  640. You can use PHP to generate the error pages for "404 Not Found" or
  641. similar. Add the following line to the object in obj.conf for every
  642. error page you want to overwrite:
  643. Error fn="php5_execute" code=XXX script="/path/to/script.php" [inikey=value inik
  644. ey=value...]
  645. where XXX is the HTTP error code. Please delete any other Error
  646. directives which could interfere with yours. If you want to place a
  647. page for all errors that could exist, leave the code parameter out.
  648. Your script can get the HTTP status code with $_SERVER['ERROR_TYPE'].
  649. Another possibility is to generate self-made directory listings. Just
  650. create a PHP script which displays a directory listing and replace the
  651. corresponding default Service line for type="magnus-internal/directory"
  652. in obj.conf with the following:
  653. Service fn="php5_execute" type="magnus-internal/directory" script="/path/to/scri
  654. pt.php" [inikey=value inikey=value...]
  655. For both error and directory listing pages the original URI and
  656. translated URI are in the variables $_SERVER['PATH_INFO'] and
  657. $_SERVER['PATH_TRANSLATED'].
  658. __________________________________________________________________
  659. Note about nsapi_virtual() and subrequests (PHP >= 4.3.3)
  660. The NSAPI module now supports the nsapi_virtual() function (alias:
  661. virtual()) to make subrequests on the web server and insert the result
  662. in the web page. The problem is, that this function uses some
  663. undocumented features from the NSAPI library.
  664. Under Unix this is not a problem, because the module automatically
  665. looks for the needed functions and uses them if available. If not,
  666. nsapi_virtual() is disabled.
  667. Under Windows limitations in the DLL handling need the use of a
  668. automatic detection of the most recent ns-httpdXX.dll file. This is
  669. tested for servers till version 6.1. If a newer version of the Sun
  670. server is used, the detection fails and nsapi_virtual() is disabled.
  671. If this is the case, try the following: Add the following parameter to
  672. php5_init in magnus.conf/obj.conf:
  673. Init fn=php5_init ... server_lib="ns-httpdXX.dll"
  674. where XX is the correct DLL version number. To get it, look in the
  675. server-root for the correct DLL name. The DLL with the biggest filesize
  676. is the right one.
  677. You can check the status by using the phpinfo() function.
  678. Note: But be warned: Support for nsapi_virtual() is EXPERIMENTAL!!!
  679. __________________________________________________________________
  680. OmniHTTPd Server
  681. This section contains notes and hints specific to OmniHTTPd on Windows.
  682. Note: You should read the manual installation steps first!
  683. Warning
  684. By using the CGI setup, your server is open to several possible
  685. attacks. Please read our CGI security section to learn how to defend
  686. yourself from those attacks.
  687. You need to complete the following steps to make PHP work with
  688. OmniHTTPd. This is a CGI executable setup. SAPI is supported by
  689. OmniHTTPd, but some tests have shown that it is not so stable to use
  690. PHP as an ISAPI module.
  691. Important for CGI users: Read the faq on cgi.force_redirect for
  692. important details. This directive needs to be set to 0.
  693. 1. Install OmniHTTPd server.
  694. 2. Right click on the blue OmniHTTPd icon in the system tray and
  695. select Properties
  696. 3. Click on Web Server Global Settings
  697. 4. On the 'External' tab, enter: virtual = .php | actual =
  698. c:\php\php.exe (use php-cgi.exe if installing PHP 5), and use the
  699. Add button.
  700. 5. On the Mime tab, enter: virtual = wwwserver/stdcgi | actual = .php,
  701. and use the Add button.
  702. 6. Click OK
  703. Repeat steps 2 - 6 for each extension you want to associate with PHP.
  704. __________________________________________________________________
  705. Xitami on Microsoft Windows
  706. This section contains notes and hints specific to Xitami on Windows.
  707. Note: You should read the manual installation steps first!
  708. This list describes how to set up the PHP CGI binary to work with
  709. Xitami on Windows.
  710. Important for CGI users: Read the faq on cgi.force_redirect for
  711. important details. This directive needs to be set to 0. If you want
  712. to use $_SERVER['PHP_SELF'] you have to enable the cgi.fix_pathinfo
  713. directive.
  714. Warning
  715. By using the CGI setup, your server is open to several possible
  716. attacks. Please read our CGI security section to learn how to defend
  717. yourself from those attacks.
  718. * Make sure the web server is running, and point your browser to
  719. xitamis admin console (usually http://127.0.0.1/admin), and click
  720. on Configuration.
  721. * Navigate to the Filters, and put the extension which PHP should
  722. parse (i.e. .php) into the field File extensions (.xxx).
  723. * In Filter command or script put the path and name of your PHP CGI
  724. executable i.e. C:\php\php-cgi.exe.
  725. * Press the 'Save' icon.
  726. * Restart the server to reflect changes.
  727. __________________________________________________________________
  728. Installation of extensions on Windows
  729. After installing PHP and a web server on Windows, you will probably
  730. want to install some extensions for added functionality. You can choose
  731. which extensions you would like to load when PHP starts by modifying
  732. your php.ini. You can also load a module dynamically in your script
  733. using dl().
  734. The DLLs for PHP extensions are prefixed with php_.
  735. Many extensions are built into the Windows version of PHP. This means
  736. additional DLL files, and the extension directive, are not used to load
  737. these extensions. The Windows PHP Extensions table lists extensions
  738. that require, or used to require, additional PHP DLL files. Here's a
  739. list of built in extensions:
  740. In PHP 5 (updated PHP 5.0.4), the following changes exist. Built in:
  741. DOM, LibXML, Iconv, SimpleXML, SPL and SQLite. And the following are no
  742. longer built in: MySQL and Overload.
  743. The default location PHP searches for extensions is C:\php5 in PHP 5.
  744. To change this setting to reflect your setup of PHP edit your php.ini
  745. file:
  746. * You will need to change the extension_dir setting to point to the
  747. directory where your extensions lives, or where you have placed
  748. your php_*.dll files. For example:
  749. extension_dir = C:\php\extensions
  750. * Enable the extension(s) in php.ini you want to use by uncommenting
  751. the extension=php_*.dll lines in php.ini. This is done by deleting
  752. the leading ; from the extension you want to load.
  753. Example 2-8. Enable Bzip2 extension for PHP-Windows
  754. // change the following line from ...
  755. ;extension=php_bz2.dll
  756. // ... to
  757. extension=php_bz2.dll
  758. * Some of the extensions need extra DLLs to work. Couple of them can
  759. be found in the distribution package, in in the main folder in PHP 5,
  760. but some, for example Oracle (php_oci8.dll) require DLLs which are
  761. not bundled with the distribution package.
  762. * Some of these DLLs are not bundled with the PHP distribution. See
  763. each extensions documentation page for details. Also, read the
  764. manual section titled Installation of PECL extensions for details
  765. on PECL. An increasingly large number of PHP extensions are found
  766. in PECL, and these extensions require a separate download.
  767. Note: If you are running a server module version of PHP remember to
  768. restart your web server to reflect your changes to php.ini.
  769. The following table describes some of the extensions available and
  770. required additional dlls.
  771. Table 2-1. PHP Extensions
  772. Extension Description Notes
  773. php_bz2.dll bzip2 compression functions None
  774. php_calendar.dll Calendar conversion functions
  775. php_cpdf.dll ClibPDF functions None
  776. php_crack.dll Crack functions None
  777. php_ctype.dll ctype family functions
  778. php_curl.dll CURL, Client URL library functions Requires: libeay32.dll,
  779. ssleay32.dll (bundled)
  780. php_db.dll DBM functions Deprecated. Use DBA instead (php_dba.dll)
  781. php_dba.dll DBA: DataBase (dbm-style) Abstraction layer functions None
  782. php_dbase.dll dBase functions None
  783. php_dbx.dll dbx functions
  784. php_exif.dll EXIF functions php_mbstring.dll. And, php_exif.dll must be
  785. loaded after php_mbstring.dll in php.ini.
  786. php_fdf.dll FDF: Forms Data Format functions. Requires: fdftk.dll
  787. (bundled)
  788. php_filepro.dll filePro functions Read-only access
  789. php_ftp.dll FTP functions
  790. php_gd2.dll GD library image functions GD2
  791. php_gettext.dll Gettext functions, requires libintl-1.dll,
  792. iconv.dll (bundled).
  793. php_iconv.dll ICONV characterset conversion Requires: iconv.dll
  794. php_imap.dll IMAP POP3 and NNTP functions None
  795. php_interbase.dll InterBase functions Requires: gds32.dll (bundled)
  796. php_ldap.dll LDAP functions requires libeay32.dll, ssleay32.dll (bundled)
  797. php_mbstring.dll Multi-Byte String functions None
  798. php_mcrypt.dll Mcrypt Encryption functions Requires: libmcrypt.dll
  799. php_mime_magic.dll Mimetype functions Requires: magic.mime (bundled)
  800. php_ming.dll Ming functions for Flash None
  801. php_msql.dll mSQL functions Requires: msql.dll (bundled)
  802. php_mssql.dll MSSQL functions Requires: ntwdblib.dll (bundled)
  803. php_mysql.dll MySQL functions PHP >= 5.0.0, requires libmysql.dll
  804. (bundled)
  805. php_mysqli.dll MySQLi functions PHP >= 5.0.0, requires libmysql.dll
  806. (libmysqli.dll in PHP <= 5.0.2) (bundled)
  807. php_oci8.dll Oracle 8 functions Requires: Oracle 8.1+ client libraries
  808. php_openssl.dll OpenSSL functions Requires: libeay32.dll (bundled)
  809. php_oracle.dll Oracle functions Requires: Oracle 7 client libraries
  810. php_pgsql.dll PostgreSQL functions None
  811. php_printer.dll Printer functions None
  812. php_shmop.dll Shared Memory functions None
  813. php_snmp.dll SNMP get and walk functions NT only!
  814. php_soap.dll SOAP functions PHP >= 5.0.0
  815. php_sockets.dll Socket functions None
  816. php_sybase_ct.dll Sybase functions Requires: Sybase client libraries
  817. php_tidy.dll Tidy functions PHP >= 5.0.0
  818. php_tokenizer.dll Tokenizer functions Built in since PHP 4.3.0
  819. php_xmlrpc.dll XML-RPC functions PHP >= 4.2.1 requires: iconv.dll
  820. (bundled)
  821. php_xslt.dll XSLT requires libxslt.dll, iconv.dll (bundled).
  822. php_zip.dll Zip File functions
  823. php_zlib.dll ZLib compression functions
  824. __________________________________________________________________
  825. Chapter 3. Installation of PECL extensions
  826. Introduction to PECL Installations
  827. PECL is a repository of PHP extensions that are made available to you
  828. via the PEAR packaging system. This section of the manual is intended
  829. to demonstrate how to obtain and install PECL extensions.
  830. These instructions assume /your/phpsrcdir/ is the path to the PHP
  831. source distribution, and that extname is the name of the PECL
  832. extension. Adjust accordingly. These instructions also assume a
  833. familiarity with the pear command. The information in the PEAR manual
  834. for the pear command also applies to the pecl command.
  835. To be useful, a shared extension must be built, installed, and loaded.
  836. The methods described below provide you with various instructions on
  837. how to build and install the extensions, but they do not automatically
  838. load them. Extensions can be loaded by adding an extension directive.
  839. To this php.ini file, or through the use of the dl() function.
  840. When building PHP modules, it's important to have known-good versions
  841. of the required tools (autoconf, automake, libtool, etc.) See the
  842. SVN Instructions for details on the required tools, and required
  843. versions.
  844. __________________________________________________________________
  845. Downloading PECL extensions
  846. There are several options for downloading PECL extensions, such as:
  847. * http://pecl.php.net
  848. The PECL web site contains information about the different
  849. extensions that are offered by the PHP Development Team. The
  850. information available here includes: ChangeLog, release notes,
  851. requirements and other similar details.
  852. * pecl download extname
  853. PECL extensions that have releases listed on the PECL web site are
  854. available for download and installation using the pecl command.
  855. Specific revisions may also be specified.
  856. * SVN
  857. Most PECL extensions also reside in SVN. A web-based view may be
  858. seen at http://svn.php.net/pecl/. To download straight from SVN,
  859. the following sequence of commands may be used.
  860. $ svn co http://svn.php.net/repository/pecl/<extname>/trunk
  861. * Windows downloads
  862. Windows users may find compiled PECL binaries by downloading the
  863. Collection of PECL modules from the PHP Downloads page, or by
  864. retrieving a PECL Snapshot or an extension DLL on PECL4WIN. To
  865. compile PHP under Windows, read the appropriate chapter.
  866. __________________________________________________________________
  867. PECL for Windows users
  868. As with any other PHP extension DLL, installation is as simple as
  869. copying the PECL extension DLLs into the extension_dir folder and
  870. loading them from php.ini. For example, add the following line to your
  871. php.ini:
  872. extension=php_extname.dll
  873. After doing this, restart the web server.
  874. __________________________________________________________________
  875. Compiling shared PECL extensions with the pecl command
  876. PECL makes it easy to create shared PHP extensions. Using the pecl
  877. command, do the following:
  878. $ pecl install extname
  879. This will download the source for extname, compile, and install
  880. extname.so into your extension_dir. extname.so may then be loaded via
  881. php.ini
  882. By default, the pecl command will not install packages that are marked
  883. with the alpha or beta state. If no stable packages are available, you
  884. may install a beta package using the following command:
  885. $ pecl install extname-beta
  886. You may also install a specific version using this variant:
  887. $ pecl install extname-0.1
  888. __________________________________________________________________
  889. Compiling shared PECL extensions with phpize
  890. Sometimes, using the pecl installer is not an option. This could be
  891. because you're behind a firewall, or it could be because the extension
  892. you want to install is not available as a PECL compatible package, such
  893. as unreleased extensions from SVN. If you need to build such an
  894. extension, you can use the lower-level build tools to perform the build
  895. manually.
  896. The phpize command is used to prepare the build environment for a PHP
  897. extension. In the following sample, the sources for an extension are in
  898. a directory named extname:
  899. $ cd extname
  900. $ phpize
  901. $ ./configure
  902. $ make
  903. # make install
  904. A successful install will have created extname.so and put it into the
  905. PHP extensions directory. You'll need to and adjust php.ini and add an
  906. extension=extname.so line before you can use the extension.
  907. If the system is missing the phpize command, and precompiled packages
  908. (like RPM's) are used, be sure to also install the appropriate devel
  909. version of the PHP package as they often include the phpize command
  910. along with the appropriate header files to build PHP and its
  911. extensions.
  912. Execute phpize --help to display additional usage information.
  913. __________________________________________________________________
  914. Compiling PECL extensions statically into PHP
  915. You might find that you need to build a PECL extension statically into
  916. your PHP binary. To do this, you'll need to place the extension source
  917. under the php-src/ext/ directory and tell the PHP build system to
  918. regenerate its configure script.
  919. $ cd /your/phpsrcdir/ext
  920. $ pecl download extname
  921. $ gzip -d < extname.tgz | tar -xvf -
  922. $ mv extname-x.x.x extname
  923. This will result in the following directory:
  924. /your/phpsrcdir/ext/extname
  925. From here, force PHP to rebuild the configure script, and then build
  926. PHP as normal:
  927. $ cd /your/phpsrcdir
  928. $ rm configure
  929. $ ./buildconf --force
  930. $ ./configure --help
  931. $ ./configure --with-extname --enable-someotherext --with-foobar
  932. $ make
  933. $ make install
  934. Note: To run the 'buildconf' script you need autoconf 2.13 and
  935. automake 1.4+ (newer versions of autoconf may work, but are not
  936. supported).
  937. Whether --enable-extname or --with-extname is used depends on the
  938. extension. Typically an extension that does not require external
  939. libraries uses --enable. To be sure, run the following after buildconf:
  940. $ ./configure --help | grep extname
  941. __________________________________________________________________
  942. Chapter 4. Problems?
  943. Read the FAQ
  944. Some problems are more common than others. The most common ones are
  945. listed in the PHP FAQ, part of this manual.
  946. __________________________________________________________________
  947. Other problems
  948. If you are still stuck, someone on the PHP installation mailing list
  949. may be able to help you. You should check out the archive first, in
  950. case someone already answered someone else who had the same problem as
  951. you. The archives are available from the support page on
  952. http://www.php.net/support.php. To subscribe to the PHP installation
  953. mailing list, send an empty mail to
  954. php-install-subscribe@lists.php.net. The mailing list address is
  955. php-install@lists.php.net.
  956. If you want to get help on the mailing list, please try to be precise
  957. and give the necessary details about your environment (which operating
  958. system, what PHP version, what web server, if you are running PHP as
  959. CGI or a server module, safe mode, etc...), and preferably enough code
  960. to make others able to reproduce and test your problem.
  961. __________________________________________________________________
  962. Bug reports
  963. If you think you have found a bug in PHP, please report it. The PHP
  964. developers probably don't know about it, and unless you report it,
  965. chances are it won't be fixed. You can report bugs using the
  966. bug-tracking system at http://bugs.php.net/. Please do not send bug
  967. reports in mailing list or personal letters. The bug system is also
  968. suitable to submit feature requests.
  969. Read the How to report a bug document before submitting any bug
  970. reports!
  971. __________________________________________________________________
  972. Chapter 5. Runtime Configuration
  973. The configuration file
  974. The configuration file (called php3.ini in PHP 3, and simply php.ini as
  975. of PHP 4) is read when PHP starts up. For the server module versions of
  976. PHP, this happens only once when the web server is started. For the CGI
  977. and CLI version, it happens on every invocation.
  978. php.ini is searched in these locations (in order):
  979. * SAPI module specific location (PHPIniDir directive in Apache 2, -c
  980. command line option in CGI and CLI, php_ini parameter in NSAPI,
  981. PHP_INI_PATH environment variable in THTTPD)
  982. * The PHPRC environment variable. Before PHP 5.2.0 this was checked
  983. after the registry key mentioned below.
  984. * As of PHP 5.2.0, the following registry locations are searched in
  985. order: HKEY_LOCAL_MACHINE\SOFTWARE\PHP\x.y.z\IniFilePath,
  986. HKEY_LOCAL_MACHINE\SOFTWARE\PHP\x.y\IniFilePath and
  987. HKEY_LOCAL_MACHINE\SOFTWARE\PHP\x\IniFilePath, where x, y and z
  988. mean the PHP major, minor and release versions.
  989. * HKEY_LOCAL_MACHINE\SOFTWARE\PHP\IniFilePath (Windows Registry
  990. location)
  991. * Current working directory (except CLI)
  992. * The web server's directory (for SAPI modules), or directory of PHP
  993. (otherwise in Windows)
  994. * Windows directory (C:\windows or C:\winnt) (for Windows), or
  995. --with-config-file-path compile time option
  996. If php-SAPI.ini exists (where SAPI is used SAPI, so the filename is
  997. e.g. php-cli.ini or php-apache.ini), it's used instead of php.ini. SAPI
  998. name can be determined by php_sapi_name().
  999. Note: The Apache web server changes the directory to root at startup
  1000. causing PHP to attempt to read php.ini from the root filesystem if
  1001. it exists.
  1002. The php.ini directives handled by extensions are documented
  1003. respectively on the pages of the extensions themselves. The list of the
  1004. core directives is available in the appendix. Probably not all PHP
  1005. directives are documented in the manual though. For a complete list of
  1006. directives available in your PHP version, please read your well
  1007. commented php.ini file. Alternatively, you may find the latest
  1008. php.ini from SVN helpful too.
  1009. Example 5-1. php.ini example
  1010. ; any text on a line after an unquoted semicolon (;) is ignored
  1011. [php] ; section markers (text within square brackets) are also ignored
  1012. ; Boolean values can be set to either:
  1013. ; true, on, yes
  1014. ; or false, off, no, none
  1015. html_errors = off
  1016. track_errors = yes
  1017. ; you can enclose strings in double-quotes
  1018. include_path = ".:/usr/local/lib/php"
  1019. ; backslashes are treated the same as any other character
  1020. include_path = ".;c:\php\lib"
  1021. Since PHP 5.1.0, it is possible to refer to existing .ini variables
  1022. from within .ini files. Example: open_basedir = ${open_basedir}
  1023. ":/new/dir".
  1024. __________________________________________________________________
  1025. How to change configuration settings
  1026. Running PHP as an Apache module
  1027. When using PHP as an Apache module, you can also change the
  1028. configuration settings using directives in Apache configuration files
  1029. (e.g. httpd.conf) and .htaccess files. You will need "AllowOverride
  1030. Options" or "AllowOverride All" privileges to do so.
  1031. With PHP 4 and PHP 5, there are several Apache directives that allow
  1032. you to change the PHP configuration from within the Apache
  1033. configuration files. For a listing of which directives are PHP_INI_ALL,
  1034. PHP_INI_PERDIR, or PHP_INI_SYSTEM, have a look at the List of php.ini
  1035. directives appendix.
  1036. Note: With PHP 3, there are Apache directives that correspond to
  1037. each configuration setting in the php3.ini name, except the name is
  1038. prefixed by "php3_".
  1039. php_value name value
  1040. Sets the value of the specified directive. Can be used only with
  1041. PHP_INI_ALL and PHP_INI_PERDIR type directives. To clear a
  1042. previously set value use none as the value.
  1043. Note: Don't use php_value to set boolean values. php_flag (see
  1044. below) should be used instead.
  1045. php_flag name on|off
  1046. Used to set a boolean configuration directive. Can be used only
  1047. with PHP_INI_ALL and PHP_INI_PERDIR type directives.
  1048. php_admin_value name value
  1049. Sets the value of the specified directive. This can not be used
  1050. in .htaccess files. Any directive type set with php_admin_value
  1051. can not be overridden by .htaccess or virtualhost directives. To
  1052. clear a previously set value use none as the value.
  1053. php_admin_flag name on|off
  1054. Used to set a boolean configuration directive. This can not be
  1055. used in .htaccess files. Any directive type set with
  1056. php_admin_flag can not be overridden by .htaccess or virtualhost
  1057. directives.
  1058. Example 5-2. Apache configuration example
  1059. <IfModule mod_php5.c>
  1060. php_value include_path ".:/usr/local/lib/php"
  1061. php_admin_flag engine on
  1062. </IfModule>
  1063. Caution
  1064. PHP constants do not exist outside of PHP. For example, in httpd.conf
  1065. you can not use PHP constants such as E_ALL or E_NOTICE to set the
  1066. error_reporting directive as they will have no meaning and will
  1067. evaluate to 0. Use the associated bitmask values instead. These
  1068. constants can be used in php.ini
  1069. __________________________________________________________________
  1070. Changing PHP configuration via the Windows registry
  1071. When running PHP on Windows, the configuration values can be modified
  1072. on a per-directory basis using the Windows registry. The configuration
  1073. values are stored in the registry key HKLM\SOFTWARE\PHP\Per Directory
  1074. Values, in the sub-keys corresponding to the path names. For example,
  1075. configuration values for the directory c:\inetpub\wwwroot would be
  1076. stored in the key HKLM\SOFTWARE\PHP\Per Directory
  1077. Values\c\inetpub\wwwroot. The settings for the directory would be
  1078. active for any script running from this directory or any subdirectory
  1079. of it. The values under the key should have the name of the PHP
  1080. configuration directive and the string value. PHP constants in the
  1081. values are not parsed. However, only configuration values changeable in
  1082. PHP_INI_USER can be set this way, PHP_INI_PERDIR values can not.
  1083. __________________________________________________________________
  1084. Other interfaces to PHP
  1085. Regardless of how you run PHP, you can change certain values at runtime
  1086. of your scripts through ini_set(). See the documentation on the
  1087. ini_set() page for more information.
  1088. If you are interested in a complete list of configuration settings on
  1089. your system with their current values, you can execute the phpinfo()
  1090. function, and review the resulting page. You can also access the values
  1091. of individual configuration directives at runtime using ini_get() or
  1092. get_cfg_var().
  1093. __________________________________________________________________
  1094. Chapter 6. Installation FAQ
  1095. This section holds common questions about the way to install PHP. PHP
  1096. is available for almost any OS (except maybe for MacOS before OSX), and
  1097. almost any web server.
  1098. To install PHP, follow the instructions in Installing PHP.
  1099. 1. Why shouldn't I use Apache2 with a threaded MPM in a production
  1100. environment?
  1101. 2. Unix/Windows: Where should my php.ini file be located?
  1102. 3. Unix: I installed PHP, but every time I load a document, I get the
  1103. message 'Document Contains No Data'! What's going on here?
  1104. 4. Unix: I installed PHP using RPMS, but Apache isn't processing the
  1105. PHP pages! What's going on here?
  1106. 5. Unix: I installed PHP 3 using RPMS, but it doesn't compile with the
  1107. database support I need! What's going on here?
  1108. 6. Unix: I patched Apache with the FrontPage extensions patch, and
  1109. suddenly PHP stopped working. Is PHP incompatible with the
  1110. Apache FrontPage extensions?
  1111. 7. Unix/Windows: I have installed PHP, but when I try to access a PHP
  1112. script file via my browser, I get a blank screen.
  1113. 8. Unix/Windows: I have installed PHP, but when try to access a PHP
  1114. script file via my browser, I get a server 500 error.
  1115. 9. Some operating systems: I have installed PHP without errors, but
  1116. when I try to start apache I get undefined symbol errors:
  1117. [mybox:user /src/php5] root# apachectl configtest
  1118. apachectl: /usr/local/apache/bin/httpd Undefined symbols:
  1119. _compress
  1120. _uncompress
  1121. 10. Windows: I have installed PHP, but when I to access a PHP script
  1122. file via my browser, I get the error:
  1123. cgi error:
  1124. The specified CGI application misbehaved by not
  1125. returning a complete set of HTTP headers.
  1126. The headers it did return are:
  1127. 11. Windows: I've followed all the instructions, but still can't get
  1128. PHP and IIS to work together!
  1129. 12. When running PHP as CGI with IIS, OmniHTTPD or Xitami, I get
  1130. the following error: Security Alert! PHP CGI cannot be accessed
  1131. directly..
  1132. 13. How do I know if my php.ini is being found and read? It seems like
  1133. it isn't as my changes aren't being implemented.
  1134. 14. How do I add my PHP directory to the PATH on Windows?
  1135. 15. How do I make the php.ini file available to PHP on windows?
  1136. 16. Is it possible to use Apache content negotiation (MultiViews
  1137. option) with PHP?
  1138. 17. Is PHP limited to process GET and POST request methods only?
  1139. 1. Why shouldn't I use Apache2 with a threaded MPM in a production
  1140. environment?
  1141. PHP is glue. It is the glue used to build cool web applications by
  1142. sticking dozens of 3rd-party libraries together and making it all
  1143. appear as one coherent entity through an intuitive and easy to learn
  1144. language interface. The flexibility and power of PHP relies on the
  1145. stability and robustness of the underlying platform. It needs a working
  1146. OS, a working web server and working 3rd-party libraries to glue
  1147. together. When any of these stop working PHP needs ways to identify the
  1148. problems and fix them quickly. When you make the underlying framework
  1149. more complex by not having completely separate execution threads,
  1150. completely separate memory segments and a strong sandbox for each
  1151. request to play in, feet of clay are introduced into PHP's system.
  1152. If you feel you have to use a threaded MPM, look at a FastCGI
  1153. configuration where PHP is running in its own memory space.
  1154. And finally, this warning against using a threaded MPM is not as strong
  1155. for Windows systems because most libraries on that platform tend to be
  1156. threadsafe.
  1157. 2. Unix/Windows: Where should my php.ini file be located?
  1158. By default on Unix it should be in /usr/local/lib which is
  1159. <install-path>/lib. Most people will want to change this at
  1160. compile-time with the --with-config-file-path flag. You would, for
  1161. example, set it with something like:
  1162. --with-config-file-path=/etc
  1163. And then you would copy php.ini-production from the distribution to
  1164. /etc/php.ini and edit it to make any local changes you want.
  1165. --with-config-file-scan-dir=PATH
  1166. On Windows the default path for the php.ini file is the Windows
  1167. directory. If you're using the Apache webserver, php.ini is first
  1168. searched in the Apaches install directory, e.g. c:\program files\apache
  1169. group\apache. This way you can have different php.ini files for
  1170. different versions of Apache on the same machine.
  1171. See also the chapter about the configuration file.
  1172. 3. Unix: I installed PHP, but every time I load a document, I get the
  1173. message 'Document Contains No Data'! What's going on here?
  1174. This probably means that PHP is having some sort of problem and is
  1175. core-dumping. Look in your server error log to see if this is the case,
  1176. and then try to reproduce the problem with a small test case. If you
  1177. know how to use 'gdb', it is very helpful when you can provide a
  1178. backtrace with your bug report to help the developers pinpoint the
  1179. problem. If you are using PHP as an Apache module try something like:
  1180. * Stop your httpd processes
  1181. * gdb httpd
  1182. * Stop your httpd processes
  1183. * > run -X -f /path/to/httpd.conf
  1184. * Then fetch the URL causing the problem with your browser
  1185. * > run -X -f /path/to/httpd.conf
  1186. * If you are getting a core dump, gdb should inform you of this now
  1187. * type: bt
  1188. * You should include your backtrace in your bug report. This should
  1189. be submitted to http://bugs.php.net/
  1190. If your script uses the regular expression functions (ereg() and
  1191. friends), you should make sure that you compiled PHP and Apache with
  1192. the same regular expression package. This should happen automatically
  1193. with PHP and Apache 1.3.x
  1194. 4. Unix: I installed PHP using RPMS, but Apache isn't processing the
  1195. PHP pages! What's going on here?
  1196. Assuming you installed both Apache and PHP from RPM packages, you need
  1197. to uncomment or add some or all of the following lines in your
  1198. httpd.conf file:
  1199. # Extra Modules
  1200. AddModule mod_php.c
  1201. AddModule mod_php3.c
  1202. AddModule mod_perl.c
  1203. # Extra Modules
  1204. LoadModule php_module modules/mod_php.so
  1205. LoadModule perl_module modules/libperl.so
  1206. And add:
  1207. AddType application/x-httpd-php3 .php3 # for PHP 3
  1208. AddType application/x-httpd-php .php # for PHP 4
  1209. ... to the global properties, or to the properties of the VirtualDomain
  1210. you want to have PHP support added to.
  1211. 5. Unix: I installed PHP 3 using RPMS, but it doesn't compile with the
  1212. database support I need! What's going on here?
  1213. Due to the way PHP 3 built, it is not easy to build a complete flexible
  1214. PHP RPM. This issue is addressed in PHP 4. For PHP 3, we currently
  1215. suggest you use the mechanism described in the INSTALL.REDHAT file in
  1216. the PHP distribution. If you insist on using an RPM version of PHP 3,
  1217. read on...
  1218. The RPM packagers are setting up the RPMS to install without database
  1219. support to simplify installations and because RPMS use /usr/ instead of
  1220. the standard /usr/local/ directory for files. You need to tell the RPM
  1221. spec file which databases to support and the location of the top-level
  1222. of your database server.
  1223. This example will explain the process of adding support for the popular
  1224. MySQL database server, using the mod installation for Apache.
  1225. Of course all of this information can be adjusted for any database
  1226. server that PHP supports. We will assume you installed MySQL and Apache
  1227. completely with RPMS for this example as well.
  1228. * First remove mod_php3 :
  1229. rpm -e mod_php3
  1230. * Then get the source rpm and INSTALL it, NOT --rebuild
  1231. rpm -Uvh mod_php3-3.0.5-2.src.rpm
  1232. * Then edit the /usr/src/redhat/SPECS/mod_php3.spec file
  1233. In the %build section add the database support you want, and the
  1234. path.
  1235. For MySQL you would add --with-mysql=/usr The %build section will
  1236. look something like this:
  1237. ./configure --prefix=/usr \
  1238. --with-apxs=/usr/sbin/apxs \
  1239. --with-config-file-path=/usr/lib \
  1240. --enable-debug=no \
  1241. --enable-safe-mode \
  1242. --with-exec-dir=/usr/bin \
  1243. --with-mysql=/usr \
  1244. --with-system-regex
  1245. * Once this modification is made then build the binary rpm as
  1246. follows:
  1247. rpm -bb /usr/src/redhat/SPECS/mod_php3.spec
  1248. * Then install the rpm
  1249. rpm -ivh /usr/src/redhat/RPMS/i386/mod_php3-3.0.5-2.i386.rpm
  1250. Make sure you restart Apache, and you now have PHP 3 with MySQL support
  1251. using RPM's. Note that it is probably much easier to just build from
  1252. the distribution tarball of PHP 3 and follow the instructions in
  1253. INSTALL.REDHAT found in that distribution.
  1254. 6. Unix: I patched Apache with the FrontPage extensions patch, and
  1255. suddenly PHP stopped working. Is PHP incompatible with the Apache
  1256. FrontPage extensions?
  1257. No, PHP works fine with the FrontPage extensions. The problem is that
  1258. the FrontPage patch modifies several Apache structures, that PHP relies
  1259. on. Recompiling PHP (using 'make clean ; make') after the FP patch is
  1260. applied would solve the problem.
  1261. 7. Unix/Windows: I have installed PHP, but when I try to access a PHP
  1262. script file via my browser, I get a blank screen.
  1263. Do a 'view source' in the web browser and you will probably find that
  1264. you can see the source code of your PHP script. This means that the web
  1265. server did not send the script to PHP for interpretation. Something is
  1266. wrong with the server configuration - double check the server
  1267. configuration against the PHP installation instructions.
  1268. 8. Unix/Windows: I have installed PHP, but when try to access a PHP
  1269. script file via my browser, I get a server 500 error.
  1270. Something went wrong when the server tried to run PHP. To get to see a
  1271. sensible error message, from the command line, change to the directory
  1272. containing the PHP executable (php.exe on Windows) and run php -i. If
  1273. PHP has any problems running, then a suitable error message will be
  1274. displayed which will give you a clue as to what needs to be done next.
  1275. If you get a screen full of HTML codes (the output of the phpinfo()
  1276. function) then PHP is working, and your problem may be related to your
  1277. server configuration which you should double check.
  1278. 9. Some operating systems: I have installed PHP without errors, but
  1279. when I try to start apache I get undefined symbol errors:
  1280. [mybox:user /src/php5] root# apachectl configtest
  1281. apachectl: /usr/local/apache/bin/httpd Undefined symbols:
  1282. _compress
  1283. _uncompress
  1284. This has actually nothing to do with PHP, but with the MySQL client
  1285. libraries. Some need --with-zlib, others do not. This is also covered
  1286. in the MySQL FAQ.
  1287. 10. Windows: I have installed PHP, but when I to access a PHP script
  1288. file via my browser, I get the error:
  1289. cgi error:
  1290. The specified CGI application misbehaved by not
  1291. returning a complete set of HTTP headers.
  1292. The headers it did return are:
  1293. This error message means that PHP failed to output anything at all. To
  1294. get to see a sensible error message, from the command line, change to
  1295. the directory containing the PHP executable (php.exe on Windows) and
  1296. run php -i. If PHP has any problems running, then a suitable error
  1297. message will be displayed which will give you a clue as to what needs
  1298. to be done next. If you get a screen full of HTML codes (the output of
  1299. the phpinfo() function) then PHP is working.
  1300. Once PHP is working at the command line, try accessing the script via
  1301. the browser again. If it still fails then it could be one of the
  1302. following:
  1303. * File permissions on your PHP script, php.exe, php5ts.dll, php.ini
  1304. or any PHP extensions you are trying to load are such that the
  1305. anonymous internet user ISUR_<machinename> cannot access them.
  1306. * The script file does not exist (or possibly isn't where you think
  1307. it is relative to your web root directory). Note that for IIS you
  1308. can trap this error by ticking the 'check file exists' box when
  1309. setting up the script mappings in the Internet Services Manager. If
  1310. a script file does not exist then the server will return a 404
  1311. error instead. There is also the additional benefit that IIS will
  1312. do any authentication required for you based on the NTLanMan
  1313. permissions on your script file.
  1314. 11. Windows: I've followed all the instructions, but still can't get
  1315. PHP and IIS to work together!
  1316. Make sure any user who needs to run a PHP script has the rights to run
  1317. php.exe! IIS uses an anonymous user which is added at the time IIS is
  1318. installed. This user needs rights to php.exe. Also, any authenticated
  1319. user will also need rights to execute php.exe. And for IIS4 you need to
  1320. tell it that PHP is a script engine. Also, you will want to read this
  1321. faq.
  1322. 12. When running PHP as CGI with IIS, OmniHTTPD or Xitami, I get
  1323. the following error: Security Alert! PHP CGI cannot be accessed
  1324. directly..
  1325. You must set the cgi.force_redirect directive to 0. It defaults to 1 so
  1326. be sure the directive isn't commented out (with a ;). Like all
  1327. directives, this is set in php.ini
  1328. Because the default is 1, it's critical that you're 100% sure that the
  1329. correct php.ini file is being read. Read this faq for details.
  1330. 13. How do I know if my php.ini is being found and read? It seems like
  1331. it isn't as my changes aren't being implemented.
  1332. To be sure your php.ini is being read by PHP, make a call to phpinfo()
  1333. and near the top will be a listing called Configuration File (php.ini).
  1334. This will tell you where PHP is looking for php.ini and whether or not
  1335. it's being read. If just a directory PATH exists than it's not being
  1336. read and you should put your php.ini in that directory. If php.ini is
  1337. included within the PATH than it is being read.
  1338. If php.ini is being read and you're running PHP as a module, then be
  1339. sure to restart your web server after making changes to php.ini
  1340. 14. How do I add my PHP directory to the PATH on Windows?
  1341. On Windows NT, 2000, XP and 2003:
  1342. * Go to Control Panel and open the System icon (Start -> Settings ->
  1343. Control Panel -> System, or just Start -> Control Panel -> System
  1344. for Windows XP/2003)
  1345. * Go to the Advanced tab
  1346. * Click on the 'Environment Variables' button
  1347. * Look into the 'System Variables' pane
  1348. * Find the Path entry (you may need to scroll to find it)
  1349. * Double click on the Path entry
  1350. * Enter your PHP directory at the end, including ';' before (e.g.
  1351. ;C:\php)
  1352. * Press OK and restart your computer
  1353. On Windows 98/Me you need to edit the autoexec.bat file:
  1354. * Open the Notepad (Start -> Run and enter notepad)
  1355. * Open the C:\autoexec.bat file
  1356. * Locate the line with PATH=C:\WINDOWS;C:\WINDOWS\COMMAND;..... and
  1357. add: ;C:\php to the end of the line
  1358. * Save the file and restart your computer
  1359. Note: Be sure to reboot after following the steps above to ensure
  1360. that the PATH changes are applied.
  1361. The PHP manual used to promote the copying of files into the Windows
  1362. system directory, this is because this directory (C:\Windows, C:\WINNT,
  1363. etc.) is by default in the systems PATH. Copying files into the Windows
  1364. system directory has long since been deprecated and may cause problems.
  1365. 15. How do I make the php.ini file available to PHP on windows?
  1366. There are several ways of doing this. If you are using Apache, read
  1367. their installation specific instructions (Apache 1, Apache 2),
  1368. otherwise you must set the PHPRC environment variable:
  1369. On Windows NT, 2000, XP and 2003:
  1370. * Go to Control Panel and open the System icon (Start -> Settings ->
  1371. Control Panel -> System, or just Start -> Control Panel -> System
  1372. for Windows XP/2003)
  1373. * Go to the Advanced tab
  1374. * Click on the 'Environment Variables' button
  1375. * Look into the 'System variables' pane
  1376. * Click on 'New' and enter 'PHPRC' as the variable name and the
  1377. directory where php.ini is located as the variable value (e.g.
  1378. C:\php)
  1379. * Press OK and restart your computer
  1380. On Windows 98/Me you need to edit the autoexec.bat file:
  1381. * Open the Notepad (Start -> Run and enter notepad)
  1382. * Open the C:\autoexec.bat file
  1383. * Add a new line to the end of the file: set PHPRC=C:\php (replace
  1384. C:\php with the directory where php.ini is located). Please note
  1385. that the path cannot contain spaces. For instance, if you have
  1386. installed PHP in C:\Program Files\PHP, you would enter
  1387. C:\PROGRA~1\PHP instead.
  1388. * Save the file and restart your computer
  1389. 16. Is it possible to use Apache content negotiation (MultiViews
  1390. option) with PHP?
  1391. If links to PHP files include extension, everything works perfect. This
  1392. FAQ is only for the case when links to PHP files don't include
  1393. extension and you want to use content negotiation to choose PHP files
  1394. from URL with no extension. In this case, replace the line AddType
  1395. application/x-httpd-php .php with:
  1396. # PHP 4
  1397. AddHandler php-script php
  1398. AddType text/html php
  1399. # PHP 5
  1400. AddHandler php5-script php
  1401. AddType text/html php
  1402. This solution doesn't work for Apache 1 as PHP module doesn't catch
  1403. php-script.
  1404. 17. Is PHP limited to process GET and POST request methods only?
  1405. No, it is possible to handle any request method, e.g. CONNECT. Proper
  1406. response status can be sent with header(). If only GET and POST methods
  1407. should be handled, it can be achieved with this Apache configuration:
  1408. <LimitExcept GET POST>
  1409. Deny from all
  1410. </LimitExcept>