A guide for businesses
Upgrading an old PHP application: where to start
Your hosting provider is ending support for an old PHP version, but changing the setting breaks the application. Or the business has postponed an upgrade for years because nobody knows what it will affect. Before switching the server, review compatibility, prepare code and library changes, and test the workflows the business relies on.
By Michał Drab ·
What actually needs upgrading
PHP is the server software that runs application code. Changing its version in a hosting panel does not change the application files or libraries. If they are compatible with the new version, switching may be enough. Otherwise, code changes need to come first.
For a business system, the upgrade should preserve the required rules for orders, documents and payments. A newer PHP version does not itself simplify screens or organize data. Those improvements can be planned separately after identifying the changes needed to run the application on a supported version.
What to establish before estimating the work
An initial assessment needs information about what works today and what the application depends on:
- The PHP version used by the website and by background jobs, such as a nightly order import. Their settings may differ.
- Availability of source code, documentation and startup instructions. Access to a user panel does not replace source code.
- The libraries, framework and additional PHP extensions used by the system.
- The database, uploaded files and connections to payment, invoicing, delivery or other applications.
- The workflows that must keep working, along with known bugs and limitations of the current version.
The assessment should produce a list of obstacles, a proposed target version and the scope of the first change. That provides a basis for estimating effort. The age of an application or its file count alone is not enough for a reliable estimate.
Why old code may not run on newer PHP
PHP releases change some behaviours and remove old features. For example, PHP 7.0 removed the mysql extension, and PHP 8.0 removed each() and create_function(). The PHP documentation also describes changes to comparisons and error handling. An application may start successfully yet handle certain data differently.
A library for generating documents, sending messages or connecting to another service may also block the upgrade. Its newer version may require application changes. If a library is no longer maintained, assess whether it can be replaced and verify the output of its replacement.
Projects using Composer can check the PHP and extension requirements of installed packages. The check-platform-reqs documentation describes this check. Meeting those requirements is one part of verification. It does not confirm that the whole business workflow behaves correctly.
How to choose the target version
Use the current list of supported PHP versions as a reference. Consider how much support time remains for a branch. Moving to a version close to its end of support may leave the business facing another upgrade soon.
Compare that with library requirements, extension availability and server capabilities. When versions are far apart, changes can be prepared in stages in a test environment. Intermediate versions may help identify problems, while the goal remains to run the application on a supported version.
What to test before changing the live server
Use a separate test environment with the target PHP version, required extensions and settings that match the planned deployment. Test data should cover real working cases while respecting confidentiality. Isolate messages, payments and requests to external services from real operations.
Check a complete workflow: receive data, calculate values, save records, generate a document and pass information to the next application. Include scheduled jobs, older records, missing values and different permissions. If automated tests exist, they should cover the changed area and its dependencies.
Illustrative example: the order form works after the upgrade, but the nightly import uses a different PHP version or an old library. Some orders are missing the next morning. A login test will not reveal that problem. The import, its output and its error reporting need to be checked.
Before deployment, record which workflows were checked, what the expected results were and which questions remain unresolved. This helps the business assess whether it is ready to switch.
How to plan deployment and recovery
The plan should specify when the change happens, who confirms key functions work and which errors require it to be rolled back. Back up files and the database, and verify that they can be restored. Agree on any downtime and pausing of background jobs with the business.
Reverting the PHP version may not be enough if code, libraries or the database structure have changed too. Account for orders and documents saved after the switch. Restoring an older database backup without an agreed way to handle new records can lose those records.
After deployment, check integrations, scheduled jobs and error logging. Some problems only appear with a particular import or document type. The observation period should cover that working cycle.
Upgrade the application or rebuild part of it?
If the application still meets business needs, first assess updating its code and libraries while preserving existing rules. A PHP upgrade does not inherently require a new interface or a complete rewrite.
Rebuilding a module may be justified when it is tightly coupled to an abandoned library or when its behaviour needs to change anyway. Compare that scope with adapting the current code. Combining a PHP upgrade with many new features makes it harder to establish the cause of a problem.
What to prepare for a first conversation
Describe what the application does, which PHP version it uses and what prompted the upgrade. Add whether source code and the previous developer are available, which systems are connected and which workflows cannot wait. If you do not know the PHP version, name the hosting provider and describe the situation.
With an existing system, I start by assessing the code, data, documentation and integrations. This establishes what blocks the upgrade and whether adapting the application is enough or a larger rebuild is needed. Do not send passwords, keys or customer data in the first message.
Questions about upgrading a PHP application
Is changing the PHP version in the hosting panel enough?
Only if the application, its libraries and required extensions are compatible with the target version. Check that away from the live system first, including background jobs and integrations.
Does an old PHP application need a complete rewrite?
Its age or PHP version alone does not establish that. First assess the code and dependencies. Sometimes updating them is enough, and sometimes replacing a particular module is justified.
How much does upgrading an old PHP application cost, and how long does it take?
Each project is estimated individually. Scope depends on the differences between versions, library condition, integrations and the ability to test key workflows. The application and upgrade obstacles need to be assessed first.
Can the upgrade happen without downtime?
That depends on the application, database and deployment process. An assessment establishes the switch, any maintenance window and the recovery approach. Some systems require a service interruption.