· 10 years ago · Mar 18, 2016, 07:51 PM
1
2Installing PHP
3 _________________________________________________________________
4
5 Table of Contents
6 Preface
7 1. General Installation Considerations
8 2. Installation on Windows systems
9
10 Windows Installer
11 Manual Installation Steps
12 ActiveScript
13 Microsoft IIS / PWS
14 Apache 1.3.x on Microsoft Windows
15 Apache 2.0.x on Microsoft Windows
16 Sun, iPlanet and Netscape servers on Microsoft Windows
17 OmniHTTPd Server
18 Sambar Server on Microsoft Windows
19 Xitami on Microsoft Windows
20 Installation of extensions on Windows
21
22 3. Installation of PECL extensions
23
24 Introduction to PECL Installations
25 Downloading PECL extensions
26 PECL for Windows users
27 Compiling shared PECL extensions with PEAR
28 Compiling shared PECL extensions with phpize
29 Compiling PECL extensions statically into PHP
30
31 4. Problems?
32
33 Read the FAQ
34 Other problems
35 Bug reports
36
37 5. Runtime Configuration
38
39 The configuration file
40 How to change configuration settings
41 _________________________________________________________________
42
43Preface
44
45 These installation instructions were generated from the HTML version
46 of the PHP Manual so formatting and linking have been altered. See the
47 online and updated version at: http://php.net/install.windows
48 _________________________________________________________________
49
50Chapter 1. General Installation Considerations
51
52 Before starting the installation, first you need to know what do you
53 want to use PHP for. There are three main fields you can use PHP, as
54 described in the What can PHP do? section:
55
56 * Server-side scripting
57 * Command line scripting
58 * Client-side GUI applications
59
60 For the first and most common form, you need three things: PHP itself,
61 a web server and a web browser. You probably already have a web
62 browser, and depending on your operating system setup, you may also
63 have a web server (e.g. Apache on Linux and MacOS X; IIS on Windows).
64 You may also rent webspace at a company. This way, you don't need to
65 set up anything on your own, only write your PHP scripts, upload it to
66 the server you rent, and see the results in your browser.
67
68 While setting up the server and PHP on your own, you have two choices
69 for the method of connecting PHP to the server. For many servers PHP
70 has a direct module interface (also called SAPI). These servers
71 include Apache, Microsoft Internet Information Server, Netscape and
72 iPlanet servers. Many other servers have support for ISAPI, the
73 Microsoft module interface (OmniHTTPd for example). If PHP has no
74 module support for your web server, you can always use it as a CGI or
75 FastCGI processor. This means you set up your server to use the CGI
76 executable of PHP to process all PHP file requests on the server.
77
78 If you are also interested to use PHP for command line scripting (e.g.
79 write scripts autogenerating some images for you offline, or
80 processing text files depending on some arguments you pass to them),
81 you always need the command line executable. For more information,
82 read the section about writing command line PHP applications. In this
83 case, you need no server and no browser.
84
85 With PHP you can also write desktop GUI applications using the PHP-GTK
86 extension. This is a completely different approach than writing web
87 pages, as you do not output any HTML, but manage windows and objects
88 within them. For more information about PHP-GTK, please visit the site
89 dedicated to this extension. PHP-GTK is not included in the official
90 PHP distribution.
91
92 From now on, this section deals with setting up PHP for web servers on
93 Unix and Windows with server module interfaces and CGI executables.
94 You will also find information on the command line executable in the
95 following sections.
96
97 PHP source code and binary distributions for Windows can be found at
98 http://www.php.net/downloads.php. We recommend you to choose a mirror
99 nearest to you for downloading the distributions.
100 _________________________________________________________________
101
102Chapter 2. Installation on Windows systems
103
104 This section applies to Windows 98/Me and Windows NT/2000/XP/2003. PHP
105 will not work on 16 bit platforms such as Windows 3.1 and sometimes we
106 refer to the supported Windows platforms as Win32. Windows 95 is no
107 longer supported as of PHP 4.3.0.
108
109 There are two main ways to install PHP for Windows: either manually or
110 by using the installer.
111
112 If you have Microsoft Visual Studio, you can also build PHP from the
113 original source code.
114
115 Once you have PHP installed on your Windows system, you may also want
116 to load various extensions for added functionality.
117
118 Warning
119
120 There are several all-in-one installers over the Internet, but none of
121 those are endorsed by PHP.net, as we believe that the manual
122 installation is the best choice to have your system secure and
123 optimised.
124 _________________________________________________________________
125
126Windows Installer
127
128 The Windows PHP installer is available from the downloads page at
129 http://www.php.net/downloads.php. This installs the CGI version of PHP
130 and for IIS, PWS, and Xitami, it configures the web server as well.
131 The installer does not include any extra external PHP extensions
132 (php_*.dll) as you'll only find those in the Windows Zip Package and
133 PECL downloads.
134
135 Note: While the Windows installer is an easy way to make PHP work,
136 it is restricted in many aspects as, for example, the automatic
137 setup of extensions is not supported. Use of the installer isn't
138 the preferred method for installing PHP.
139
140 First, install your selected HTTP (web) server on your system, and
141 make sure that it works.
142
143 Run the executable installer and follow the instructions provided by
144 the installation wizard. Two types of installation are supported -
145 standard, which provides sensible defaults for all the settings it
146 can, and advanced, which asks questions as it goes along.
147
148 The installation wizard gathers enough information to set up the
149 php.ini file, and configure certain web servers to use PHP. One of the
150 web servers the PHP installer does not configure for is Apache, so
151 you'll need to configure it manually.
152
153 Once the installation has completed, the installer will inform you if
154 you need to restart your system, restart the server, or just start
155 using PHP.
156
157 Warning
158
159 Be aware, that this setup of PHP is not secure. If you would like to
160 have a secure PHP setup, you'd better go on the manual way, and set
161 every option carefully. This automatically working setup gives you an
162 instantly working PHP installation, but it is not meant to be used on
163 online servers.
164 _________________________________________________________________
165
166Manual Installation Steps
167
168 This install guide will help you manually install and configure PHP
169 with a web server on Microsoft Windows. To get started you'll need to
170 download the zip binary distribution from the downloads page at
171 http://www.php.net/downloads.php.
172
173 Although there are many all-in-one installation kits, and we also
174 distribute a PHP installer for Microsoft Windows, we recommend you
175 take the time to setup PHP yourself as this will provide you with a
176 better understanding of the system, and enables you to install PHP
177 extensions easily when needed.
178
179 Upgrading from a previous PHP version: Previous editions of the
180 manual suggest moving various ini and DLL files into your SYSTEM
181 (i.e. C:\WINDOWS) folder and while this simplifies the installation
182 procedure it makes upgrading difficult. We advise you remove all of
183 these files (like php.ini and PHP related DLLs from the Windows
184 SYSTEM folder) before moving on with a new PHP installation. Be
185 sure to backup these files as you might break the entire system.
186 The old php.ini might be useful in setting up the new PHP as well.
187 And as you'll soon learn, the preferred method for installing PHP
188 is to keep all PHP related files in one directory and have this
189 directory available to your systems PATH.
190
191 MDAC requirements: If you use Microsoft Windows 98/NT4 download the
192 latest version of the Microsoft Data Access Components (MDAC) for
193 your platform. MDAC is available at
194 http://msdn.microsoft.com/data/. This requirement exists because
195 ODBC is built into the distributed Windows binaries.
196
197 The following steps should be completed on all installations before
198 any server specific instructions are performed:
199
200 Extract the distribution file into a directory of your choice. If you
201 are installing PHP 4, extract to C:\, as the zip file expands to a
202 foldername like php-4.3.7-Win32. If you are installing PHP 5, extract
203 to C:\php as the zip file doesn't expand as in PHP 4. You may choose a
204 different location but do not have spaces in the path (like C:\Program
205 Files\PHP) as some web servers will crash if you do.
206
207 The directory structure extracted from the zip is different for PHP
208 versions 4 and 5 and look like as follows:
209
210 Example 2-1. PHP 4 package structure
211c:\php
212 |
213 +--cli
214 | |
215 | |-php.exe -- CLI executable - ONLY for commandline scripting
216 |
217 +--dlls -- support DLLs required by some extensions
218 | |
219 | |-expat.dll
220 | |
221 | |-fdftk.dll
222 | |
223 | |-...
224 |
225 +--extensions -- extension DLLs for PHP
226 | |
227 | |-php_bz2.dll
228 | |
229 | |-php_cpdf.dll
230 | |
231 | |-..
232 |
233 +--mibs -- support files for SNMP
234 |
235 +--openssl -- support files for Openssl
236 |
237 +--pdf-related -- support files for PDF
238 |
239 +--sapi -- SAPI (server module support) DLLs
240 | |
241 | |-php4activescript.dll
242 | |
243 | |-php4apache.dll
244 | |
245 | |-php4apache2.dll
246 | |
247 | |-..
248 |
249 +--PEAR -- initial copy of PEAR
250 |
251 |
252 |-go-pear.bat -- PEAR setup script
253 |
254 |-..
255 |
256 |-php.exe -- CGI executable
257 |
258 |-..
259 |
260 |-php.ini-dist -- default php.ini settings
261 |
262 |-php.ini-recommended -- recommended php.ini settings
263 |
264 |-php4ts.dll -- core PHP DLL
265 |
266 |-...
267
268 Or:
269
270 Example 2-2. PHP 5 package structure
271c:\php
272 |
273 +--dev
274 | |
275 | |-php5ts.lib
276 |
277 +--ext -- extension DLLs for PHP
278 | |
279 | |-php_bz2.dll
280 | |
281 | |-php_cpdf.dll
282 | |
283 | |-..
284 |
285 +--extras
286 | |
287 | +--mibs -- support files for SNMP
288 | |
289 | +--openssl -- support files for Openssl
290 | |
291 | +--pdf-related -- support files for PDF
292 | |
293 | |-mime.magic
294 |
295 +--pear -- initial copy of PEAR
296 |
297 |
298 |-go-pear.bat -- PEAR setup script
299 |
300 |-fdftk.dll
301 |
302 |-..
303 |
304 |-php-cgi.exe -- CGI executable
305 |
306 |-php-win.exe -- executes scripts without an opened command prompt
307 |
308 |-php.exe -- CLI executable - ONLY for command line scripting
309 |
310 |-..
311 |
312 |-php.ini-dist -- default php.ini settings
313 |
314 |-php.ini-recommended -- recommended php.ini settings
315 |
316 |-php5activescript.dll
317 |
318 |-php5apache.dll
319 |
320 |-php5apache2.dll
321 |
322 |-..
323 |
324 |-php5ts.dll -- core PHP DLL
325 |
326 |-...
327
328 Notice the differences and similarities. Both PHP 4 and PHP 5 have a
329 CGI executable, a CLI executable, and server modules, but they are
330 located in different folders and/or have different names. While PHP 4
331 packages have the server modules in the sapi folder, PHP 5
332 distributions have no such directory and instead they're in the PHP
333 folder root. The supporting DLLs for the PHP 5 extensions are also not
334 in a seperate directory.
335
336 Note: In PHP 4, you should move all files located in the dll and
337 sapi folders to the main folder (e.g. C:\php).
338
339 Here is a list of server modules shipped with PHP 4 and PHP 5:
340
341 * sapi/php4activescript.dll (php5activescript.dll) - ActiveScript
342 engine, allowing you to embed PHP in your Windows applications.
343 * sapi/php4apache.dll (php5apache.dll) - Apache 1.3.x module.
344 * sapi/php4apache2.dll (php5apache2.dll) - Apache 2.0.x module.
345 * sapi/php4isapi.dll (php5isapi.dll) - ISAPI Module for ISAPI
346 compliant web servers like IIS 4.0/PWS 4.0 or newer.
347 * sapi/php4nsapi.dll (php5nsapi.dll) - Sun/iPlanet/Netscape server
348 module.
349 * sapi/php4pi3web.dll (no equivalent in PHP 5) - Pi3Web server
350 module.
351
352 Server modules provide significantly better performance and additional
353 functionality compared to the CGI binary. The CLI version is designed
354 to let you use PHP for command line scripting. More information about
355 CLI is available in the chapter about using PHP from the command line.
356
357 Warning
358
359 The SAPI modules have been significantly improved as of the 4.1
360 release, however, in older systems you may encounter server errors or
361 other server modules failing, such as ASP.
362
363 The CGI and CLI binaries, and the web server modules all require the
364 php4ts.dll (php5ts.dll) file to be available to them. You have to make
365 sure that this file can be found by your PHP installation. The search
366 order for this DLL is as follows:
367
368 * The same directory from where php.exe is called, or in case you
369 use a SAPI module, the web server's directory (e.g. C:\Program
370 Files\Apache Group\Apache2\bin).
371 * Any directory in your Windows PATH environment variable.
372
373 To make php4ts.dll / php5ts.dll available you have three options: copy
374 the file to the Windows system directory, copy the file to the web
375 server's directory, or add your PHP directory, C:\php to the PATH. For
376 better maintenance, we advise you to follow the last option, add
377 C:\php to the PATH, because it will be simpler to upgrade PHP in the
378 future. Read more about how to add your PHP directory to PATH in the
379 corresponding FAQ entry.
380
381 The next step is to set up a valid configuration file for PHP,
382 php.ini. There are two ini files distributed in the zip file,
383 php.ini-dist and php.ini-recommended. We advise you to use
384 php.ini-recommended, because we optimized the default settings in this
385 file for performance, and security. Read this well documented file
386 carefully because it has changes from php.ini-dist that will
387 drastically affect your setup. Some examples are display_errors being
388 off and magic_quotes_gpc being off. In addition to reading these,
389 study the ini settings and set every element manually yourself. If you
390 would like to achieve the best security, then this is the way for you,
391 although PHP works fine with these default ini files. Copy your chosen
392 ini-file to a directory that PHP is able to find and rename it to
393 php.ini. PHP searches for php.ini in the following locations (in
394 order):
395
396 * PHPIniDir directive (Apache 2 module only)
397 * HKEY_LOCAL_MACHINE\SOFTWARE\PHP\IniFilePath
398 * The PHPRC environment variable
399 * Directory of PHP (for CLI), or the web server's directory (for
400 SAPI modules)
401 * Windows directory (C:\windows or C:\winnt)
402
403 If you are running Apache 2, the simpler option is to use the
404 PHPIniDir directive (read the installation on Apache 2 page),
405 otherwise your best option is to set the PHPRC environment variable.
406 This process is explained in the following FAQ entry.
407
408 Note: If you're using NTFS on Windows NT, 2000, XP or 2003, make
409 sure that the user running the web server has read permissions to
410 your php.ini (e.g. make it readable by Everyone).
411
412 The following steps are optional:
413
414 * Edit your new php.ini file. If you plan to use OmniHTTPd, do not
415 follow the next step. Set the doc_root to point to your web
416 servers document_root. For example:
417
418doc_root = c:\inetpub\wwwroot // for IIS/PWS
419
420doc_root = c:\apache\htdocs // for Apache
421
422 * Choose the extensions you would like to load when PHP starts. See
423 the section about Windows extensions, about how to set up one, and
424 what is already built in. Note that on a new installation it is
425 advisable to first get PHP working and tested without any
426 extensions before enabling them in php.ini.
427 * On PWS and IIS, you can set the browscap configuration setting to
428 point to: c:\windows\system\inetsrv\browscap.ini on Windows 9x/Me,
429 c:\winnt\system32\inetsrv\browscap.ini on NT/2000, and
430 c:\windows\system32\inetsrv\browscap.ini on XP. For an up-to-date
431 browscap.ini, read the following FAQ.
432
433 PHP is now setup on your system. The next step is to choose a web
434 server, and enable it to run PHP. Choose a webserver from the table of
435 contents.
436 _________________________________________________________________
437
438ActiveScript
439
440 This section contains notes specific to the ActiveScript installation.
441
442 ActiveScript is a windows only SAPI that enables you to use PHP script
443 in any ActiveScript compliant host, like Windows Script Host,
444 ASP/ASP.NET, Windows Script Components or Microsoft Scriptlet control.
445
446 As of PHP 5.0.1, ActiveScript has been moved to the PECL repository.
447 You may download this PECL extension DLL from the PHP Downloads page
448 or at http://snaps.php.net/.
449
450 Note: You should read the manual installation steps first!
451
452 After installing PHP, you should download the ActiveScript DLL
453 (php5activescript.dll) and place it in the main PHP folder (e.g.
454 C:\php).
455
456 After having all the files needed, you must register the DLL on your
457 system. To achieve this, open a Command Prompt window (located in the
458 Start Menu). Then go to your PHP directory by typing something like cd
459 C:\php. To register the DLL just type regsvr32 php5activescript.dll.
460
461 To test if ActiveScript is working, create a new file, named test.wsf
462 (the extension is very important) and type:
463<job id="test">
464
465 <script language="PHPScript">
466 $WScript->Echo("Hello World!");
467 </script>
468
469</job>
470
471 Save and double-click on the file. If you receive a little window
472 saying "Hello World!" you're done.
473
474 Note: ActiveScript doesn't use the default php.ini file. Instead,
475 it will look only in the same directory as the .exe that caused it
476 to load. You should create php-activescript.ini and place it in
477 that folder, if you wish to load extensions, etc.
478 _________________________________________________________________
479
480Microsoft IIS / PWS
481
482 This section contains notes and hints specific to IIS (Microsoft
483 Internet Information Server).
484
485 Warning
486
487 By using the CGI setup, your server is open to several possible
488 attacks. Please read our CGI security section to learn how to defend
489 yourself from those attacks.
490 _________________________________________________________________
491
492General considerations for all installations of PHP with IIS
493
494 * First, read the Manual Installation Instructions. Do not skip this
495 step as it provides crucial information for installing PHP on
496 Windows.
497 * CGI users must set the cgi.force_redirect PHP directive to 0
498 inside php.ini. Read the faq on cgi.force_redirect for important
499 details. Also, CGI users should set the cgi.redirect_status_env
500 directive to ENV_VAR_NAME. Be sure these directives aren't
501 commented out inside php.ini.
502 * The PHP 4 CGI is named php.exe while in PHP 5 it's php-cgi.exe. In
503 PHP 5, php.exe is the CLI, and not the CGI.
504 * Modify the Windows PATH environment variable to include the PHP
505 directory. This way the PHP DLL files, PHP executables, and
506 php.ini can all remain in the PHP directory without cluttering up
507 the Windows system directory. For more details, see the FAQ on
508 Setting the PATH.
509 * Be sure the extension_dir and doc_root PHP directives are
510 appropriately set in php.ini. These directives depend on the
511 system that PHP is being installed on. In PHP 4, the extension_dir
512 is extensions while with PHP 5 it's ext. So, an example PHP 5
513 extensions_dir value is "c:\php\ext" and an example IIS doc_root
514 value is "c:\Inetpub\wwwroot".
515 * PHP extension DLL files, such as php_mysql.dll and php_curl.dll,
516 are found in the zip package of the PHP download (not the PHP
517 installer). In PHP 5, many extensions are part of PECL and can be
518 downloaded in the "Collection of PECL modules" package. Files such
519 as php_zip.dll and php_ssh2.dll. Download PHP files here.
520 * When defining the executable, the 'check that file exists' box may
521 also be checked. For a small performance penalty, the IIS (or PWS)
522 will check that the script file exists and sort out authentication
523 before firing up PHP. This means that the web server will provide
524 sensible 404 style error messages instead of CGI errors
525 complaining that PHP did not output any data.
526 _________________________________________________________________
527
528Windows NT/200x/XP and IIS 4 or newer
529
530 PHP may be installed as a CGI binary, or with the ISAPI module. In
531 either case, you need to start the Microsoft Management Console (may
532 appear as 'Internet Services Manager', either in your Windows NT 4.0
533 Option Pack branch or the Control Panel=>Administrative Tools under
534 Windows 2000/XP). Then right click on your Web server node (this will
535 most probably appear as 'Default Web Server'), and select
536 'Properties'.
537
538 If you want to use the CGI binary, do the following:
539
540 * Under 'Home Directory', 'Virtual Directory', or 'Directory', do
541 the following:
542 * Change the Execute Permissions to 'Scripts only'
543 * Click on the 'Configuration' button, and choose the Application
544 Mappings tab. Click Add and set the Executable path to the
545 appropriate CGI file. An example PHP 5 value is:
546 C:\php\php-cgi.exe Supply .php as the extension. Leave 'Method
547 exclusions' blank, and check the 'Script engine' checkbox. Now,
548 click OK a few times.
549 * Set up the appropriate security. (This is done in Internet Service
550 Manager), and if your NT Server uses NTFS file system, add execute
551 rights for I_USR_ to the directory that contains php.exe /
552 php-cgi.exe.
553
554 To use the ISAPI module, do the following:
555
556 * If you don't want to perform HTTP Authentication using PHP, you
557 can (and should) skip this step. Under ISAPI Filters, add a new
558 ISAPI filter. Use PHP as the filter name, and supply a path to the
559 php4isapi.dll / php5isapi.dll.
560 * Under 'Home Directory', 'Virtual Directory', or 'Directory', do
561 the following:
562 * Change the Execute Permissions to 'Scripts only'
563 * Click on the 'Configuration' button, and choose the Application
564 Mappings tab. Click Add and set the Executable path to the
565 appropriate ISAPI DLL. An example PHP 5 value is:
566 C:\php\php5isapi.dll Supply .php as the extension. Leave 'Method
567 exclusions' blank, and check the 'Script engine' checkbox. Now,
568 click OK a few times.
569 * Stop IIS completely (NET STOP iisadmin)
570 * Start IIS again (NET START w3svc)
571
572 With IIS 6 (2003 Server), open up the IIS Manager, go to Web Service
573 Extensions, choose "Add a new Web service extension", enter in a name
574 such as PHP, choose the Add button and for the value browse to either
575 the ISAPI file (php4isapi.dll or php5isapi.dll) or CGI (php.exe or
576 php-cgi.exe) then check "Set extension status to Allowed" and click
577 OK.
578
579 In order to use index.php as a default content page, do the following:
580 From within the Documents tab, choose Add. Type in index.php and click
581 OK. Adjust the order by choosing Move Up or Move Down. This is similar
582 to setting DirectoryIndex with Apache.
583
584 The steps above must be repeated for each extension that is to be
585 associated with PHP scripts. .php is the most common although .php3
586 may be required for legacy applications.
587
588 If you experience 100% CPU usage after some time, turn off the IIS
589 setting Cache ISAPI Application.
590 _________________________________________________________________
591
592Windows and PWS 4
593
594 PWS 4 does not support ISAPI, only PHP CGI should be used.
595
596 * Edit the enclosed pws-php4cgi.reg / pws-php5cgi.reg file (look
597 into the SAPI folder for PHP 4, or in the main folder for PHP 5)
598 to reflect the location of your php.exe / php-cgi.exe. Backslashes
599 should be escaped, for example:
600 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\w3svc\parame
601 ters\Script Map] ".php"="C:\\php\\php.exe" (change to
602 C:\\php\\php-cgi.exe if you are using PHP 5) Now merge this
603 registery file into your system; you may do this by
604 double-clicking it.
605 * In the PWS Manager, right click on a given directory you want to
606 add PHP support to, and select Properties. Check the 'Execute'
607 checkbox, and confirm.
608 _________________________________________________________________
609
610Windows and PWS/IIS 3
611
612 The recommended method for configuring these servers is to use the REG
613 file included with the distribution (pws-php4cgi.reg in the SAPI
614 folder for PHP 4, or pws-php5cgi.reg in the main folder for PHP 5).
615 You may want to edit this file and make sure the extensions and PHP
616 install directories match your configuration. Or you can follow the
617 steps below to do it manually.
618
619 Warning
620
621 These steps involve working directly with the Windows registry. One
622 error here can leave your system in an unstable state. We highly
623 recommend that you back up your registry first. The PHP Development
624 team will not be held responsible if you damage your registry.
625
626 * Run Regedit.
627 * Navigate to: HKEY_LOCAL_MACHINE /System /CurrentControlSet
628 /Services /W3Svc /Parameters /ScriptMap.
629 * On the edit menu select: New->String Value.
630 * Type in the extension you wish to use for your php scripts. For
631 example .php
632 * Double click on the new string value and enter the path to php.exe
633 in the value data field. ex: C:\php\php.exe for PHP 4, or
634 C:\php\php-cgi.exe for PHP 5.
635 * Repeat these steps for each extension you wish to associate with
636 PHP scripts.
637
638 The following steps do not affect the web server installation and only
639 apply if you want your PHP scripts to be executed when they are run
640 from the command line (ex. run C:\myscripts\test.php) or by double
641 clicking on them in a directory viewer window. You may wish to skip
642 these steps as you might prefer the PHP files to load into a text
643 editor when you double click on them.
644
645 * Navigate to: HKEY_CLASSES_ROOT
646 * On the edit menu select: New->Key.
647 * Name the key to the extension you setup in the previous section.
648 ex: .php
649 * Highlight the new key and in the right side pane, double click the
650 "default value" and enter phpfile.
651 * Repeat the last step for each extension you set up in the previous
652 section.
653 * Now create another New->Key under HKEY_CLASSES_ROOT and name it
654 phpfile.
655 * Highlight the new key phpfile and in the right side pane, double
656 click the "default value" and enter PHP Script.
657 * Right click on the phpfile key and select New->Key, name it Shell.
658 * Right click on the Shell key and select New->Key, name it open.
659 * Right click on the open key and select New->Key, name it command.
660 * Highlight the new key command and in the right side pane, double
661 click the "default value" and enter the path to php.exe. ex:
662 c:\php\php.exe -q %1. (don't forget the %1).
663 * Exit Regedit.
664 * If using PWS on Windows, reboot to reload the registry.
665
666 PWS and IIS 3 users now have a fully operational system. IIS 3 users
667 can use a nifty tool from Steven Genusa to configure their script
668 maps.
669 _________________________________________________________________
670
671Apache 1.3.x on Microsoft Windows
672
673 This section contains notes and hints specific to Apache 1.3.x
674 installs of PHP on Microsoft Windows systems. There are also
675 instructions and notes for Apache 2 on a separate page.
676
677 Note: Please read the manual installation steps first!
678
679 There are two ways to set up PHP to work with Apache 1.3.x on Windows.
680 One is to use the CGI binary (php.exe for PHP 4 and php-cgi.exe for
681 PHP 5), the other is to use the Apache Module DLL. In either case you
682 need to edit your httpd.conf to configure Apache to work with PHP, and
683 then restart the server.
684
685 It is worth noting here that now the SAPI module has been made more
686 stable under Windows, we recommend it's use above the CGI binary,
687 since it is more transparent and secure.
688
689 Although there can be a few variations of configuring PHP under
690 Apache, these are simple enough to be used by the newcomer. Please
691 consult the Apache Documentation for further configuration directives.
692
693 After changing the configuration file, remember to restart the server,
694 for example, NET STOP APACHE followed by NET START APACHE, if you run
695 Apache as a Windows Service, or use your regular shortcuts.
696
697 Note: Remember that when adding path values in the Apache
698 configuration files on Windows, all backslashes such as
699 c:\directory\file.ext must be converted to forward slashes, as
700 c:/directory/file.ext.
701 _________________________________________________________________
702
703Installing as an Apache module
704
705 You should add the following lines to your Apache httpd.conf file:
706
707 Example 2-3. PHP as an Apache 1.3.x module
708
709 This assumes PHP is installed to c:\php. Adjust the path if this is
710 not the case.
711
712 For PHP 4:
713# Add to the end of the LoadModule section
714LoadModule php4_module "c:/php/php4apache.dll"
715
716# Add to the end of the AddModule section
717AddModule mod_php4.c
718
719 For PHP 5:
720# Add to the end of the LoadModule section
721LoadModule php5_module "c:/php/php5apache.dll"
722
723# Add to the end of the AddModule section
724AddModule mod_php5.c
725
726 For both:
727# Add this line inside the <IfModule mod_mime.c> conditional brace
728AddType application/x-httpd-php .php
729
730# For syntax highlighted .phps files, also add
731AddType application/x-httpd-php-source .phps
732 _________________________________________________________________
733
734Installing as a CGI binary
735
736 If you unzipped the PHP package to C:\php\ as described in the Manual
737 Installation Steps section, you need to insert these lines to your
738 Apache configuration file to set up the CGI binary:
739
740 Example 2-4. PHP and Apache 1.3.x as CGI
741ScriptAlias /php/ "c:/php/"
742AddType application/x-httpd-php .php
743
744# For PHP 4
745Action application/x-httpd-php "/php/php.exe"
746
747# For PHP 5
748Action application/x-httpd-php "/php/php-cgi.exe"
749
750# specify the directory where php.ini is
751SetEnv PHPRC C:/php
752
753 Note that the second line in the list above can be found in the actual
754 versions of httpd.conf, but it is commented out. Remember also to
755 substitute the c:/php/ for your actual path to PHP.
756
757 Warning
758
759 By using the CGI setup, your server is open to several possible
760 attacks. Please read our CGI security section to learn how to defend
761 yourself from those attacks.
762
763 If you would like to present PHP source files syntax highlighted,
764 there is no such convenient option as with the module version of PHP.
765 If you chose to configure Apache to use PHP as a CGI binary, you will
766 need to use the highlight_file() function. To do this simply create a
767 PHP script file and add this code: <?php
768 highlight_file('some_php_script.php'); ?>.
769 _________________________________________________________________
770
771Apache 2.0.x on Microsoft Windows
772
773 This section contains notes and hints specific to Apache 2.0.x
774 installs of PHP on Microsoft Windows systems. We also have
775 instructions and notes for Apache 1.3.x users on a separate page.
776
777 Note: You should read the manual installation steps first!
778
779 Warning
780
781 We do not recommend using a threaded MPM in production with Apache2.
782 Use the prefork MPM instead, or use Apache1. For information on why,
783 read the following FAQ entry
784
785 You are highly encouraged to take a look at the Apache Documentation
786 to get a basic understanding of the Apache 2.0.x Server. Also consider
787 to read the Windows specific notes for Apache 2.0.x before reading on
788 here.
789
790 PHP and Apache 2.0.x compatibility notes: The following versions of
791 PHP are known to work with the most recent version of Apache 2.0.x:
792
793 * PHP 4.3.0 or later available at http://www.php.net/downloads.php.
794 * the latest stable development version. Get the source code
795 http://snaps.php.net/php4-latest.tar.gz or download binaries for
796 Windows http://snaps.php.net/win32/php4-win32-latest.zip.
797 * a prerelease version downloadable from http://qa.php.net/.
798 * you have always the option to obtain PHP through anonymous CVS.
799
800 These versions of PHP are compatible to Apache 2.0.40 and later.
801
802 Apache 2.0 SAPI-support started with PHP 4.2.0. PHP 4.2.3 works
803 with Apache 2.0.39, don't use any other version of Apache with PHP
804 4.2.3. However, the recommended setup is to use PHP 4.3.0 or later
805 with the most recent version of Apache2.
806
807 All mentioned versions of PHP will work still with Apache 1.3.x.
808
809 Warning
810
811 Apache 2.0.x is designed to run on Windows NT 4.0, Windows 2000 or
812 Windows XP. At this time, support for Windows 9x is incomplete. Apache
813 2.0.x is not expected to work on those platforms at this time.
814
815 Download the most recent version of Apache 2.0.x and a fitting PHP
816 version. Follow the Manual Installation Steps and come back to go on
817 with the integration of PHP and Apache.
818
819 There are two ways to set up PHP to work with Apache 2.0.x on Windows.
820 One is to use the CGI binary the other is to use the Apache module
821 DLL. In either case you need to edit your httpd.conf to configure
822 Apache to work with PHP and then restart the server.
823
824 Note: Remember that when adding path values in the Apache
825 configuration files on Windows, all backslashes such as
826 c:\directory\file.ext must be converted to forward slashes, as
827 c:/directory/file.ext.
828 _________________________________________________________________
829
830Installing as a CGI binary
831
832 You need to insert these three lines to your Apache httpd.conf
833 configuration file to set up the CGI binary:
834
835 Example 2-5. PHP and Apache 2.0 as CGI
836ScriptAlias /php/ "c:/php/"
837AddType application/x-httpd-php .php
838
839# For PHP 4
840Action application/x-httpd-php "/php/php.exe"
841
842# For PHP 5
843Action application/x-httpd-php "/php/php-cgi.exe"
844
845 Warning
846
847 By using the CGI setup, your server is open to several possible
848 attacks. Please read our CGI security section to learn how to defend
849 yourself from those attacks.
850 _________________________________________________________________
851
852Installing as an Apache module
853
854 You need to insert these two lines to your Apache httpd.conf
855 configuration file to set up the PHP module for Apache 2.0:
856
857 Example 2-6. PHP and Apache 2.0 as Module
858# For PHP 4 do something like this:
859LoadModule php4_module "c:/php/php4apache2.dll"
860AddType application/x-httpd-php .php
861
862# For PHP 5 do something like this:
863LoadModule php5_module "c:/php/php5apache2.dll"
864AddType application/x-httpd-php .php
865
866# configure the path to php.ini
867PHPIniDir "C:/php"
868
869 Note: Remember to substitute the c:/php/ for your actual path to
870 PHP in the above examples. Take care to use either php4apache2.dll
871 or php5apache2.dll in your LoadModule directive and not
872 php4apache.dll or php5apache.dll as the latter ones are designed to
873 run with Apache 1.3.x.
874
875 Note: If you want to use content negotiation, read related FAQ.
876
877 Warning
878
879 Don't mix up your installation with DLL files from different PHP
880 versions. You have the only choice to use the DLL's and extensions
881 that ship with your downloaded PHP version.
882 _________________________________________________________________
883
884Sun, iPlanet and Netscape servers on Microsoft Windows
885
886 This section contains notes and hints specific to Sun Java System Web
887 Server, Sun ONE Web Server, iPlanet and Netscape server installs of
888 PHP on Windows.
889
890 From PHP 4.3.3 on you can use PHP scripts with the NSAPI module to
891 generate custom directory listings and error pages. Additional
892 functions for Apache compatibility are also available. For support in
893 current webservers read the note about subrequests.
894 _________________________________________________________________
895
896CGI setup on Sun, iPlanet and Netscape servers
897
898 To install PHP as a CGI handler, do the following:
899
900 * Copy php4ts.dll to your systemroot (the directory where you
901 installed Windows)
902 * Make a file association from the command line. Type the following
903 two lines:
904
905assoc .php=PHPScript
906ftype PHPScript=c:\php\php.exe %1 %*
907
908 * In the Netscape Enterprise Administration Server create a dummy
909 shellcgi directory and remove it just after (this step creates 5
910 important lines in obj.conf and allow the web server to handle
911 shellcgi scripts).
912 * In the Netscape Enterprise Administration Server create a new mime
913 type (Category: type, Content-Type: magnus-internal/shellcgi, File
914 Suffix:php).
915 * Do it for each web server instance you want PHP to run
916
917 More details about setting up PHP as a CGI executable can be found
918 here: http://benoit.noss.free.fr/php/install-php.html
919 _________________________________________________________________
920
921NSAPI setup on Sun, iPlanet and Netscape servers
922
923 To install PHP with NSAPI, do the following:
924
925 * Copy php4ts.dll to your systemroot (the directory where you
926 installed Windows)
927 * Make a file association from the command line. Type the following
928 two lines:
929
930assoc .php=PHPScript
931ftype PHPScript=c:\php\php.exe %1 %*
932
933 * In the Netscape Enterprise Administration Server create a new mime
934 type (Category: type, Content-Type: magnus-internal/x-httpd-php,
935 File Suffix: php).
936 * Edit magnus.conf (for servers >= 6) or obj.conf (for servers < 6)
937 and add the following: You should place the lines after mime types
938 init.
939
940Init fn="load-modules" funcs="php4_init,php4_execute,php4_auth_trans" shlib="c:
941/php/sapi/php4nsapi.dll"
942Init fn="php4_init" LateInit="yes" errorString="Failed to initialise PHP!" [php
943_ini="c:/path/to/php.ini"]
944
945 (PHP >= 4.3.3) The php_ini parameter is optional but with it you
946 can place your php.ini in your webserver config directory.
947 * Configure the default object in obj.conf (for virtual server
948 classes [Sun Web Server 6.0+] in their vserver.obj.conf): In the
949 <Object name="default"> section, place this line necessarily after
950 all 'ObjectType' and before all 'AddLog' lines:
951
952Service fn="php4_execute" type="magnus-internal/x-httpd-php" [inikey=value inik
953ey=value ...]
954
955 (PHP >= 4.3.3) As additional parameters you can add some special
956 php.ini-values, for example you can set a
957 docroot="/path/to/docroot" specific to the context php4_execute is
958 called. For boolean ini-keys please use 0/1 as value, not
959 "On","Off",... (this will not work correctly), e.g.
960 zlib.output_compression=1 instead of zlib.output_compression="On"
961 * This is only needed if you want to configure a directory that only
962 consists of PHP scripts (same like a cgi-bin directory):
963
964<Object name="x-httpd-php">
965ObjectType fn="force-type" type="magnus-internal/x-httpd-php"
966Service fn=php4_execute [inikey=value inikey=value ...]
967</Object>
968
969 After that you can configure a directory in the Administration
970 server and assign it the style x-httpd-php. All files in it will
971 get executed as PHP. This is nice to hide PHP usage by renaming
972 files to .html.
973 * Restart your web service and apply changes
974 * Do it for each web server instance you want PHP to run
975
976 Note: More details about setting up PHP as an NSAPI filter can be
977 found here: http://benoit.noss.free.fr/php/install-php4.html
978
979 Note: The stacksize that PHP uses depends on the configuration of
980 the webserver. If you get crashes with very large PHP scripts, it
981 is recommended to raise it with the Admin Server (in the section
982 "MAGNUS EDITOR").
983 _________________________________________________________________
984
985CGI environment and recommended modifications in php.ini
986
987 Important when writing PHP scripts is the fact that Sun JSWS/Sun ONE
988 WS/iPlanet/Netscape is a multithreaded web server. Because of that all
989 requests are running in the same process space (the space of the
990 webserver itself) and this space has only one environment. If you want
991 to get CGI variables like PATH_INFO, HTTP_HOST etc. it is not the
992 correct way to try this in the old PHP 3.x way with getenv() or a
993 similar way (register globals to environment, $_ENV). You would only
994 get the environment of the running webserver without any valid CGI
995 variables!
996
997 Note: Why are there (invalid) CGI variables in the environment?
998
999 Answer: This is because you started the webserver process from the
1000 admin server which runs the startup script of the webserver, you
1001 wanted to start, as a CGI script (a CGI script inside of the admin
1002 server!). This is why the environment of the started webserver has
1003 some CGI environment variables in it. You can test this by starting
1004 the webserver not from the administration server. Use the command
1005 line as root user and start it manually - you will see there are no
1006 CGI-like environment variables.
1007
1008 Simply change your scripts to get CGI variables in the correct way for
1009 PHP 4.x by using the superglobal $_SERVER. If you have older scripts
1010 which use $HTTP_HOST, etc., you should turn on register_globals in
1011 php.ini and change the variable order too (important: remove "E" from
1012 it, because you do not need the environment here):
1013variables_order = "GPCS"
1014register_globals = On
1015 _________________________________________________________________
1016
1017Special use for error pages or self-made directory listings (PHP >= 4.3.3)
1018
1019 You can use PHP to generate the error pages for "404 Not Found" or
1020 similar. Add the following line to the object in obj.conf for every
1021 error page you want to overwrite:
1022Error fn="php4_execute" code=XXX script="/path/to/script.php" [inikey=value ini
1023key=value...]
1024
1025 where XXX is the HTTP error code. Please delete any other Error
1026 directives which could interfere with yours. If you want to place a
1027 page for all errors that could exist, leave the code parameter out.
1028 Your script can get the HTTP status code with $_SERVER['ERROR_TYPE'].
1029
1030 Another possibility is to generate self-made directory listings. Just
1031 create a PHP script which displays a directory listing and replace the
1032 corresponding default Service line for
1033 type="magnus-internal/directory" in obj.conf with the following:
1034Service fn="php4_execute" type="magnus-internal/directory" script="/path/to/scr
1035ipt.php" [inikey=value inikey=value...]
1036
1037 For both error and directory listing pages the original URI and
1038 translated URI are in the variables $_SERVER['PATH_INFO'] and
1039 $_SERVER['PATH_TRANSLATED'].
1040 _________________________________________________________________
1041
1042Note about nsapi_virtual() and subrequests (PHP >= 4.3.3)
1043
1044 The NSAPI module now supports the nsapi_virtual() function (alias:
1045 virtual()) to make subrequests on the webserver and insert the result
1046 in the webpage. The problem is, that this function uses some
1047 undocumented features from the NSAPI library.
1048
1049 Under Unix this is not a problem, because the module automatically
1050 looks for the needed functions and uses them if available. If not,
1051 nsapi_virtual() is disabled.
1052
1053 Under Windows limitations in the DLL handling need the use of a
1054 automatic detection of the most recent ns-httpdXX.dll file. This is
1055 tested for servers till version 6.1. If a newer version of the Sun
1056 server is used, the detection fails and nsapi_virtual() is disabled.
1057
1058 If this is the case, try the following: Add the following parameter to
1059 php4_init in magnus.conf/obj.conf:
1060 Init fn=php4_init ... server_lib="ns-httpdXX.dll"
1061
1062 where XX is the correct DLL version number. To get it, look in the
1063 server-root for the correct DLL name. The DLL with the biggest
1064 filesize is the right one.
1065
1066 You can check the status by using the phpinfo() function.
1067
1068 Note: But be warned: Support for nsapi_virtual() is EXPERIMENTAL!!!
1069 _________________________________________________________________
1070
1071OmniHTTPd Server
1072
1073 This section contains notes and hints specific to OmniHTTPd on
1074 Windows.
1075
1076 Note: You should read the manual installation steps first!
1077
1078 Warning
1079
1080 By using the CGI setup, your server is open to several possible
1081 attacks. Please read our CGI security section to learn how to defend
1082 yourself from those attacks.
1083
1084 You need to complete the following steps to make PHP work with
1085 OmniHTTPd. This is a CGI executable setup. SAPI is supported by
1086 OmniHTTPd, but some tests have shown that it is not so stable to use
1087 PHP as an ISAPI module.
1088
1089 Important for CGI users: Read the faq on cgi.force_redirect for
1090 important details. This directive needs to be set to 0.
1091
1092 1. Install OmniHTTPd server.
1093 2. Right click on the blue OmniHTTPd icon in the system tray and
1094 select Properties
1095 3. Click on Web Server Global Settings
1096 4. On the 'External' tab, enter: virtual = .php | actual =
1097 c:\php\php.exe (use php-cgi.exe if installing PHP 5), and use the
1098 Add button.
1099 5. On the Mime tab, enter: virtual = wwwserver/stdcgi | actual =
1100 .php, and use the Add button.
1101 6. Click OK
1102
1103 Repeat steps 2 - 6 for each extension you want to associate with PHP.
1104
1105 Note: Some OmniHTTPd packages come with built in PHP support. You
1106 can choose at setup time to do a custom setup, and uncheck the PHP
1107 component. We recommend you to use the latest PHP binaries. Some
1108 OmniHTTPd servers come with PHP 4 beta distributions, so you should
1109 choose not to set up the built in support, but install your own. If
1110 the server is already on your machine, use the Replace button in
1111 Step 4 and 5 to set the new, correct information.
1112 _________________________________________________________________
1113
1114Sambar Server on Microsoft Windows
1115
1116 This section contains notes and hints specific to the Sambar Server
1117 for Windows.
1118
1119 Note: You should read the manual installation steps first!
1120
1121 This list describes how to set up the ISAPI module to work with the
1122 Sambar server on Windows.
1123
1124 * Find the file called mappings.ini (in the config directory) in the
1125 Sambar install directory.
1126 * Open mappings.ini and add the following line under [ISAPI]:
1127
1128 Example 2-7. ISAPI configuration of Sambar
1129#for PHP 4
1130*.php = c:\php\php4isapi.dll
1131
1132#for PHP 5
1133*.php = c:\php\php5isapi.dll
1134
1135 (This line assumes that PHP was installed in c:\php.)
1136 * Now restart the Sambar server for the changes to take effect.
1137 _________________________________________________________________
1138
1139Xitami on Microsoft Windows
1140
1141 This section contains notes and hints specific to Xitami on Windows.
1142
1143 Note: You should read the manual installation steps first!
1144
1145 This list describes how to set up the PHP CGI binary to work with
1146 Xitami on Windows.
1147
1148 Important for CGI users: Read the faq on cgi.force_redirect for
1149 important details. This directive needs to be set to 0. If you want
1150 to use $_SERVER['PHP_SELF'] you have to enable the cgi.fix_pathinfo
1151 directive.
1152
1153 Warning
1154
1155 By using the CGI setup, your server is open to several possible
1156 attacks. Please read our CGI security section to learn how to defend
1157 yourself from those attacks.
1158
1159 * Make sure the webserver is running, and point your browser to
1160 xitamis admin console (usually http://127.0.0.1/admin), and click
1161 on Configuration.
1162 * Navigate to the Filters, and put the extension which PHP should
1163 parse (i.e. .php) into the field File extensions (.xxx).
1164 * In Filter command or script put the path and name of your PHP CGI
1165 executable i.e. C:\php\php.exe for PHP 4, or C:\php\php-cgi.exe
1166 for PHP 5.
1167 * Press the 'Save' icon.
1168 * Restart the server to reflect changes.
1169 _________________________________________________________________
1170
1171Installation of extensions on Windows
1172
1173 After installing PHP and a webserver on Windows, you will probably
1174 want to install some extensions for added functionality. You can
1175 choose which extensions you would like to load when PHP starts by
1176 modifying your php.ini. You can also load a module dynamically in your
1177 script using dl().
1178
1179 The DLLs for PHP extensions are prefixed with php_.
1180
1181 Note: In PHP 4.3.1 BCMath, Calendar, COM, Ctype, FTP, MySQL, ODBC,
1182 Overload, PCRE, Session, Tokenizer, WDDX, XML and Zlib support is
1183 built in. You don't need to load any additional extensions in order
1184 to use these functions. See your distributions README.txt or
1185 install.txt or this table for a list of built in modules.
1186
1187 The default location PHP searches for extensions is c:\php4\extensions
1188 in PHP 4 and c:\php5 in PHP 5. To change this setting to reflect your
1189 setup of PHP edit your php.ini file:
1190
1191 * You will need to change the extension_dir setting to point to the
1192 directory where your extensions lives, or where you have placed
1193 your php_*.dll files. Please do not forget the last backslash. For
1194 example:
1195
1196extension_dir = c:/php/extensions/
1197
1198 * Enable the extension(s) in php.ini you want to use by uncommenting
1199 the extension=php_*.dll lines in php.ini. This is done by deleting
1200 the leading ; from the extension you want to load.
1201
1202 Example 2-8. Enable Bzip2 extension for PHP-Windows
1203// change the following line from ...
1204;extension=php_bz2.dll
1205
1206// ... to
1207extension=php_bz2.dll
1208
1209 * Some of the extensions need extra DLLs to work. Couple of them can
1210 be found in the distribution package, in the C:\php\dlls\ folder
1211 in PHP 4 or in the main folder in PHP 5, but some, for example
1212 Oracle (php_oci8.dll) require DLLs which are not bundled with the
1213 distribution package. If you are installing PHP 4, copy the
1214 bundled DLLs from C:\php\dlls folder to the main C:\php folder.
1215 Don't forget to include C:\php in the system PATH (this process is
1216 explained in a separate FAQ entry).
1217 * Some of these DLLs are not bundled with the PHP distribution. See
1218 each extensions documentation page for details. Also, read the
1219 manual section titled Installation of PECL extensions for details
1220 on PECL. An increasingly large number of PHP extensions are found
1221 in PECL, and these extensions require a separate download.
1222
1223 Note: If you are running a server module version of PHP remember to
1224 restart your webserver to reflect your changes to php.ini.
1225
1226 The following table describes some of the extensions available and
1227 required additional dlls.
1228
1229 Table 2-1. PHP Extensions
1230 Extension Description Notes
1231 php_bz2.dll bzip2 compression functions None
1232 php_calendar.dll Calendar conversion functions Built in since PHP
1233 4.0.3
1234 php_cpdf.dll ClibPDF functions None
1235 php_crack.dll Crack functions None
1236 php_ctype.dll ctype family functions Built in since PHP 4.3.0
1237 php_curl.dll CURL, Client URL library functions Requires:
1238 libeay32.dll, ssleay32.dll (bundled)
1239 php_cybercash.dll Cybercash payment functions PHP <= 4.2.0
1240 php_db.dll DBM functions Deprecated. Use DBA instead (php_dba.dll)
1241 php_dba.dll DBA: DataBase (dbm-style) Abstraction layer functions None
1242 php_dbase.dll dBase functions None
1243 php_dbx.dll dbx functions
1244 php_domxml.dll DOM XML functions PHP <= 4.2.0 requires: libxml2.dll
1245 (bundled) PHP >= 4.3.0 requires: iconv.dll (bundled)
1246 php_dotnet.dll .NET functions PHP <= 4.1.1
1247 php_exif.dll EXIF functions php_mbstring.dll. And, php_exif.dll must
1248 be loaded after php_mbstring.dll in php.ini.
1249 php_fbsql.dll FrontBase functions PHP <= 4.2.0
1250 php_fdf.dll FDF: Forms Data Format functions. Requires: fdftk.dll
1251 (bundled)
1252 php_filepro.dll filePro functions Read-only access
1253 php_ftp.dll FTP functions Built-in since PHP 4.0.3
1254 php_gd.dll GD library image functions Removed in PHP 4.3.2. Also note
1255 that truecolor functions are not available in GD1, instead, use
1256 php_gd2.dll.
1257 php_gd2.dll GD library image functions GD2
1258 php_gettext.dll Gettext functions PHP <= 4.2.0 requires
1259 gnu_gettext.dll (bundled), PHP >= 4.2.3 requires libintl-1.dll,
1260 iconv.dll (bundled).
1261 php_hyperwave.dll HyperWave functions None
1262 php_iconv.dll ICONV characterset conversion Requires: iconv-1.3.dll
1263 (bundled), PHP >=4.2.1 iconv.dll
1264 php_ifx.dll Informix functions Requires: Informix libraries
1265 php_iisfunc.dll IIS management functions None
1266 php_imap.dll IMAP POP3 and NNTP functions None
1267 php_ingres.dll Ingres II functions Requires: Ingres II libraries
1268 php_interbase.dll InterBase functions Requires: gds32.dll (bundled)
1269 php_java.dll Java functions PHP <= 4.0.6 requires: jvm.dll (bundled)
1270 php_ldap.dll LDAP functions PHP <= 4.2.0 requires libsasl.dll
1271 (bundled), PHP >= 4.3.0 requires libeay32.dll, ssleay32.dll (bundled)
1272 php_mbstring.dll Multi-Byte String functions None
1273 php_mcrypt.dll Mcrypt Encryption functions Requires: libmcrypt.dll
1274 php_mhash.dll Mhash functions PHP >= 4.3.0 requires: libmhash.dll
1275 (bundled)
1276 php_mime_magic.dll Mimetype functions Requires: magic.mime (bundled)
1277 php_ming.dll Ming functions for Flash None
1278 php_msql.dll mSQL functions Requires: msql.dll (bundled)
1279 php_mssql.dll MSSQL functions Requires: ntwdblib.dll (bundled)
1280 php_mysql.dll MySQL functions PHP >= 5.0.0, requires libmysql.dll
1281 (bundled)
1282 php_mysqli.dll MySQLi functions PHP >= 5.0.0, requires libmysql.dll
1283 (libmysqli.dll in PHP <= 5.0.2) (bundled)
1284 php_oci8.dll Oracle 8 functions Requires: Oracle 8.1+ client libraries
1285 php_openssl.dll OpenSSL functions Requires: libeay32.dll (bundled)
1286 php_oracle.dll Oracle functions Requires: Oracle 7 client libraries
1287 php_overload.dll Object overloading functions Built in since PHP 4.3.0
1288 php_pdf.dll PDF functions None
1289 php_pgsql.dll PostgreSQL functions None
1290 php_printer.dll Printer functions None
1291 php_shmop.dll Shared Memory functions None
1292 php_snmp.dll SNMP get and walk functions NT only!
1293 php_soap.dll SOAP functions PHP >= 5.0.0
1294 php_sockets.dll Socket functions None
1295 php_sybase_ct.dll Sybase functions Requires: Sybase client libraries
1296 php_tidy.dll Tidy functions PHP >= 5.0.0
1297 php_tokenizer.dll Tokenizer functions Built in since PHP 4.3.0
1298 php_w32api.dll W32api functions None
1299 php_xmlrpc.dll XML-RPC functions PHP >= 4.2.1 requires: iconv.dll
1300 (bundled)
1301 php_xslt.dll XSLT functions PHP <= 4.2.0 requires sablot.dll,
1302 expat.dll (bundled). PHP >= 4.2.1 requires sablot.dll, expat.dll,
1303 iconv.dll (bundled).
1304 php_yaz.dll YAZ functions Requires: yaz.dll (bundled)
1305 php_zip.dll Zip File functions Read only access
1306 php_zlib.dll ZLib compression functions Built in since PHP 4.3.0
1307 _________________________________________________________________
1308
1309Chapter 3. Installation of PECL extensions
1310
1311Introduction to PECL Installations
1312
1313 PHP extensions may be installed in a variety of ways. PECL is a
1314 repository of PHP extensions living within the PEAR structure, and the
1315 following demonstrates how to install these extensions.
1316
1317 These instructions assume /your/phpsrcdir/ is the path to the PHP
1318 source, and extname is the name of the PECL extension. Adjust
1319 accordingly. These instructions also assume a familiarity with the
1320 pear command.
1321
1322 Shared extensions may be installed by including them inside of php.ini
1323 using the extension PHP directive. See also the extensions_dir
1324 directive, and dl(). The installation methods described below do not
1325 automatically configure PHP to include these extensions, this step
1326 must be done manually.
1327
1328 When building PHP modules, it's important to have the appropriate
1329 versions of the required tools (autoconf, automake, libtool, etc.) See
1330 the Anonymous CVS Instructions for details on the required tools, and
1331 required versions.
1332 _________________________________________________________________
1333
1334Downloading PECL extensions
1335
1336 There are several options for downloading PECL extensions, such as:
1337
1338 * http://pecl.php.net
1339 Listed here is information like the ChangeLog, release
1340 information, requirements, revisions, etc. Although not every PECL
1341 extension has a webpage, most do.
1342 * pear download extname
1343 The pear command may also be used to download source files.
1344 Specific revisions may also be specified.
1345 * CVS
1346 All PECL files reside in CVS. A web-based view may be seen at
1347 http://cvs.php.net/pecl/. To download straight from CVS, consider
1348 the following where phpfi is the password for user cvsread:
1349
1350$ cvs -d:pserver:cvsread@cvs.php.net:/repository login
1351$ cvs -d:pserver:cvsread@cvs.php.net:/repository co pecl/extname
1352
1353 * Windows downloads
1354 Windows users may find compiled PECL binaries by downloading the
1355 Collection of PECL modules from the PHP Downloads page, and by
1356 retrieving a PECL Snapshot. To compile PHP under Windows, read the
1357 Win32 Build README.
1358 _________________________________________________________________
1359
1360PECL for Windows users
1361
1362 Like with any other PHP extension DLL, to install move the PECL
1363 extension DLLs into the extension_dir folder and include them within
1364 php.ini. For example:
1365
1366 extension=php_extname.dll
1367
1368 After doing this, restart the web server.
1369 _________________________________________________________________
1370
1371Compiling shared PECL extensions with PEAR
1372
1373 PEAR makes it easy to create shared PHP extensions. Using the pear
1374 command, do the following:
1375
1376 $ pear install extname
1377
1378 That will download the source for extname, and compile it on the
1379 system. This results in an extname.so file that may then be included
1380 in php.ini
1381
1382 In case the systems preferred_state is set higher than an available
1383 extname version, like it's set to stable and the extension is still in
1384 beta, either alter the preferred_state via pear config-set or specify
1385 a specific version of the PECL extension. For example:
1386
1387 $ pear install extname-0.1.1
1388
1389 Regardless, pear will copy this extname.so into the extensions
1390 directory. Adjust php.ini accordingly.
1391 _________________________________________________________________
1392
1393Compiling shared PECL extensions with phpize
1394
1395 If using pear is not an option, like for building shared PECL
1396 extensions from CVS, or for unreleased PECL packages, then creating a
1397 shared extension may also be done by manually using the phpize
1398 command. The pear command essentially does this but it may also be
1399 done manually. Assuming the source file is named extname.tgz, and that
1400 it was downloaded into the current directory, consider the following:
1401
1402$ pear download extname
1403$ gzip -d < extname.tgz | tar -xvf -
1404$ cd extname
1405$ phpize
1406$ ./configure && make
1407
1408 Upon success, this will create extname.so and put it into the modules/
1409 and/or .libs/ directory within the extname/ source. Move this shared
1410 extension (extname.so) into the PHP extensions directory, and adjust
1411 php.ini accordingly.
1412 _________________________________________________________________
1413
1414Compiling PECL extensions statically into PHP
1415
1416 To statically include the extension within the PHP build, put the
1417 extensions source into the ext/ directory found in the PHP source. For
1418 example:
1419
1420$ cd /your/phpsrcdir/ext
1421$ pear download extname
1422$ gzip -d < extname.tgz | tar -xvf -
1423$ mv extname-x.x.x extname
1424$ rm package.xml
1425
1426 This will result in the following directory:
1427
1428 /your/phpsrcdir/ext/extname
1429
1430 From here, build PHP as normal:
1431
1432$ cd /your/phpsrcdir
1433$ ./buildconf
1434$ ./configure --help
1435$ ./configure --with-extname --enable-someotherext --with-foobar
1436$ make
1437$ make install
1438
1439 Whether --enable-extname or --with-extname is used depends on the
1440 extension. Typically an extension that does not require external
1441 libraries uses --enable. To be sure, run the following after
1442 buildconf:
1443
1444 $ ./configure --help | grep extname
1445 _________________________________________________________________
1446
1447Chapter 4. Problems?
1448
1449Read the FAQ
1450
1451 Some problems are more common than others. The most common ones are
1452 listed in the PHP FAQ, part of this manual.
1453 _________________________________________________________________
1454
1455Other problems
1456
1457 If you are still stuck, someone on the PHP installation mailing list
1458 may be able to help you. You should check out the archive first, in
1459 case someone already answered someone else who had the same problem as
1460 you. The archives are available from the support page on
1461 http://www.php.net/support.php. To subscribe to the PHP installation
1462 mailing list, send an empty mail to
1463 php-install-subscribe@lists.php.net. The mailing list address is
1464 php-install@lists.php.net.
1465
1466 If you want to get help on the mailing list, please try to be precise
1467 and give the necessary details about your environment (which operating
1468 system, what PHP version, what web server, if you are running PHP as
1469 CGI or a server module, safe mode, etc...), and preferably enough code
1470 to make others able to reproduce and test your problem.
1471 _________________________________________________________________
1472
1473Bug reports
1474
1475 If you think you have found a bug in PHP, please report it. The PHP
1476 developers probably don't know about it, and unless you report it,
1477 chances are it won't be fixed. You can report bugs using the
1478 bug-tracking system at http://bugs.php.net/. Please do not send bug
1479 reports in mailing list or personal letters. The bug system is also
1480 suitable to submit feature requests.
1481
1482 Read the How to report a bug document before submitting any bug
1483 reports!
1484 _________________________________________________________________
1485
1486Chapter 5. Runtime Configuration
1487
1488The configuration file
1489
1490 The configuration file (called php3.ini in PHP 3, and simply php.ini
1491 as of PHP 4) is read when PHP starts up. For the server module
1492 versions of PHP, this happens only once when the web server is
1493 started. For the CGI and CLI version, it happens on every invocation.
1494
1495 The default location of php.ini is a compile time option (see the FAQ
1496 entry), but can be changed for the CGI and CLI version with the -c
1497 command line switch, see the chapter about using PHP from the command
1498 line. You can also use the environment variable PHPRC for an
1499 additional path to search for a php.ini file.
1500
1501 If php-SAPI.ini exists (where SAPI is used SAPI, so the filename is
1502 e.g. php-cli.ini or php-apache.ini), it's used instead of php.ini.
1503
1504 Note: The Apache web server changes the directory to root at
1505 startup causing PHP to attempt to read php.ini from the root
1506 filesystem if it exists.
1507
1508 The php.ini directives handled by extensions are documented
1509 respectively on the pages of the extensions themselves. The list of
1510 the core directives is available in the appendix. Probably not all the
1511 PHP directives are documented in the manual though. For a completel
1512 list of directives available in your PHP version, please read your
1513 well commented php.ini file. Alternatively, you may find the the
1514 latest php.ini from CVS helpful too.
1515
1516 Example 5-1. php.ini example
1517; any text on a line after an unquoted semicolon (;) is ignored
1518[php] ; section markers (text within square brackets) are also ignored
1519; Boolean values can be set to either:
1520; true, on, yes
1521; or false, off, no, none
1522register_globals = off
1523track_errors = yes
1524
1525; you can enclose strings in double-quotes
1526include_path = ".:/usr/local/lib/php"
1527
1528; backslashes are treated the same as any other character
1529include_path = ".;c:\php\lib"
1530 _________________________________________________________________
1531
1532How to change configuration settings
1533
1534Running PHP as an Apache module
1535
1536 When using PHP as an Apache module, you can also change the
1537 configuration settings using directives in Apache configuration files
1538 (e.g. httpd.conf) and .htaccess files. You will need "AllowOverride
1539 Options" or "AllowOverride All" privileges to do so.
1540
1541 With PHP 4 and PHP 5, there are several Apache directives that allow
1542 you to change the PHP configuration from within the Apache
1543 configuration files. For a listing of which directives are
1544 PHP_INI_ALL, PHP_INI_PERDIR, or PHP_INI_SYSTEM, have a look at the
1545 List of php.ini directives appendix.
1546
1547 Note: With PHP 3, there are Apache directives that correspond to
1548 each configuration setting in the php3.ini name, except the name is
1549 prefixed by "php3_".
1550
1551 php_value name value
1552 Sets the value of the specified directive. Can be used only
1553 with PHP_INI_ALL and PHP_INI_PERDIR type directives. To clear a
1554 previously set value use none as the value.
1555
1556 Note: Don't use php_value to set boolean values. php_flag (see
1557 below) should be used instead.
1558
1559 php_flag name on|off
1560 Used to set a boolean configuration directive. Can be used only
1561 with PHP_INI_ALL and PHP_INI_PERDIR type directives.
1562
1563 php_admin_value name value
1564 Sets the value of the specified directive. This can not be used
1565 in .htaccess files. Any directive type set with php_admin_value
1566 can not be overridden by .htaccess or virtualhost directives.
1567 To clear a previously set value use none as the value.
1568
1569 php_admin_flag name on|off
1570 Used to set a boolean configuration directive. This can not be
1571 used in .htaccess files. Any directive type set with
1572 php_admin_flag can not be overridden by .htaccess or
1573 virtualhost directives.
1574
1575 Example 5-2. Apache configuration example
1576<IfModule mod_php5.c>
1577 php_value include_path ".:/usr/local/lib/php"
1578 php_admin_flag safe_mode on
1579</IfModule>
1580<IfModule mod_php4.c>
1581 php_value include_path ".:/usr/local/lib/php"
1582 php_admin_flag safe_mode on
1583</IfModule>
1584<IfModule mod_php3.c>
1585 php3_include_path ".:/usr/local/lib/php"
1586 php3_safe_mode on
1587</IfModule>
1588
1589 Caution
1590
1591 PHP constants do not exist outside of PHP. For example, in httpd.conf
1592 you can not use PHP constants such as E_ALL or E_NOTICE to set the
1593 error_reporting directive as they will have no meaning and will
1594 evaluate to 0. Use the associated bitmask values instead. These
1595 constants can be used in php.ini
1596 _________________________________________________________________
1597
1598Changing PHP configuration via the Windows registry
1599
1600 When running PHP on Windows, the configuration values can be modified
1601 on a per-directory basis using the Windows registry. The configuration
1602 values are stored in the registry key HKLM\SOFTWARE\PHP\Per Directory
1603 Values, in the sub-keys corresponding to the path names. For example,
1604 configuration values for the directory c:\inetpub\wwwroot would be
1605 stored in the key HKLM\SOFTWARE\PHP\Per Directory
1606 Values\c\inetpub\wwwroot. The settings for the directory would be
1607 active for any script running from this directory or any subdirectory
1608 of it. The values under the key should have the name of the PHP
1609 configuration directive and the string value. PHP constants in the
1610 values are not parsed. However, only configuration values changeable
1611 in PHP_INI_USER can be set this way, PHP_INI_PERDIR values can not.
1612 _________________________________________________________________
1613
1614Other interfaces to PHP
1615
1616 Regardless of how you run PHP, you can change certain values at
1617 runtime of your scripts through ini_set(). See the documentation on
1618 the ini_set() page for more information.
1619
1620 If you are interested in a complete list of configuration settings on
1621 your system with their current values, you can execute the phpinfo()
1622 function, and review the resulting page. You can also access the
1623 values of individual configuration directives at runtime using
1624 ini_get() or get_cfg_var().
1625