调用未定义的函数mysql_connect()

getting error

Call to undefined function mysql_connect()

tring to run php website on IIS 7.5.

  1. Locate the correct php.ini file (check phpinfo() if in doubt)
  2. Locate the line saying

    extension=php_mysql_libmysql.dll
    

    and make sure it is uncommented (no ; in front)

  3. Save
  4. Restart web server

Had the same problem on Windows 7 and IIS

My solution was to add a registry key where to read the php.ini from: http://php.net/manual/en/configuration.file.php

Computer needed a restart after the key was added.

Other with similar solution but for Apache Command Line PHP mysql_connect() Error

On Linux (Ubuntu here specifically) make sure the package php5-mysql is installed. (And restart apache after doing so, with service apache2 restart or /etc/init.d/apache2 restart)

I realize this thread is very old, but I Googled this exact error for hours including several articles here before finding a solution elsewhere...

On Windows, make sure you add a server environment variable telling it which PHP.INI file to load on startup.

PHPRC = [path to your php.ini]

See that the version 5.2 still support mysql but starting with 5.4, php dumped mysql and mysqli for mysqlnd so this may cause your problem(at least it was for me)