首页 服务器 编程 必备知识 搜索引擎 圩日手册
站内搜索
最近浏览
推荐文章
热文排行

PHP Fatal error: Call to undefined function mysql_connect() in XXX.php


centos系统,安装好了apache和mysql数据库了之后,打开网站显示空白,然后进入/etc/httpd/logs查看日志文件,在error_log文件里面查看到以下错误:


[Thu Aug 10 10:40:43 2017] [error] [client 192.168.31.180] PHP Fatal error:  Call to undefined function mysql_connect() in /wwwroot/lyx_5ht6cv/web/inc/config.php on line 11

[Thu Aug 10 10:40:45 2017] [error] [client 192.168.31.180] PHP Fatal error:  Call to undefined function mysql_connect() in /wwwroot/lyx_5ht6cv/web/inc/config.php on line 11

[Thu Aug 10 10:40:45 2017] [error] [client 192.168.31.180] PHP Fatal error:  Call to undefined function mysql_connect() in /wwwroot/lyx_5ht6cv/web/inc/config.php on line 11

[Thu Aug 10 10:40:46 2017] [error] [client 192.168.31.180] PHP Fatal error:  Call to undefined function mysql_connect() in /wwwroot/lyx_5ht6cv/web/inc/config.php on line 11

[Thu Aug 10 10:40:53 2017] [error] [client 192.168.31.180] PHP Fatal error:  Call to undefined function mysql_connect() in /wwwroot/lyx_5ht6cv/web/1.php on line 10

[Thu Aug 10 10:40:56 2017] [error] [client 192.168.31.180] PHP Fatal error:  Call to undefined function mysql_connect() in /wwwroot/lyx_5ht6cv/web/1.php on line 10

[Thu Aug 10 10:40:56 2017] [error] [client 192.168.31.180] PHP Fatal error:  Call to undefined function mysql_connect() in /wwwroot/lyx_5ht6cv/web/1.php on line 10



blob.png



然后运行phpinfo();,发现是没有安装有mysql组件,导致无法连接mysql数据库,使用yum安装一下mysql组件,一切恢复正常。

# yum install php-mysql


当然,您还可以一起安装其它的PHP组件.

#yum install php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc

[ly70041]
添加时间:2017-08-10
版权所有(C)2005-2015