Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

undefined function mysql_connect()

Status
Not open for further replies.

Gazzieh

IS-IT--Management
Dec 18, 2006
117
GB
I have just installed Apache 2.2.8, MySQL 5.0.51a and PHP 5.2.5 onto a Windows Vista system.

Apache is running as a service, has been tested and everything is fine.

MySQL is running as a service, has had limited testing but seems fine.

PHP is running fine and phpinfo.php works.

However, whenever I test the connectivity between PHP and MySQL I get the following error:

Fatal error: Call to undefined function mysql_connect() in C:\Apache\htdocs\mysqltest.php on line 6

My php.ini is in the windows folder, I have placed the php_mysql.dll into the %systemroot%/system and have added this to the path (path checks out fine). In fact I have also placed c:/php/ext to include all the dlls within the php system.

In php.ini I have defined the doc_root = "c:\Apache\htdocs", extension_dir = "c:\php\ext" and extension= "php_mysql.dll" (I have also had this as extension=php_mysql.dll, though php example carries quotes).

When I run phpinfo.php I get no mention of MySQL at all and the error given above appears with mysqltest.php.

Any ideas anyone please?
 
as you surmise, the php extension for mysql is not loading. make sure that the display_startup_errors directive is set to on in your php.ini and that log_errors is set to on

restart the webserver and then examine the error log.

remember that the slashes in windows paths should, by preference, be forward slashes in the php.ini file. i don't recall, in honesty, whether that could be an issue.

and also note that libmysql.dll also needs to be in your system32 directory or the php extensions directory needs to be in your environment path.
 
Sorry for the lengthy delay in responding; been away.

The issue was Windows Vista UAC, which must be switched off throughout the installation process for all three packages.

I finally used EasyPHP to get the install correct (failed with UAC active) and then reverse-engineered.

Thanks for help anyhow... :eek:)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top