Support

Admin Tools for WordPress

#37817 Extension 'mysql_' is deprecated since PHP 5.5 and removed since PHP 7.0; Use mysqli instead

Posted in ‘Admin Tools for WordPress’
This is a public ticket

Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.

Environment Information

WordPress version
6.0.2
PHP version
7.4
Admin Tools version
Version 1.5.

Latest post by nicholas on Sunday, 02 October 2022 02:50 CDT

lemtrac

Greeting

 

I have a lot of site Joomla and Wordpress and have the same issue when I switch to PHP 8 and test

Attached you will see error report

Why is this happening 

Please look at the bottom of this page (under Support Policy Summary) for our support policy summary, containing important information regarding our working hours and our support policy. Thank you!

 kevin

nicholas
Akeeba Staff
Manager

No attachment came but I understand the problem.

It happens because the old mysql extension used by PHP to connect to MySQL and MariaDB database servers was deprecated since PHP 5.5 and completely removed in PHP 7.0 and later. You need to use the mysqli extension to connect to your database server. See the red box in the official MySQL documentation: https://www.php.net/mysql_connect

Also note that this message does not come from our software. We do not have this kind of message anywhere in it and I don't see any similar messages in WordPress either.

For Joomla, you need to edit the configuration.php file and change the $dbtype line as follows:

public $dbtype = 'mysqli';

Please note the trailing i. It makes all the difference. Another option is using pdomysql instead of mysqli, depending on what your server supports. The alternative uses the PDO (PHP Data Objects) extensions which is an ever more modern, faster and more robust way to connect to database servers than the obsolete mysql and the legacy mysqli extensions but it's not as widely supported.

As for WordPress, I am really puzzled because it does not require any special configuration. It automatically detects if your server supports mysqli and uses it instead of the mysql connector. We also do the same in the CLI, JSON API and remote backup endpoints.

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!