ChrisCodes.com

PHP 5, MySQL on Apache, Windows XP Home

I recently decided to install PHP 5 to try it out before it's released. I figured I won't be doing any hardcore testing on it, but do want to start playing with the new features, so Release Candidate 2 sounded pretty good. This installation is going on my Windows partition which is running Windows XP Home. I already had PHP 4 installed with Apache 1.3.28.

This is by no means a step by step. The best instructions for installing Apache, PHP, and MySQL are found right in the install files distibuted with the downloads. This is mearly my notes on how I upgraded from PHP 4 to PHP 5 on Apache / Windows, and how I got MySQL to work with PHP 5.

First step was to download PHP. I downloaded the zipped binary for Win32.

I have PHP, MySQL, Apache, and Tomcat all installed in C:\\ampt. Apache is in C:\\ampt\\Apache. PHP is in C:\\ampt\\PHP, etc. I unzipped the PHP 5 zip to C:\\ampt\\php5

Since PHP 4 was already installed, I copied and renamed my php.ini file to php4.ini.bak. Then opened my httpd.conf file and commented out the line that loads php4. To comment it out, just place a # in front of the following line.

LoadModule php4_module modules/php4apache.dll

Right under it I placed the following:

LoadModule php5_module modules/php5apache.dll

Then I copied php5apache.dll, php5ts.dll to C:\\ampt\\Apache\\modules. Then copied the new PHP 5 php.ini file to C:\\ampt\\Apache and configured it. The most obvious difference here was that no extensions were loaded by default. Not even MySQL. I choose to keep it that way for a test run, then load the needed extensions. I restarted Apache, and received no errors. A quick phpinfo() revealed PHP 5.0.0RC2, so I went on to load the extensions I use. I uncommented curl, gd2, mysql, and pdf one at a time and restarted to be sure each one worked OK seperately. Keep in mind that when loading extensions, PHP uses the directory you've specified in the extension_dir setting in the php.ini file. Mine is set as follows:

extension_dir = "C:\\ampt\\php5\\ext"

I ran into a problem trying to load the MySQL extension. It was easily fixed by copying libmysql.dll to the system directory. On my XP home box it was C:\\WINDOWS\\System32, but can vary depending on which version of Windows you are running. I couldn't load php_pdf.dll either, but haven't looked into it yet. Once I've looked at it, I'll post an update.

Chris keyed this in on: 2004-05-01
Filed in: Apache, Database, MySQL, PHP, Web Development, Webserver, Windows

Feed Icon

Copyright © 2009 Chris Martin