I get this error message everyday:
WARNING: MYSQL_OPT_RECONNECT is deprecated and will be removed in a future version.
Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.
Latest post by nicholas on Friday, 26 January 2024 02:11 CST
I get this error message everyday:
WARNING: MYSQL_OPT_RECONNECT is deprecated and will be removed in a future version.
I am not sure in what context you get this message, but it does not come from Akeeba Backup since we're not using this flag. As far as I can see, neither does Joomla itself. It looks like this is coming from something third party.
Of course any further context would greatly help figure out what you mean. You get it daily doing what? Where? What is the file and line mentioned in the message? Have you tried turning debug site on? Does that change the message? If so, what does it say? Giving me a random warning from something we don't use in our code does not help me help you.
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!
I get the message daily from the CRON Daemon:
|
1:12 AM (9 hours ago) | |||
|
Ah! Now it makes far more sense. It is a PHP bug. The position of that message and the capitalisation of "WARNING" told me a lot about what is going on, I'm not even kidding. Warnings coming from code written in the PHP language use a lowercase spelling ("Warning:") and mention a file and line number. This laconic error message actually comes from libmysqlclient, a PHP dependency.
OK, let's take it one step at a time.
We need to know if the database connection is established, or if it needs to be re-established. To do that, we call PHP's mysql_ping()
function.
Since your global PHP configuration option mysqli.reconnect
is enabled – something we have no control over – the PHP MySQL driver (mysqli) sends an instruction to the MySQL C++ connection library (libmysqlclient) with the flag MYSQL_OPT_RECONNECT. This flag is deprecated on MySQL 8 which is why a warning is printed.
Again, the problem is inside PHP itself, not our code. Again, the trigger for that is inside the PHP configuration itself which only your host and you can modify, not us.
One solution for this is to use PDO MySQL instead of mysqli in your site's Global Configuration. This is a more modern, more stable driver. It will stop PHP from causing this problem because PDO does not have an equivalent for mysql_ping()
. Instead, we just run a simple SQL statement (SELECT 1
) and check whether the server fails to execute it.
Another solution is to contact your server and make sure that the global PHP configuration option mysqli.reconnect
is disabled, and you don't have a php.ini, or .user.ini file which enables it. If it's already disabled, then the problem you have is that maybe PHP 8.1 has not been updated, though I have to say that on my own servers with mysqli.reconnect disabled I cannot reproduce the problem with the latest releases of PHP 7.4, 8.0, 8.1, 8.2, and 8.3.
If you would like more proof this does not come from our code, here's an example of this happening with Perl, a different programming language. Look at the comments in https://github.com/brianmario/mysql2/issues/1322 to see people saying that this is indeed the case with a large number of programming languages as well.
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!
Thank you! I have contacted my hosting service.
Does this error affect back/restore?
No, it does not affect anything.
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!
Working hours: We are open Monday to Friday, 9am to 7pm Cyprus timezone (EET / EEST). Support is provided by the same developers writing the software, all of which live in Europe. You can still file tickets outside of our working hours, but we cannot respond to them until we're back at the office.
Support policy: We would like to kindly inform you that when using our support you have already agreed to the Support Policy which is part of our Terms of Service. Thank you for your understanding and for helping us help you!