After update this morning php does not work any more. Error:
AH01071: Got error 'PHP message: PHP Fatal error: Call to undefined function mysqli_connect() in /var/www/html/public_html/.../config.php on line 2\n', referer: http://localhost/public_html/
php -v
PHP 7.0.6-9+donate.sury.org~xenial+2 (cli) ( NTS ) Copyright (c) 1997-2016 The PHP Group Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
The libraries were installed before, took me quite some time to adapt after dist-upgrading to 16.04
Without more information I can only describe general causes:
php7.0-mysql
package is not installed, to fix runsudo apt-get install php-mysql
mysqli
module got somehow disabled, to fix runphpenmod mysqli
libapache2-mod-php5.6
withphp7.0-cli
php5.6-fpm
package) and Apache2 module (f.e.libapache2-mod-php7.0
). Disable the FPM by running:a2disconf php5.5-fpm
.extension=mysqli.so
to this custom configuration fileTo get more diagnostics:
run `php -r 'phpinfo();' and check the output for MySQL references:
Do the same with the web, create a simple page with just `' and check the output for MySQLI module
After further looking into the issue, we found out, that there was a mix of PHP 5.5 and PHP 7.0 in the system that probably confused Apache2. As a general recommendation I would definitely recommend start with one PHP version to debug and purge the other(s).
To completely purge a specific PHP version, you can purge
phpX.Y-common
package that will pull all the other reverse dependencies:Example: