PHP 5 Setup

Instructions | API Docs | Apache Setup | PHP Setup | Unit Tests


Installation

The current version of PHP as this is written is 5.1.2. You can get the current distribution from the download section of the PHP site. You should select the ZIP package rather than the pre-packaged installer to be sure that you get the necessary library files.

Once downloaded, extract the Zip file to a directory. This document will assume C:\dev\php5 as your base directory.

Build, Configure, and Deploy

Configure

PHP 5 includes two .ini files to be used as templates for configuration. Rename php.ini-recommended to php.ini.

Set extension_dir

Search for the string "extension_dir" in php.ini. Uncomment it and set it equal to "c:/dev/php5/ext/". If you have installed into another directory adjust accordingly. PHP requires an explicit path to find your extensions under Windows.

Turn on the required extensions

In order to use the HTTPS protocol you need to enable some of the PHP extensions. Search for "extension=php_curl.dll". There should be a semi-colon in front of that line - remove it to enable the extension. Scroll down and find "extension=php_openssl.dll" and do the same. Now scroll down a bit further and find "extension=php_sockets.dll". Leave this line alone, but insert a new line below it and type "extension=php_soap.dll" on that line. For some reason, this entry doesn't appear in the default configuration. That's all you need to do for now. Save the file and exit.

Install SSL Library files

Now you need to copy the SSL library files from the PHP installation directory to your Windows system directory. The two files are libeay32.dll and ssleay32.dll. They need to be copied into the system directory, usually c:\windows\system32 on an XP system. If you happen to have OpenSSL already installed on your computer you may find that these files are already installed. If they are, you should only replace them if the ones from the PHP directory are more recent. Change the extensions on the existing ones by adding '.bak' just to be safe.

Update the System Path

You'll need to add the PHP installation directory to your system path. Right-click on My Computer on your desktop (or in the Start menu) and select 'Properties'. Click on the Advanced tab and then the 'Environment Variables' button. Scroll down in the System variables list until you find 'Path'. Select it and click the 'Edit' button. Click at the end of the string and make sure that the rest of the string is not highlighted. Type ";c:\php" at the end of the existing string and click OK until all of the windows are closed.