Windows, Apache, MySQL, PHP

So, getting Apache and PHP to work on Windows XP and Windows Server 2003 was harder than it should have been… if you get this in your Apache error log:

PHP Warning: PHP Startup: Unable to load dynamic library 'D:/PHP/ext\\php_mysql.dll' - The specified module could not be found.\r\n in Unknown on line 0

chances are it isn’t because php_mysql.dll can’t be found, but because libmysql.dll, the DLL it depends on, can’t be found.

I’ve found that the following works every time (using Apache 2.0.59 and PHP 5.1.6)…

Unpack the PHP zip file to D:\PHP (or wherever you want).

Copy php.ini-recommended as php.ini. Set the value of extension_dir to "D:/PHP/ext".

Add these lines to the end of Apache’s httpd.conf:

LoadModule php5_module D:/PHP/php5apache2.dll
AddType application/x-httpd-php .php

Add D:\PHP to the PATH system variable (Win+Break → Advanced tab → Environment Variables). Then reboot to really add it to the PATH

All of this is documented, but it’s a bit fragmented; this, this and this are useful.

This entry was posted in Uncategorized and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s