Call to undefined function mysql_connect()

对着背影说爱祢 提交于 2019-12-11 04:18:49

问题


getting error

Call to undefined function mysql_connect()

tring to run php website on IIS 7.5.


回答1:


  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



回答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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!