I just installed Apache 2.2.17, PHP 5.2.14, and MySQL 5.1.51 on Windows XP. Apache is working and is loading PHP properly, but when I try to connect to MySQL, I get "Fatal error: Call to undefined function mysql_connect()". After some googling, I found that I need to load the php_mysql.dll extension, which requires libmysql.dll. I found the libmysql.dll file in the MySQL distribution, but php_mysql.dll is nowhere to be found.
Why is it not included with PHP or MySQL? Where can I find it?
PHP/MySQL Installation manual
The file http://windows.php.net/downloads/releases/php-5.2.14-Win32-VC6-x86.zip as downloaded from http://windows.php.net/download/ does include php_mysql.dll. It's in the "ext" subdirectory.
You'll need to rename
php.ini-recommended
tophp.ini
. Then, editphp.ini
and make sure thatextension_dir
is pointing to the correct directory, i.e. the one containing php_mysql.dll, e.g.c:\php\ext
. Also, search for the line;extension=php_mysql.dll
and uncomment it to enable the extension.Lastly, the file
libmysql.dll
should be available to the Windows system PATH. The easiest way to accomplish that is by adding the directory to which you installed PHP to your PATH.Remember to restart Apache after making changes to php.ini. Hope this helps!