Plannedscape Postings


PHP 7.4 End Of Life
What's Gained, What's Lost, What To Know

Posted by Charlie Recksieck on 2022-10-27
For anybody with PHP code, there's an interesting date looming soon: November 22, 2022. That's the announced end-of-life date for PHP version 7.4.
In general, you never want to be caught napping by falling behind major software releases. Today we'll discuss PHP but if this gets you thinking about being diligent, Google end of life dates for all of your major platforms, languages, app versions, operating system and even your hardware.

Importance Of PHP

More major sites than you might guess are powered by PHP: Wikipedia, Yahoo, Facebook, MailChimp.

Even if you don't have a website and work in PHP code itself, this still can affect you.

WordPress is built on PHP. Chances are that you don't work in native WordPress, you have bought or downloaded WordPress themes, templates and/or plug-ins. There's a chance that some of them have some PHP code in them that might break once you are upgraded to PHP 8.

What Does End Of Life Mean In General

In software, end of life "is the stage of a product in which it becomes outdated or unsupported by the manufacturer." More technically, it means that the makers of a product no longer work on it or officially support it.

End of life warnings traditionally are given with a lot of advance notice, at least from reputable software companies. If you push your use of software (or hardware) past the end of life date and something goes wrong, when you call for support then the message back is usually, "Tough luck, you need to upgrade."

What's Gained In PHP 8

Just In Time (JIT) compilers have been in place in PHP since version 7.4, but it's even improved now. You might notice faster page loading speeds on pages that previously were a little slow.

There are some nifty new string handling PHP 8. Improved string-within-a-string and starts/ends with functions. And it anticipates and accepts unexpected variable types much better, e.g. when string procedures are fed an integer.

Attribute metadata is a nice touch.

What Might Break If You Move To PHP 8

If you stuck with version 5.4 or earlier versions of PHP and have dynamic MySql code in PHP to interact with a MySQL database (a classic "LAMP" configuration), then after upgrading to a later PHP version you found that the mysql_ code broke. Mysql itself hit end of life and commands needed to be upgrade to the more modern "mysqli" code. We've got an article here on this issue and can always help migrating mysql code to mysqli here - let us know if you've got that issue still.

In all honesty, if you've been on some 7.x version of PHP, then upgrading to PHP 8 probably won't break your code. Don't let that mean that you're off the hook. You need to test.

Don't Put It Off

If you can, test it today. First, make sure it's easy enough to rollback to your current PHP version after a test. Then, try to upgrade your PHP version either in a staging are (not on your live website) or on your whole site but after hours or weekend or whenever you have less traffic. Give it a shot and see what's broken or different on your website.

Additionally, we want to point you to a page of some resources for code analyzers that can evaluate your site for potential problems.

Other reading:
- from Dev Mio.
- at