PHP致命错误:调用未定义函数mysql_connect() [英] PHP Fatal error : Call to undefined function mysql_connect()

查看:79
本文介绍了PHP致命错误:调用未定义函数mysql_connect()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近在CentOS 7上以以下配置安装了PHP 7.0.8(ZTS):

I have recently installed PHP 7.0.8 (ZTS) on CentOS 7 with the following configuration:

--prefix=/usr/local/php7 \
--with-config-file-scan-dir=/usr/local/php7/etc/conf.d \
--enable-bcmath \
--enable-calendar \
--enable-exif \
--enable-opcache
--enable-dba \
--enable-ftp \
--with-gettext \
--with-gd \
--with-jpeg-dir \
--enable-mbstring \
--with-mcrypt \
--with-mhash \
--enable-mysqlnd \
--with-mysql=mysqlnd \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-mysql-sock=/var/run/mysqld/mysqld.sock \
--with-openssl \
--enable-pcntl \
--enable-soap \
--enable-sockets \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--with-zlib \
--enable-zip \
--with-readline \
--with-curl \
--enable-shmop \
--enable-fpm \
--enable-maintainer-zts \
--enable-pthreads=shared \
--with-tsrm-pthreads \
--enable-fastcgi \
--with-fpm-user=www-data \
 --with-fpm-group=www-data"

我无法进入我的网站,因为尝试进入我的网站时出现以下nginx日志错误:

I can't go on my website because I have the following nginx log error when I try to go on my website:

[错误] 20609#20609:* 8在stderr中发送的FastCGI:"PHP消息:PHP致命错误:未捕获的错误:调用/adodb/drivers/adodb-mysql.inc.php:461中未定义的函数mysql_connect()

[error] 20609#20609: *8 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught Error: Call to undefined function mysql_connect() in /adodb/drivers/adodb-mysql.inc.php:461

在另一个配置了Debian8,PHP7(与此处相同的配置)的服务器上,该网站可以正常运行.

This website is ok on an another server configured with Debian8, PHP7 (same configuration like here).

我已经安装了MySQL 5.7和Nginx 1.10.我该如何纠正该错误?

I have installed MySQL 5.7 and Nginx 1.10. How I can correct this error?

推荐答案

要更正错误,您基本上有两种选择

To correct the error, you've basically got two choices, either

1)修改代码以删除对mysql扩展的引用(并改用mysqli或PDO),或者

1) modify the code to remove references to the mysql extension (and use mysqli or PDO instead), or

2)安装支持mysql扩展的较旧版本的PHP(在PHP7之前)

2) install an older version of PHP (before PHP7) which supports the mysql extension

关注度:

如果您的说法是正确的... mysql _ 函数在PHP7下运行,那么最可能的解释是有人安装了导出 mysql_的第三方模块/库.函数.

If what you claim is true... that mysql_ functions are working under PHP7, then the most likely explanation for that is that someone installed a third party module/library that exports mysql_ functions.

我相信已经做了一些工作来构建这样的库,以提供向后兼容性.该库将使用较新的PHP mysqli _ 函数与数据库进行交互,并为旧版应用程序提供(主要是)兼容的 mysql _ 函数.

I believe there was some work done to build such a library, to provide backwards compatiblity. The library would interact with the database using using the newer PHP mysqli_ functions, and provide (mostly) compatible mysql_ functions for legacy applications.

但这不是PHP7的一部分.那将是第三方的补充.

But that's not part of PHP7. That would be a third party add on.

这篇关于PHP致命错误:调用未定义函数mysql_connect()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆