PHP upgrade

Upgrade PHP.
Before your host forces it.

Security support for PHP 8.2 ends on 31 December 2026, and older versions are already unsupported. I review your code, adapt it to a current PHP version and fix the errors that appear after a switch.

Discuss a PHP upgrade

Stefan Pilz · over 15 years of PHP development · 100% remote

IllustrationKeep the existing code, renew the runtime.

SERVICE OVERVIEW

Why a PHP upgrade is due now

A PHP upgrade means adapting your website or application so that it runs without errors on a current PHP version. I review the existing code and libraries, fix incompatibilities and test the key workflows before the new version goes live.

Once a PHP version no longer receives security updates, newly discovered vulnerabilities stay open. Sooner or later, hosting providers switch such versions or only offer continued operation for an extra fee. If the code does not run on the new version, the website shows error messages or simply goes blank.

It is better to plan the upgrade yourself: in a staging environment, with time to track down errors and without the pressure of a fixed switch-over date.

Your contact: Stefan Pilz · Stefan Pilz Ltd. · Collaboration is 100% remote

SERVICE SCOPE

What a PHP upgrade involves

Check compatibility

Static analysis shows me the places in the code that no longer work with the target version or are marked as deprecated. The dependencies come next: Composer packages, frameworks, CMS extensions and PHP extensions on the server. You receive a list of all affected places and an estimate of the effort.

Adapt the code

The older the starting version, the more there is to do. The old MySQL extension has been gone since PHP 7, and each() and create_function() were removed in PHP 8. Since PHP 8.1 and 8.2, passing null where a string is expected and creating dynamic properties, among other things, trigger warnings that will become errors in future versions. I fix these places properly instead of just hiding the messages.

Dependencies and server

Libraries are updated to versions that support the target PHP version. I replace unmaintained packages with alternatives. On the server I check extensions and settings so that nothing is missing after the switch, for example for sending email, image processing or encryption.

TYPICAL ERROR MESSAGES

Errors that appear after a PHP upgrade

I see these messages frequently in outdated code. If one of them appears on your site, the code is not compatible with the new PHP version.

Call to undefined function mysql_connect()

The old MySQL extension has not existed since PHP 7. Database access has to be moved to mysqli or PDO, ideally with prepared statements, which also protect against SQL injection.

Call to undefined function each()

each() and create_function() were removed in PHP 8. Older libraries, templates and CMS extensions are often affected. These places can usually be replaced with foreach and anonymous functions.

count(): Argument #1 ($value) must be of type Countable|array

Since PHP 8, calling count() on null or a scalar value causes an error instead of a warning. The code relied on behaviour that PHP no longer tolerates.

Creation of dynamic property … is deprecated

Since PHP 8.2, assigning a property that is not declared in the class triggers a warning. It still works but will become an error in a future version.

Passing null to parameter #1 … of type string is deprecated

Since PHP 8.1, PHP warns when built-in functions such as strlen() or trim() receive null. These messages often flood the log files.

Blank page or 500 Internal Server Error

The page shows nothing or only a generic error page because error messages are hidden on the live system. The actual cause is in the server's error log, and that is where I start.

RELEVANT EXPERIENCE

A concrete upgrade from PHP 5.6 to PHP 8.4.

For a custom-built website, I adapted the existing PHP code to a new runtime. The anonymised project shows that an in-place upgrade can be possible; we assess the effort for your application separately.

Anonymised client project · Starting point

PHP 5.6 without a framework

A website that had grown over time, with many individual PHP files, needed to stay in operation. The existing functionality and code were the starting point.

Same project · Result

The existing application runs on PHP 8.4

The code was adapted and preserved. No complete rewrite was required for this project. Whether this approach suits your application is something we clarify in a review.

DELIVERABLES & SCOPE

Your result and possible limitations

Your agreed deliverables

We agree the deliverables before starting. Depending on the scope, these may include:

  • Compatibility report listing all affected places with an effort estimate
  • Adapted code that runs on the agreed PHP version without errors or warnings
  • Updated or replaced dependencies
  • Tests of the key workflows before the switch and an agreed way back

What we clarify beforehand

If parts of the application come from third parties and no compatible version exists, they have to be replaced or adapted. That can increase the effort. Without access to the source code, for example with encrypted extensions, adaptation is not possible.

Effort and costs

For an initial assessment, details of the current PHP version, the system in use and any deadline from your hosting provider help. We agree the scope of the review and the implementation beforehand.

WORKING TOGETHER

How a PHP upgrade works

Review the codebase

I get access to the code and record the PHP version, dependencies and the key workflows of your website.

Set up staging

A copy of the website runs on the new PHP version, separate from live operation. Errors show up there without visitors noticing.

Adapt and test

I fix the places found and test forms, login, orders and other important functions.

Switch over

We switch the live website at an agreed time. A backup and the way back to the old version are prepared.

RELATED SERVICES

Often goes hand in hand

Symfony upgrade

Move from older releases via the LTS versions to Symfony 7.4 or 8.

QUESTIONS & ANSWERS

Questions about PHP upgrades

Can't I just change the PHP version in my hosting panel?

With many hosts that takes one click, and sometimes everything works afterwards. But you only find out whether your code is compatible after switching. It is safer to test the new version in a staging environment first. If you have already switched and errors appear, the version can usually be reverted temporarily.

Which version should I choose: PHP 8.4 or 8.5?

PHP 8.5 receives security updates for longer, until the end of 2029. PHP 8.4 is currently supported by more libraries and extensions. The right choice depends on what your dependencies support. We clarify that in the review.

What happens to WordPress, Joomla or shop extensions?

Maintained extensions usually have compatible versions. Extensions that are no longer developed are the critical ones. They can be adapted, replaced with an alternative or removed if they are no longer needed.

Does the website stay online during the upgrade?

Yes. The adaptation happens in a staging environment. Only the actual switch affects the live website, and it is usually brief.

Is an upgrade worthwhile, or should I have the site rebuilt?

In many cases an upgrade costs less than a rebuild, even with very old code, as the project from PHP 5.6 to 8.4 shows. If the code is so tangled that every change creates new problems, I will tell you openly and we compare both options.

NEXT STEP

Which PHP version are you running?

Tell me the current PHP version, the system in use and, if applicable, the deadline set by your hosting provider. I will get back to you with an initial assessment.

Your enquiry goes directly to me, Stefan Pilz. We agree the scope and costs before you commission any work.

What happens next

  1. Clarify the situation

    I read your enquiry and get back to you. Together, we clarify your goals, constraints and open questions.

  2. Choose a practical starting point

    Depending on the project, we start with a specific implementation or an analysis agreed in advance.

  3. Agree on scope and a proposal

    You know which services and deliverables are included. We agree on scope, effort and costs before you commission the work.

Request a PHP upgrade

* Required fields. A short description is enough.

I will reply to this address.

Which PHP version do you use? Is it a custom application, a CMS or an online shop? Are there already error messages or a deadline from your host?

This helps me get an initial impression.

Your information is used to process your enquiry. See the privacy policy for details. Please do not send login credentials or sensitive documents.

Sending an enquiry does not place an order.