0
votes

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"

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

[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

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

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

3
mysql_* functions have been removed from PHP7. You'll need to translate your code to use PDO or mysqli instead. - aynber
Warning This extension was deprecated in PHP 5.5.0, and it was removed in PHP 7.0.0. - AbraCadaver
Betcha it's not. Use phpinfo() on the debian8 server, and you'll most likely see it's pointing to a PHP5 installation. - aynber

3 Answers

2
votes

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

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

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


FOLLOWUP:

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.

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.

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

0
votes

PHP 7 has removed mysql_* completely. Use PDO or mysqli

0
votes

The mysql_connect function was deprecated in version 5.5 and completely removed in 7.0.

You'll need to use mysqli or PDO.