Installation on Windows 9x/Me/NT/2000 systems

There are two main ways to install PHP for Windows: either manually or by using the InstallShield installer.

If you have Microsoft Visual Studio, you can also build PHP from the original source code.

Once you have PHP installed on your Windows system, you may also want to load various extensions for added functionality.

Windows InstallShield

The Windows PHP installer available from the downloads page at http://www.php.net/, this installs the CGI version of PHP and, for IIS, PWS, and Xitami, configures the web server as well.

Install your selected HTTP server on your system and make sure that it works.

Run the executable installer 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.

General Installation Steps

This install guide will help you manually install and configure PHP on your Windows 9x/Me/NT/2000 webservers. This guide was compiled by Bob Silva. The original version can be found at http://www.umesd.k12.or.us/php/win32install.html.

This guide provides manual installation support for:

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. 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, even though we're not aware of anyone actually running it on a production site. 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 the Microsoft DCOM pages. 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.

Building from source

Before getting started, it is worthwhile answering the question: "Why is building on Windows so hard?" Two reasons come to mind:

  1. Windows does not (yet) enjoy a large community of developers who are willing to freely share their source. As a direct result, the necessary investment in infrastructure required to support such development hasn't been made. By and large, what is available has been made possible by the porting of necessary utilities from Unix. Don't be surprised if some of this heritage shows through from time to time.

  2. Pretty much all of the instructions that follow are of the "set and forget" variety. So sit back and try follow the instructions below as faithfully as you can.

Preparations

Before you get started, you have a lot to download....

  • For starters, get the Cygwin toolkit from the closest cygwin mirror site. This will provide you most of the popular GNU utilities used by the build process.

  • Download the rest of the build tools you will need from the PHP site at http://www.php.net/extra/win32build.zip.

  • Get the source code for the DNS name resolver used by PHP at http://www.php.net/extra/bindlib_w32.zip. This is a replacement for the resolv.lib library included in win32build.zip.

  • If you don't already have an unzip utility, you will need one. A free version is available from InfoZip.

Finally, you are going to need the source to PHP 4 itself. You can get the latest development version using anonymous CVS. If you get a snapshot or a source tarball, you not only will have to untar and ungzip it, but you will have to convert the bare linefeeds to crlf's in the *.dsp and *.dsw files before Microsoft Visual C++ will have anything to do with them.

Note: Place the Zend and TSRM directories inside the php4 directory in order for the projects to be found during the build process.

Putting it all together

  • Follow the instructions for installing the unzip utility of your choosing.

  • Execute setup.exe and follow the installation instructions. If you choose to install to a path other than c:\cygnus, let the build process know by setting the Cygwin environment variable. On Windows 95/98 setting an environment variable can be done by placing a line in your autoexec.bat. On Windows NT, go to My Computer => Control Panel => System and select the environment tab.

    Warning

    Make a temporary directory for Cygwin to use, otherwise many commands (particularly bison) will fail. On Windows 95/98, mkdir C:\TMP. For Windows NT, mkdir %SystemDrive%\tmp.

  • Make a directory and unzip win32build.zip into it.

  • Launch Microsoft Visual C++, and from the menu select Tools => Options. In the dialog, select the directories tab. Sequentially change the dropdown to Executables, Includes, and Library files, and ensure that cygwin\bin, win32build\include, and win32build\lib are in each list, respectively. (To add an entry, select a blank line at the end of the list and begin typing). Typical entries will look like this:

    • c:\cygnus\bin

    • c:\php-win32build\include

    • c:\php-win32build\lib

    Press OK, and exit out of Visual C++.

  • Make another directory and unzip bindlib_w32.zip into it. Decide whether you want to have debug symbols available (bindlib - Win32 Debug) or not (bindlib - Win32 Release). Build the appropriate configuration:

    • For GUI users, launch VC++, and then select File => Open Workspace and select bindlib. Then select Build=>Set Active Configuration and select the desired configuration. Finally select Build=>Rebuild All.

    • For command line users, make sure that you either have the C++ environment variables registered, or have run vcvars.bat, and then execute one of the following:

      • msdev bindlib.dsp /MAKE "bindlib - Win32 Debug"

      • msdev bindlib.dsp /MAKE "bindlib - Win32 Release"

    • At this point, you should have a usable resolv.lib in either your Debug or Release subdirectories. Copy this file into your win32build\lib directory over the file by the same name found in there.

Compiling

The best way to get started is to build the standalone/CGI version.

  • For GUI users, launch VC++, and then select File => Open Workspace and select php4ts. Then select Build=>Set Active Configuration and select the desired configuration. Finally select Build=>Rebuild All.

  • For command line users, make sure that you either have the C++ environment variables registered, or have run vcvars.bat, and then execute one of the following:

    • msdev php4ts.dsp /MAKE "php4ts - Win32 Debug_TS"

    • msdev php4ts.dsp /MAKE "php4ts - Win32 Release_TS"

    • At this point, you should have a usable php.exe in either your Debug_TS or Release_TS subdirectories.

Repeat the above steps with php4isapi.dsp (which can be found in sapi\isapi) in order to build the code necessary for integrating PHP with Microsoft IIS.

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 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.4pl1 MySQL, ODBC, FTP, Calendar, BCMath, COM, PCRE, Session, WDDX and XML support is built-in. You don't need to load any additional extensions in order to use these functions. See your distributions README.txt or install.txt for a list of built in modules.

Table 2-1. PHP Extensions

php_calendar.dllCalendar conversion functions
php_crypt.dllCrypt functions
php_dbase.dlldBase functions
php_dbm.dllBerkeley DB2 library
php_filepro.dllRead-only access to Filepro databases
php_gd.dllGD library functions for GIF manipulation
php_hyperwave.dllHyperWave functions
php_imap4r2.dllIMAP 4 functions
php_ldap.dllLDAP functions
php_msql1.dllmSQL 1 client
php_msql2.dllmSQL 2 client
php_mssql.dllMSSQL client (requires MSSQL DB-Libraries
php3_mysql.dll (built into PHP 4)MySQL functions
php_nsmail.dllNetscape mail functions
php_oci73.dllOracle functions
php_snmp.dllSNMP get and walk functions (NT only!)
php_zlib.dllZLib compression functions


HIVE: All information for read only. Please respect copyright!
Hosted by hive КГБ: Киевская городская библиотека