问题
getting error
Call to undefined function mysql_connect()
tring to run php website on IIS 7.5.
回答1:
- Locate the correct
php.ini
file (checkphpinfo()
if in doubt) Locate the line saying
extension=php_mysql_libmysql.dll
and make sure it is uncommented (no
;
in front)- Save
- Restart web server
回答2:
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
回答3:
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
)
回答4:
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]
回答5:
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)
来源:https://stackoverflow.com/questions/4817944/call-to-undefined-function-mysql-connect