This install guide will help you install and configure PHP on your Windows 9x/NT webservers. This guide was compiled by Bob Silva. The latest revision can be found at http://www.umesd.k12.or.us/php/win32install.html.
This guide provides installation support for:
The following steps should be performed on all installations before the server specific instructions.
Extract the distribution file to a directory of your choice. "C:\PHP\" is a good start.
Copy the file, 'php.ini-dist' to your '%WINDOWS%' directory on Windows 95/98 or to your '%SYSTEMROOT%' directory under Windows NT or Windows 20000 and rename it to 'php.ini'. Your '%WINDOWS%' or '%SYSTEMROOT%' directory is typically:
|c:\windows for Windows 95/98|
|c:\winnt or c:\winnt40 for NT/2000 servers|
Edit your 'php.ini' file:
You will need to change the 'extension_dir' setting to point to your php-install-dir, or where you have placed your 'php_*.dll' files. ex: c:\php
If you are using Omni Httpd, do not follow the next step. Set the 'doc_root' to point to your webservers document_root. ex: c:\apache\htdocs or c:\webroot
Choose which modules you would like to load when PHP starts. You can uncomment the: 'extension=php_*.dll' lines to load these modules. Some modules require you to have additional libraries installed on your system for the module to work correctly. The PHP FAQ has more information on where to get supporting libraries. You can also load a module dynamically in your script using: dl("php_*.dll");
On PWS and IIS, you can set the browscap.ini to point to: 'c:\windows\system\inetsrv\browscap.ini' on Windows 95/98 and 'c:\winnt\system32\inetsrv\browscap.ini' on NT Server. Additional information on using the browscap functionality in PHP can be found at this mirror, select the "source" button to see it in action.
The DLLs for PHP extensions are prefixed with 'php_'. This prevents confusion between PHP extensions and their supporting libraries.
The recommended method for configuring these servers is to use the INF file included with the distribution (php_iis_reg.inf). You may want to edit this file and make sure the extensions and PHP install directories match your configuration. Or you can follow the steps below to do it manually.
WARNING: These steps involve working directly with the windows registry. One error here can leave your system in an unstable state. We highly recommend that you back up your registry first. The PHP Development team will not be held responsible if you damage your registry.
Navigate to: HKEY_LOCAL_MACHINE /System /CurrentControlSet /Services /W3Svc /Parameters /ScriptMap.
On the edit menu select: New->String Value.
Type in the extension you wish to use for your php scripts. ex: .php
Double click on the new string value and enter the path to php.exe in the value data field. ex: c:\php\php.exe %s %s. The '%s %s' is VERY important, PHP will not work properly without it.
Repeat these steps for each extension you wish to associate with PHP scripts.
Now navigate to: HKEY_CLASSES_ROOT
On the edit menu select: New->Key.
Name the key to the extension you setup in the previous section. ex: .php
Highlight the new key and in the right side pane, double click the "default value" and enter phpfile.
Repeat the last step for each extension you set up in the previous section.
Now create another New->Key under HKEY_CLASSES_ROOT and name it phpfile.
Highlight the new key phpfile and in the right side pane, double click the "default value" and enter PHP Script.
Right click on the phpfile key and select New->Key, name it Shell.
Right click on the Shell key and select New->Key, name it open.
Right click on the open key and select New->Key, name it command.
Highlight the new key command and in the right side pane, double click the "default value" and enter the path to php.exe. ex: c:\php\php.exe -q %1. (don't forget the %1).
If using PWS on Windows, reboot to reload the registry.
PWS and IIS 3 users now have a fully operational system. IIS 3 users can use a nifty tool from Steven Genusa to configure their script maps.
To install PHP on an NT Server running IIS 4, follow these instructions:
In Internet Service Manager (MMC), select the Web site or the starting point directory of an application.
Open the directory's property sheets (by right clicking and selecting properties), and then click the Home Directory, Virtual Directory, or Directory tab.
Click the Configuration button, and then click the App Mappings tab.
Click Add, and in the Executable box, type: c:\path-to-php-dir\php.exe %s %s. You MUST have the %s %s on the end, PHP will not function properly if you fail to do this.
In the Extension box, type the file name extension you want associated with PHP scripts. (You must repeat step 5 and 6 for each extension you want accociated with PHP scripts. (.php and .phtml are common.)
Set up the appropriate security. (This is done in Internet Service Manager), and if your NT Server uses NTFS file system, add execute rights for I_USR_ to the directory that contains php.exe.
You must edit your srm.conf or httpd.conf to configure Apache to work with the PHP CGI binary.
Although there can be a few variations of configuring PHP under Apache, this one is simple enough to be used by the newcomer. Please consult the Apache Docs for further configuration directives.
ScriptAlias /php/ "c:/path-to-php-dir/"
AddType application/x-httpd-php .php
AddType application/x-httpd-php .phtml
Action application/x-httpd-php "/php/php.exe"
To use the source code highlighting feature, simply create a PHP script file and stick this code in: <?php show_source ("original_php_script.php"); ?>. Substitute original_php_script.php with the name of the file you wish to show the source of. (this is only one way of doing it). Note: On Win-Apache all back slashes in a path statement such as: "c:\directory\file.ext", must be converted to forward slashes.
This has got to be the easiest config there is:
Step 1: Install Omni server
Step 2: Right click on the blue OmniHTTPd icon in the system tray and select Properties
Step 3: Click on Web Server Global Settings
Step 4: On the 'External' tab, enter: virtual = .php | actual = c:\path-to-php-dir\php.exe
Step 5: On the Mime tab, enter: virtual = wwwserver/stdcgi | actual = .php
Step 6: Click OK
Repeat steps 2 - 6 for each extension you want to associate with PHP.
The Windows PHP installer available from the downloads page at http://www.php.net/ installs the CGI version of PHP and, for IIS, PWS, and Xitami, configures the web server as well.
Install your choosen http server on your system and make sure it all works.
Run the installer exe file and follow the instructions provided by the installation wizard. Two types of installation are supported - standard, which provides sensible defaults for all the settings it can, and advanced, which asks questions as it goes along.
The installation wizard gathers enough information to set up the php.ini file and configure the web server to use PHP. For IIS and also PWS on NT Workstation, a list of all the nodes on the server with script map settings is displayed, and you can choose those nodes to which you wish to add the PHP script mappings.
Once the installation has completed the installer will inform you if you need to restart your system, restart the server, or just start using PHP.
Table 2-1. PHP Modules
|php_calendar.dll||Calendar conversion functions|
|php_dbm.dll||GDBM emulation via Berkely DB2 library|
|php_filepro.dll||READ ONLY access to filepro databases|
|php_gd.dll||GD Library functions for gif manipulation|
|php_imap4r2.dll||IMAP 4 functions|
|php_msql1.dll||mSQL 1 client|
|php_msql2.dll||mSQL 2 client|
|php_mssql.dll||MSSQL client (requires MSSQL DB-Libraries|
|php3_mysql.dll (Built into PHP 4)||MySQL functions|
|php_nsmail.dll||Netscape mail functions|
|php_snmp.dll||SNMP get and walk functions (NT only!)|