Fatal error: Call to undefined function mysql_connect()

SUMMARY

Fatal error: Call to undefined function mysql_connect()

PHP no longer bundles PHP with the MySQL libraries enabled. This means that to use the MySQL functions you will need to enable them manually.

Because the MySQL libraries are not enabled the mysql functions are undefined, this being the result of the above error.

Follow the instructions below to correct the error. These instructions assume you have PHP installed in the C:\PHP directory.

INSTRUCTIONS

  1. Search your server for libmysql.dll. Delete any instance of libmysql.dll that is not in the C:\PHP directory. This limits the possibility of older MySQL client API's being used with PHP.

  2. Search your server for php_mysql.dll. Delete any instance of php_mysql.dll that is not in the C:\PHP directory. This limits the possibility of older MySQL client API's being used with PHP.

  3. Open your C:\%WIN%\php.ini file in a text editor (Notepad will work).

  4. Search for the line that looks like...

    ;extension=php_mysql.dll

    Change this line to...

    extension=php_mysql.dll

  5. Save the modified php.ini file.

  6. Copy C:\PHP\libmysql.dll and C:\PHP\ext\php_mysql.dll to the C:\%WIN%\system32 folder.

  7. Restart IIS and test it out.
 Article ID: 73
 Created: November 29, 2004
 Updated: November 29, 2004
 Rating: 3.96 (2325 votes)
(2325 votes)

Can't find your answer? Ask a Question, and we'll get back with you.

  © OSI Codes, Inc. All Rights Reserved