2

getting error

Call to undefined function mysql_connect()

tring to run php website on IIS 7.5.

hakre
  • 184,866
  • 48
  • 414
  • 792
coure2011
  • 37,153
  • 75
  • 206
  • 328

5 Answers5

3
  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
Pekka
  • 431,103
  • 135
  • 960
  • 1,075
1

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

Community
  • 1
  • 1
Fredrik
  • 86
  • 4
1

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)

Tails
  • 544
  • 6
  • 15
0

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)

HellBaby
  • 530
  • 1
  • 6
  • 23
0

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]

Brian
  • 71
  • 7