Upgrading PHP Applications to the Latest Versions of PHP

When hosting providers tell you to upgrade, but your developers say it's not possible, what do you do?

Image for blog post Upgrading PHP Applications to the Latest Versions of PHP

 

This is a problem that we often see here at Cowshed Works. A business owner telephones and says something like

"We have a custom PHP application that was developed in 2007. It's currently on PHP 5.6 but our hosting provider are now charging us to support this version, the developer who built it has now left and the code won't run on PHP 7 so we can't upgrade, what do we do?"

For some businesses this can be a real problem, the application might be delivering consistent sales leads from good Google search rankings or it might be handling some internal admin process that would be problematic to disrupt. Whatever the application is doing it can be worrying to think that at some point the hosting provider might refuse to support the PHP version and simply power off the server, taking your business application down with it.

Why won't the application run on a newer PHP version?

This isn't a straight-forward question to answer as the reasons can vary. The main recent transition has been migrating applications from the now unsupported PHP 5.6 to a version of PHP 7. Some applications, especially those that are more straight-forward or don't interact with a database, have been able to upgrade with very little effort, the code executes on PHP 7 as it did on PHP 5 (only a LOT faster!). But some applications that are using features that have either had breaking changes, or worse, are now removed from the language, cannot simply copy and paste upgrade as some (or all) parts of the application need work to make them work with the new language features.

A good example of this is the MySQL API. The API was long considered insecure and it was made worse by a decade of poorly written tutorials on the web and in programming books showing people how to connect to MySQL via PHP to make interactive web applications. This led to lots of insecure code, and if you've ever heard of PHP sites being hacked this was very likely to have been the thing that was exploited by the hackers. As a result this entire API was deprecated in PHP 5.5.0 (it was marked as being destined for removal in the future). PHP 7 was the version where the API was actually removed. The problem is that a huge number of applications built in PHP were using the API and if you were to upgrade your PHP version these apps would simply throw errors all over the place.

There are a range of other changes to the language that could affect applications in unexpected ways. It takes a good level of knowledge of PHP and what's changed to understand where to look for these issues in applications. So, unless you're the developer who created the application or you know exactly what you're looking for and how to fix the issues, you're a bit stuck in upgrading your PHP application. 

What do you do to upgrade the application?

You have a few options here.

You can either find a developer or company who can manage the migration for you, updating the source code and managing any database changes and configuration of the new hosting environment.

Or you can get the application re-written by a new PHP developer/development company and use the opporunity to add more features and iron out any issues that were present in it. 

We can probably help with that!

Whilst this makes this blog look like a sales pitch (which it clearly is) we're a company who have managed several upgrades of this type. We've migrated a website with 40,000 users off custom PHP source code (using the MySQL api) and on to modern frameworks running on the latest version of PHP 7. We've also patched applications that can't move from PHP 5.6 to 7 because of imcompatibilities. We've also re-written legacy applications on modern PHP standards adding testing and higher security standards along the way. Whatever the problem is with upgrading your PHP app, we've probably already seen and solved it.

If you're having a nightmare with upgrading your PHP application, it might be worth a call to us to discuss your options, even if we don't end up working together we're always happy to give advice.


Article Category Tags

Business PHP Web Development
PHP 8.4 - quick summary
PHP 8.4 - quick summary

PHP 8.4 - quick summary

Read more
The March 2024 Google Core Update
The March 2024 Google Core Update

The March 2024 Google Core Update

Read more
PHP 8.1 is out soon, what are the new features?
PHP 8.1 is out soon, what are the new features?

PHP 8.1 is out soon, what are the new features?

Read more
Google December 2020 Search Update - The Core Update Advice and Tips
Google December 2020 Search Update - The Core Update Advice and Tips

Google December 2020 Search Update - The Core Update Advice and Tips

Read more
PHP 8 is out soon, what are the new features and how easy is it to upgrade?
PHP 8 is out soon, what are the new features and how easy is it to upgrade?

PHP 8 is out soon, what are the new features and how easy is it to upgrade?

Read more
Migrating a PHP website with hundreds of thousands of urls and 17 years worth of data
Migrating a PHP website with hundreds of thousands of urls and 17 years worth of data

Migrating a PHP website with hundreds of thousands of urls and 17 years worth of data

Read more