phpwordpressmysqlipleskmysqlnd

Wordpress blog with technical difficulties after migrating to a PHP 7.3 server and even disabling all plugins


I'm trying to complete a migration to a new server that has PHP 7.3. I come from a server that had PHP 5.6 and I've successfully migrated other WP blogs from the old server to the new one without any problems.

The error I'm seeing is a grey page with this error message:

The site is experiencing technical difficulties.

So this, in my opinion, leaves problems due to PHP 7.3 being installed incorrectly out. Since it actually works great for other WP blogs, and for Plesk too.

I've read in other posts that there was a possibility that my wp-config.php file was missing this line: define('WP_USE_EXT_MYSQL', true); however that's not the case.

And I've also read somewhere else, that the new server could have missing the nd_mysqli PHP extension. But that's not the case either. It's enabled. And I've desactivated the mysqli PHP extension. After that, I've restarted apache2 with no luck either.

So...what am I missing? It's really curious that deactivating the plugins doesn't make the WP site work either. To do so, I've renamed the plugins folder into plugins_old and I keep seeing the same error message :(

I've forgot to show the whole error log:

AH01071: Got error 'PHP message: PHP Fatal error: Uncaught Error: Call to undefined function mysql_connect() in /var/www/vhosts/mywpsite.com/httpdocs/wp-includes/wp-db.php:1645
Stack trace:\n#0 /var/www/vhosts/mywpsite.com/httpdocs/wp-includes/wp-db.php(639): wpdb->db_connect()
#1 /var/www/vhosts/mywpsite.com/httpdocs/wp-includes/load.php(427): wpdb->__construct('secret...', 'other_secret', 'anothe......', 'localhost')
#2 /var/www/vhosts/mywpsite.com/httpdocs/wp-settings.php(120): require_wp_db()
#3 /var/www/vhosts/mywpsite.com/httpdocs/wp-config.php(82): require_once('/var/www/vhosts...')
#4 /var/www/vhosts/mywpsite.com/httpdocs/wp-load.php(37): require_once('/var/www/vhosts...')
#5 /var/www/vhosts/mywpsite.com/httpdocs/wp-blog-header.php(13): require_once('/var/www/vhosts...')
#6 /var/www/vhosts/mywpsite.com/httpdocs/index.php(17): require('/var/www/vhosts...')
#7 {main}\n thrown in /var/www/vhosts/mywpsite.com/...'

Just to clarify, the database, user and password are correct.

PHP installed modules

php -m
[PHP Modules]
calendar
Core
ctype
curl
date
dom
exif
fileinfo
filter
ftp
gd
gettext
hash
iconv
imap
ionCube Loader
json
libxml
mbstring
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
posix
readline
Reflection
session
shmop
SimpleXML
sockets
sodium
SPL
sqlite3
standard
sysvmsg
sysvsem
sysvshm
tokenizer
wddx
xml
xmlreader
xmlwriter
xsl
Zend OPcache
zip
zlib

[Zend Modules]
Zend OPcache
the ionCube PHP Loader (enabled) + Intrusion Protection from ioncube24.com (unconfigured)

UPDATE

Now every other WP website in the new server isn't working. I've PHP 7.2 and PHP 7.3. All websites are using PHP 7.3 though. However Prestashop websites keep running smoothly.

I've tried in Plesk to set PHP 7.2 with the same results.

The errors are all the same Call to undefined function mysql_connect.

UPDATE 2

Disabling mysqli seems to make things worse. Since it produces Call to undefined function mysql_connect for all WP blogs. Even the one that never works well.

So I'll keep mysqli extension enabled.


Solution

  • At the end it's been a combination of issues, but I've finally surrounded the problem to a WP plugin, that might not have PHP 7.3 (probably 7.2 neither, since I tried with it) support. The plugin folder is cystats.

    So somehow at the beginning there was an incompatibility with this WP blog that had to do with mysql extension being enabled. After turning it off, it still didn't work, but it seems I didn't restart Apache, so I was seeing the old Call to undefined function mysql_connect() error.

    Later, something messed up with all WP blogs (disabling mysqli extension), and finally, after having the original WP blog broken alone, I realized the error wasn't the same. Now it was:

    Got error 'PHP message: PHP Fatal error: Uncaught Error: Call to undefined function mysql_error() in /var/www/vhosts/mywpsite.com/httpdocs/wp-content/plugins/cystats/includes/cystats.class.php:1455
    

    So finally everything is solved, clearly WP is compatible with PHP 7.3, and mysql extension must be disabled to work well with it. Some plugins might not be up to date, and that's the reason why they don't work with PHP 7.3 and why they worked on PHP 5.6.

    So after migrating a WP blog to a new setup, plugins can ruin the migration if you don't figure it out.

    Thanks for the help with the comments, they were definitely helpful as well.

    As I read here Wordpress Fatal error: Uncaught Error: Call to undefined function mysql_connect() in /wp-includes/wp-db.php:1570 it could have seemed that adding this line: define('WP_USE_EXT_MYSQL', true); would have made the plugin error go away, but the undefined mysql_connect error comes back if I set this define.