|
|
PHP/Windows Installation NotesWindows Manual installation from zip binary distribution
This guide provides manual installation support for:
Personal Web Server 3 and 4 or newer PHP 4 for Windows comes in two flavours - a CGI executable (php.exe), and several SAPI modules (for exapmle php4isapi.dll). The latter form is new to PHP 4, and provides significantly improved performance and some new functionality. However, please note that the SAPI modules are *NOT* yet considered to be production quality. In particular, with the ISAPI module, you are likely to encounter serious reliability problems especially on platforms older than W2K - you may witness a lot of server 500 errors and suffer from other server modules such as ASP also failing. You have been warned! The reason for this is that the PHP SAPI modules are using the thread-safe version of the PHP code, which is new to PHP 4, and has not yet been tested and pounded enough to be considered completely stable, and there are actually a few known bugs. On the other hand, some people have reported very good results with the SAPI modules, and there a few reports of problems with the Apache module version. In short - your mileage may vary; If you need absolute stability, trade the performance of the SAPI modules with the stability of the CGI executable. If you choose one of the SAPI modules and use Windows 95, be sure to download the DCOM update from http://download.microsoft.com/msdownload /dcom/95/x86/en/ dcom95.exe For the ISAPI module, an ISAPI 4.0 compliant Web server is required (tested on IIS 4.0, PWS 4.0 and IIS 5.0). IIS 3.0 is *NOT* supported; You should download and install the Windows NT 4.0 Option Pack with IIS 4.0 if you want native PHP support. 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 2000 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 OmniHTTPd, 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 extensions you would like to load when PHP starts, noting that several extensions are already built into the Windows release, see the section about Windows extensions for details of the built in extensions. You can uncomment the: 'extension=php_*.dll' lines in php.ini to load these extensions. Some extensions require you to have additional libraries installed on your system for the module to work correctly. The PHP FAQ at www.php.net/FAQ.php has more information on where to get supporting libraries. You can also load a module dynamically in your script using dl. See the section about Windows extensions. Note that on a new installation it is advisable to first get PHP working and tested without any extensions before enabling them in php.ini. On PWS and IIS, you can set the browscap.ini to point to: 'c:\windows\system\inetsrv\browscap.ini' on Windows 9x/Me and 'c:\winnt\system32\inetsrv\browscap.ini' on NT/2000 Server. Additional information on using the browscap functionality in PHP can be found at http://php.netvision.net.il/browser-id.php3 select the "source" button to see it in action. Note that the mibs directory supplied with the Windows distribution contains support files for SNMP. This directory should be moved to DRIVE:\usr\mibs (DRIVE being the drive where PHP is installed.) Some DLLs are required for some PHP extensions. Please copy them to your to your windows/system (Win9.x) or winnt/system32 (WinNT, Win2000) directory. If you already have these DLLs installed on your system, overwrite them only if something is not working correctly. Before overwriting them, it is a good idea to back them or move them to another folder - just in case something goes wrong. Installation of Windows extensions ================================== After installing PHP and a webserver on Windows, you will probably want to install some extensions for added functionality. The following table describes some of the extensions available. As described in the manual installation steps, you can choose which extensions you would like to load when PHP starts by uncommenting the: extension=php_*.dll' lines in php.ini. Some extensions require you to have additional libraries installed on your system for the module to work correctly. The PHP FAQ at at www.php.net/FAQ.php has more information on where to get supporting libraries. You can also load a module dynamically in your script using dl. The DLLs for PHP extensions are prefixed with 'php_'. This prevents confusion between PHP extensions and their supporting libraries. Note:
In PHP 4.0.5 MySQL, ODBC, FTP, Calendar, BCMath, COM, PCRE,
Session, WDDX and XML support is PHP Extensions php_calendar.dll Calendar conversion functions php_crypt.dll Crypt functions php_dbase.dll dBase functions php_dbm.dll Berkeley DB2 library php_filepro.dll Read-only access to Filepro databases php_gd.dll GD library functions for GIF manipulation php_hyperwave.dll HyperWave functions php_imap4r2.dll IMAP 4 functions php_ldap.dll LDAP 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_oci73.dll Oracle functions php_snmp.dll SNMP get and walk functions (NT only!) php_zlib.dll ZLib compression functions Web server configuration ======================== Installing PHP on Windows with Apache 1.3.x There are two ways to set up PHP to work with Apache 1.3.x on Windows. One is to use the CGI binary (php.exe), the other is to use the Apache module dll. In either case you need to stop the Apache server, and edit your srm.conf or httpd.conf to configure Apache to work with PHP. Although there can be a few variations of configuring PHP under Apache, these are simple enough to be used by the newcomer. Please consult the Apache Docs for further configuration directives. If you unzipped the PHP package to C:\PHP\ as desribed above, you need to insert these lines to your Apache conf file to set up the CGI binary:
Remember to restart the server, for example, NET STOP APACHE followed by NET START APACHE If you would like to use PHP as a module in Apache, you should move php4ts.dll to the windows/system (for Windows 9x/Me) or winnt/system32 (for Windows NT/2000) directory, overwriting any older file. Then you should add the following two lines to you Apache conf file:
Remember to restart the server, for example, NET STOP APACHE followed by NET START APACHE To use the source code highlighting feature, simply create a PHP script file and stick this code in: Substitute original_php_script.php with the name of the file you wish to show the source of. (This is the only way of doing so). On Win-Apache all backslashes in a path statement such as: "c:\directory\file.ext", must be converted to forward slashes. ------------------------------------------------------------ Installing PHP on Windows with IIS/PWS This section contains notes and hints specific to IIS (Microsoft Internet Information Server). Installing PHP for PWS/IIS 3 and PWS/IIS 4 or newer versions. Windows and PWS/IIS 3 - including PWS on Win 9x/ME The recommended method for configuring these servers is to use the REG file incuded with the distribution (pws-php4cgi.reg). You may want to edit this file and make sure the extensions and PHP install directories match your configuration - once you have done this, just double click on the file and it will update your registry. Alternatively, 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. Run Regedit. 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 Repeat these steps for each extension you wish to associate with PHP scripts. The following steps do not affect the web server installation and only apply if you want your php scripts to be executed when they are run from the command line (ex. run c:\myscripts\test.php) or by double clicking on them in a directory viewer window. You may wish to skip this step as you might prefer the php files to load into a text editor when you double click on them. 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'). Exit Regedit. 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 available at http://www.genusa.com/iis/iiscfg.html from Steven Genusa to configure their script maps. Windows NT/2000 and IIS 4 or newer and PWS 4 on NT Workstation or W2K non server editions To install PHP on an NT/2000 Server running IIS 4 or newer, follow these instructions. You have two options to set up PHP, using the CGI binary (php.exe) or with the ISAPI module. In either case, you need to start the Microsoft Management Console (may appear as 'Internet Services Manager', either in your Windows NT 4.0 Option Pack branch or the Control Panel=>Administrative Tools under Windows 2000). Then right click on your Web server node (this will most probably appear as 'Default Web Server'), and select 'Properties'. If you want to use the CGI binary, do the following: Under 'Home Directory', 'Virtual Directory', or 'Directory', click on the 'Configuration' button, and then enter the App Mappings tab. Click Add, and in the Executable box, type: c:\php\php.exe (assuming that you have unzipped PHP in c:\php\). In the Extension box, type the file name extension you want associated with PHP scripts. Leave 'Method exclusions' blank, and check the Script engine checkbox. You may also like to check the 'check that file exists' box - for a small performance penalty, IIS (or PWS) will check that the script file exists and sort out authentication before firing up php. This means that you will get sensible 404 style error messages instead of cgi errors complaing that php did not output any data. You must repeat from 'Click Add...' for each extension you want associated with PHP scripts. (.php is recommended. although .phtml and .php3 may be required for legacy applications.) 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 To use the ISAPI module, do the following: If you don't want to perform HTTP Authentication using PHP, you can (and should) skip this step. Under ISAPI Filters, add a new ISAPI filter. Use PHP as the filter name, and supply a path to the php4isapi.dll. Under 'Home Directory', click on the 'Configuration' button. Add a new entry to the Application Mappings. Use the path to the php4isapi.dll as the Executable, supply .php as the extension, leave Method exclusions blank, and check the Script engine checkbox. Stop IIS completely (net stop iisadmin) Start IIS again (net start w3svc) |