views:

220

answers:

2

I just installed Apache 2.2.15/PHP 5.3.2/MySQL 5.1.44 on Windows Vista. Apache is working fine, PHP is functional, and MySQL works on the CLI. However, when I try to access MySQL via PHP, I get an error (Fatal error: Call to undefined function mysql_connect()). extension=php_mysql.dll and extension=php_mbstring.dll are uncommented in the php.ini file, and PHP is in the system path. There is no libmysql.dll in either the top level PHP directory or the ext directory. There's a libmySQL.dll file in the MySQL bin directory (which is also in the system path); I tried renaming it, but that doesn't do anything

Also, in case anyone wants to know, I originally installed PHP using the MSI installer, but it was missing some DLLs, so I installed from the zip file.

I think I've exhausted all my options. Any help on this problem would be very appreciated.

Thanks in advance.

A: 

It sounds like you do not have the MySQL mod for PHP properly installed or configured. I recommend using AMP on Linux, so sorry for not having any specific instructions for Windows.

Ferdy
+1  A: 

IIRC the msi installer sets some registry values that influence the php configuration, see http://docs.php.net/configuration.changes#configuration.changes.windows. That might change the location of the php.ini that is used. You might want to delete those registry keys. Anyway, you did edit the file that is shown in the output of phpinfo()?

Which build of php do you use? The one you can download from http://windows.php.net/download/? Then you probably have the new mysqlnd transport driver built into the php core dll and don't need libmysql.dll. The mysqlnd driver should show up in the output of phpinfo(). Does it?

VolkerK
Yes, I have the version from that link (5.3.2). There are no registry keys for PHP. mysqlnd shows up on the phpinfo page (hussain.mooo.com/phpinfo.php). The ini file I'm using is the correct one.Also, php_mysql and php_mbstring are the only extensions that I'm loading.
Hussain
That's strange, the phpinfo() you've linked to has a "mysql" section `Client API version mysqlnd 5.0.7-dev - 091210 - $Revision: 294543 $`. You should be good to go....
VolkerK
I don't think the problem is with mysqlnd, though. The problem right now is PHP can't find the mysql_connect function, which would be in the php_mysql extension. The mysqlnd dll only provides a communication layer between php_mysql and mysql IIRC.
Hussain
But there is a `mysqlnd` _and_ a `mysql` section. The line I quoted is from the mysql section. The php_mysql module (which exposes mysql\_connect()) _has_ been loaded - at least your phpinfo.php page says so.
VolkerK
Hmm, after restarting my machine, it now recognizes the function, but still throws an error. Something about mysql not returning a response or what not. (hussain.mooo.com)
Hussain
Is 3306 really the port MySQL is listening to? It's the default port for tcp connections but it might be configured otherwise. Try `netstat -a -b > netstat.txt` (might take a while) and then search the file for an entry of the mysql service.
VolkerK