Recently I updated my websites php from 5.6 to 7.2 but afterwards my website sometimes/often shows the internal server error message. I set debug to true and got the following errors:

PHP Warning: mysqli_query(): MySQL server has gone away in /var/www/wp-includes/wp-db.php on line 2033
PHP Warning: mysqli_query(): Error reading result set's header in /var/www/wp-includes/wp-db.php on line 2033

Does anyone have an idea how to fix this? I've tried to let wordpress repair the database but that didn't change anything.

Online I read everywhere that I should restore the database from a backup. I've made a backup just before updating my php but I'm wondering if that is the best course of action. First of all, won't that break the site again? Because now my site is running php 7.2 and that database is from php 5.6. And secondly, if that somehow also restores my php to 5.6, I need 7.2 for woocommerce.


  • It may be that the mysql_queries you're using have somehow been deprecated and no longer execute properly with PHP 7.2. But that'd only be if you've got custom written queries either in your theme or in some older plugin. Are all of your plugins and WordPress itself up-to-date. Take a look at WooCommerce status screen if you can access it and see if it gives you any warnings about your MYSQL being out of date or any of your plugins. Oct 8, 2020 at 16:42

1 Answer 1


Your PHP ‘timeout’ setting is too low. If a PHP script needs access to your database and it can’t fetch the information within the timeout window that’s been set, this can also trigger

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.