“500 Internal Server Error” after updating a WordPress site to PHP 7.3

This post was most recently updated on April 28th, 2019.

Reading Time: 5 minutes.

Now for something totally different – for a change, I got to fix an issue with my own blog, so I had the chance to delve into PHP and WordPress configurations… :)

PHP is an ever-evolving language – even if it might not always feel that way. The old workhorse has been powering most of the internet for a couple of decades, and weirdly enough, doesn’t really show signs of going anywhere.

A huge part of the success story has been the fact that WordPress, the most popular website platform in the world, is built on it.

With WordPress 5.1 (just published), the platform now complains if you’re using old versions of PHP. That’s a great move if you ask me – even though WordPress works just fine with older versions, it’s safer and faster to run later and up-to-date versions. Currently, it’ll complain about anything below 5.6, but hopefully that version will be bumped up as soon as possible. See below for the warning in action:

WordPress 5.1 now bugs you to update your PHP version if you're running and old and insecure version.
WordPress 5.1 now bugs you to update your PHP version if you’re running and old and insecure version. (read more)

Anyway – if you’re running anything less than PHP 7.2, you should probably update, as all the earlier versions are either unsupported or only getting security patches.

Upgrading from PHP 5.6

PHP 5 was released in 2004(!), and 5.6 was the last version of PHP 5 that was still recently supported. It reached its end-of-life at the beginning of 2019, so it was a good time to upgrade.

Looking at the options today, 7.0 is already deprecated, so I’m left with 7.1, 7.2 and 7.3, the last 2 of which are still completely supported. 7.1 only receives security fixes currently.

Each new version brings new improvements and features, but also could deprecate old features or even remove modules or functions that your current solutions rely on… So before choosing the correct version, it’s wise to check any compatibility information your current solution providers offer.

My primary interest in this particular case was WordPress, as that’s the platform my current blog is hosted on. WordPress has compatibly info available here: https://wordpress.org/about/requirements/

From PHP 5.6 straight to PHP 7.3

Well, that’s simple and straightforward. At the time of writing, PHP 7.3 is the recommendation for WordPress, but versions all the way back to early 2000s are supported.

Since WordPress didn’t seem to have any issues, I started looking at my plugins – but most of them don’t have much info available in regards of PHP compatibility, so soon enough I gave up. Post-upgrade, I’d always have the option to downgrade.

So I went forward with the upgrade, jumping directly to PHP 7.3. When hitting refresh a few times afterwards, I was faced with this error:

PHP Fatal error:  Uncaught Error: Call to undefined function mysql_connect()

Ouch. Sounds like something very elementary is now broken. If WordPress can’t access the database hosting its data, there isn’t much it’s going to do.

So, I started digging. This is what I found in the error_log:

[07-Jan-2019 20:36:35 UTC] PHP Fatal error:  Uncaught Error: Call to undefined function mysql_connect() in [site]public_html/[site]/wp-includes/wp-db.php:1564
Stack trace:
#0 [site]public_html/[site]/wp-includes/wp-db.php(592): wpdb->db_connect()
#1 [site]public_html/[site]/wp-includes/load.php(409): wpdb->__construct('...', '...', '...', '...')
#2 [site]public_html/[site]/wp-settings.php(106): require_wp_db()
#3 [site]public_html/[site]/wp-config.php(91): require_once('[site]...')
#4 [site]public_html/[site]/wp-load.php(37): require_once('[site]...')
#5 [site]public_html/[site]/wp-blog-header.php(13): require_once('[site]...')
#6 [site]public_html/[site]/index.php(17): require('[site]...')
#7 {main}
  thrown in [site]public_html/[site]/wp-includes/wp-db.php on line 1564

So mysql_connect() is broken. Why?

Well, that might be because that function was already deprecated in PHP 5.5 and removed in PHP 7.0.

This extension was deprecated in PHP 5.5.0, and it was removed in PHP 7.0.0. Instead, the MySQLi or PDO_MySQL extension should be used. See also MySQL: choosing an API guide.


I tested PHP 7.2 as well, and to my surprise it worked. I didn’t think it should, though… The PHP team already removed the command in version 7.0! But comparing the default configuration for the PHP extensions revealed the issue:

For PHP 7.2, the default extensions are different. My guess is that for whatever reasons, 7.3 didn’t have the module overwriting the deprecated and removed function available by default whereas 7.2 did.

Since the PHP extension configuration varies by host and server, you could encounter the same 500 error after any PHP update (more or less). I’m fairly certain, that at least updates from PHP 5 to PHP 7.1, PHP 7.2 or 7.3 could cause this issue on a lot of different hosting companies.

How to get WordPress to work with PHP 7?

If you still want to continue using your WordPress installation (I mean, you could take this as a sign, right?) you should be able to do that. After comparison, I narrowed the missing extension down to nd_mysqli.

Just navigate to your web hosting panel and enable the module called nd_mysqli. There’s a fair chance your extension name could be different, though – web hosting providers are different.

Enabling the extension nd_mysqli to get mysql_connect() to work.
Enabling the extension nd_mysqli to get mysql_connect() to work.

After this, your site should load just fine again! Fixed the issue for me at the very least.

And if you’re in luck, you’ll see performance gains from the upgrade – at the very least, you’ll be more secure in the future.

The exact configuration of different extensions is of course different for different hosting providers. You might not need to take these steps at all, or the extension might be named differently. But I thought documenting them is useful anyway! :)

Antti K. Koskela

Antti Koskela is a proud digital native nomadic millenial full stack developer (is that enough funny buzzwords? That's definitely enough funny buzzwords!), who works as a Solutions Architect for Valo Intranet, the product that will make you fall in love with your intranet. Working with the global partner network, he's responsible for the success of Valo deployments happening all around the world.

He's been a developer from 2004 (starting with PHP and Java), and he's been bending and twisting SharePoint into different shapes since MOSS. Nowadays he's not only working on SharePoint, but also on .NET projects, Azure, Office 365 and a lot of other stuff.

This is his personal professional (e.g. professional, but definitely personal) blog.

Leave a Reply

12 Comment threads
10 Thread replies
Most reacted comment
Hottest comment thread
11 Comment authors
MilanJeremyAnaTonyAnugrah Andisetiawan Recent comment authors
newest oldest most voted
Notify of

And Ive bookmarked your site! Cheers again :)


Thanks! It worked, and if I hadn’t updated now they’d have been on PHP 8 by the time I thought of it again!


Thanks you very much for this! Much appreciated!
Got a 500 error thrown when switching to PHP 7.3 and didn’t honestly know what to do. This fixed the it :)
Thanks again!


I very rarely comment on posts, but you, Antti are a genius. I am upgraded my client sites and got the darn error, instead of spending hours trying to sort it out, I found your blog post. You are a legend and an absolute lifesaver.

Thanks again!

Neil Broadley

Thanks for this. I used cPanel to choose PHP 7.3 and sure enough, it instantly broke my three sites. A quick google found your post here. Very much appreciated that you took the time to a) research the issue and b) post your findings. Thanks again.


Thanks for sharing this.

Anugrah Andisetiawan

MANY THANKS! :D Got my headache why my WordPress suddenly Error 500 after set my PHP version from 5.6 to 7.3 directly. Seems that unchecked nd_mysqli is the default setting. After I checked and click “use current” in my cPanel webhosting, it work normally. :)


[…] “500 Internal Server Error” after updating a WordPress site to PHP 7.3, tersedia daring di https://www.koskila.net/500-internal-server-error-after-switching-a-wordpress-site-to-php-7-3/ […]


Great! Fixed my issue, many thanks! :)


OMG! Just lost 2 days trying to figure out why i was getting the http 500 error and it was only necessary to check an option! You really helped me :) Thank you so much!


Very helpful! This saved the day for me too. Much appreciated. I went ahead and enabled nd_PDO_mysql in addition to nd_mysqli. Any thoughts as to if that has any ramifications? My site appears to function without nd_PDO_mysql enabled but some other places say to check both boxes so I did.


You’re fantastic!

Thank you for this!