I love the idea of open source (OS) software. And I am a keen promoter of it. But since my time is very restricted due to workload, I find it often very frustrating to install OS software. Sometimes I think the programmers and providers of the software tick along the motto: It was hard for us to program, so we make it hard for you to install and use.
So I want to ease the pain of some other lay OS products users by giving some simple step by step guidance of how to integrate PHP 5.3.0 with Apache.
The environment I installed this combination of Apache and PHP 5.3.0 is Windows XP SP3 and Microsoft Server 2003 SE SP2.
So here's a step by step guide:
# | Description | Keywords |
1 | Download the zip Version of PHP on download site above. Note: If you are using PHP with Apache 1 or Apache 2 from apache.org you need to use the VC6 versions of PHP. The direct link to the download is: http://windows.php.net/downloads/releases/php-5.3.0-Win32-VC6-x86.zip | Download |
2 | Extract the contents of the zip file into a new folder C:\PHP | Install |
3 | Open the file C:\PHP\php.ini-production and save it as php.ini in the same directory | php.ini |
4 | In php.ini, find short_open_tag = Off and set it to short_open_tag = On, find magic_quotes_gpc = Off and set it On, find ;session.save_path = /tmp unquote it (remove ;) and set it tosession.save_path = "C:\temp,save and exit php.ini | php.ini |
5 | Open C:\Program Files\Apache Software Foundation\Apache2.2\conf\httpd.confand add the following line after all the LoadModule statements: LoadModule php5_module "c:/php/php5apache2_2.dll" | httpd.conf |
6 | Search for "AddType" in the file, and add the following line after the last "AddType" statement. Do this no matter which version of Apache you are using. For Apache 2.2.x, you can find the "AddType" lines in the AddType application/x-httpd-php .php AddType application/x-httpd-php .phtml | httpd.conf |
7 | To indicate the location of your PHP ini file. Add the following line to the end of your httpd.conf file. PHPIniDir "c:/php" This ensures that the correct database drivers are found. This is especially important with Postgres! | httpd.conf |
8 | As an alternative, the php.ini could be included in the environment variable PATH: „C:\PHP” | PATH |
9 | To get Postgres working with PHP, verify that the php_pgsql.dll file sits in the extension directory of PHP (in my case C:\PHP\ext). In the php.ini file, uncomment the extensions directory path and add the path where the extensions are located (in my case extension_dir = "C:\PHP\ext") and finally uncomment the extensions in the windows extensions section (extension=php_pgsql.dll) | PG connection |
Relevant websites:
Integrating PHP 5.3.0 in Apache: http://www.thesitewizard.com/php/install-php-5-apache-windows.shtml"
Downloading PHP: http://windows.php.net/download/