Home » Technology » Software » How to fix HTTP 500 Fatal error: Uncaught Error: Call to undefined function mysql_escape_string() after migrating WordPress Site [Fixed]

How to fix HTTP 500 Fatal error: Uncaught Error: Call to undefined function mysql_escape_string() after migrating WordPress Site [Fixed]

Migrating WordPress site is quite easy you can read a quick guide on how to migrate a WordPress site from one host to another. But it might get tricky sometimes, if you have successfully migrated your site from one host to another and still getting error then you have to make sure that you have checked and adjusted the following things;

1 Changing WP-Config.php file

Make sure that you have configured the credentials of new host database correctly, in your Wp-config.php file double check the database name, database username, and database password. Make sure the new host credentials are entered correctly.

2 Database Table Prefix

The second most important thing to check is the database prefix, in your WP-config.php file there is an entry:  $table_prefix = ‘wp_’;

You have to make sure that the database you imported from other host has the same table prefix which is defined in the wp-config.php file, if there is a difference in table prefix it might not connect to the database properly.

To check this, log in to your phpMyadmin and click on the database, the tables listed should have a prefix such as; wp_ or wpil_ or wpl_ whatever it is, make sure it is the same in phpMyadmin tables and wp-config.php file.

3 Site URL and Home URL

Another important thing is to check your database table which is _options table. Click on the table and check the Site URL and Home URL entries, it should reflect your new domain where you have migrated your site.

If everything you did right and you are still unable to connect your site to the database correctly or the WordPress site is not loading and throwing theme errors, HTTP 500 errors or you get the error message

“Your PHP installation appears to be missing the MySQL extension which is required by WordPress.”

Or turning on WP_DEBUG mode you get detailed Fatal error something like;

Fatal error: Uncaught Error: Call to undefined function mysql_escape_string() in /home/user/public_html/wp-content/themes/novelty/functions.php:60 Stack trace: #0 /home/user/public_html/wp-settings.php(426): include() #1 /home/user/public_html/wp-config.php(74): require_once(‘/home/user/…’) #2 /home/user/public_html/wp-load.php(37): require_once(‘/home/user/…’) #3 /home/user/public_html/wp-blog-header.php(13): require_once(‘/home/user/…’) #4 /home/user/public_html/index.php(17): require(‘/home/user/…’) #5 {main} thrown in /home/expandme/public_html/wp-content/themes/novelty/functions.php on line 60

Then you might have a compatibility issue with your WordPress installation and the php version you are using on your server.

The Fix

To fix this issue simply log in to your Cpanel, under Software click on the MultiPHP Manager, it will show you the current system PHP version. Selecting ea-php56 might solve your problem, check the domain you wish to change the version for and then from the right drop-down menu select the PHP version.

This should solve your site loading problem, if one version is not working try selecting the other one and refresh to reload your site and purge the cpanel cache. You will be able to fix your errors once you have selected the right PHP version for your WordPress site.

Mark Goodman

Digital marketing enthusiast and industry professional in Digital technologies, Technology News, Mobile phones, software, gadgets with vast experience in the tech industry, I have a keen interest in technology, News breaking.