2011-01-27 14:58
浏览 559


getting error

Call to undefined function mysql_connect()

tring to run php website on IIS 7.5.

图片转代码服务由CSDN问答提供 功能建议


 调用未定义的函数mysql_connect()\  n   

在IIS 7.5上运行php网站。

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

5条回答 默认 最新

  • duanshang7007
    duanshang7007 2011-01-27 15:02
    1. Locate the correct php.ini file (check phpinfo() if in doubt)
    2. Locate the line saying


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

    3. Save
    4. Restart web server
    点赞 评论
  • dqf67993
    dqf67993 2011-08-07 21:23

    Had the same problem on Windows 7 and IIS

    My solution was to add a registry key where to read the php.ini from:

    Computer needed a restart after the key was added.

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

    点赞 评论
  • dongtangjie0495
    dongtangjie0495 2011-10-19 10:24

    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)

    点赞 评论
  • dougong5285
    dougong5285 2012-02-16 06:32

    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]

    点赞 评论
  • duanliang789262
    duanliang789262 2013-05-09 20:00

    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)

    点赞 评论