Skip to main content

Old PHP Systems

PHP 5.x and 7.x systems with no framework are a security and maintenance burden. We modernise old PHP codebases incrementally and safely.

The Reality

PHP powers a vast share of the web, and that includes a long tail of applications built on PHP 5.x or early 7.x with no framework, no autoloading, no dependency management, and no separation between business logic, database queries, and HTML output. These are the systems where SQL queries are concatenated directly into strings, where authentication is a session variable set after checking a plaintext password, and where every page is a standalone script that includes a shared header and database connection file.

These systems are not the result of bad developers. They reflect the conventions of their era. PHP in the mid-2000s was learned from tutorials that taught exactly these patterns. The language itself encouraged mixing concerns; that was its selling point. Rapid development, easy deployment, cheap hosting. Many of these applications were remarkably effective at solving the business problems they were built for. The issue is that the web has changed around them. Security expectations are higher. PHP 5.6 reached end-of-life in 2018. PHP 7.x versions are falling out of support. Hosting providers are dropping older PHP versions. And the vulnerabilities baked into the coding patterns of that era (SQL injection, cross-site scripting, remote file inclusion) are now actively exploited at scale.

The Risks of Doing Nothing

  • Known, exploitable vulnerabilities. Unsupported PHP versions do not receive security patches. Your application is running on a platform with publicly documented vulnerabilities that will never be fixed.
  • Hosting availability shrinking. Providers are removing PHP 5.x support entirely. PHP 7.x support windows are closing. Finding a host that will run your application is becoming harder and more expensive.
  • Cannot hire for it. Modern PHP developers work with Composer, PSR standards, and frameworks. Asking them to maintain procedural spaghetti with no tests and no structure is a fast way to lose them.
  • Compliance failures. PCI DSS, GDPR technical measures, and Cyber Essentials all require software to be maintained and patched. Running unsupported PHP fails these requirements on its face.

How We Approach This

The approach depends on the size and complexity of the codebase. For smaller applications (a few dozen scripts), a clean rebuild on a modern PHP framework is often the most efficient path. We document the existing behaviour, build the replacement with tests, and run both in parallel until the new system is verified.

For larger systems, we use an incremental approach. The first step is typically getting the application running on a supported PHP version. This means fixing deprecation warnings, replacing removed functions, and updating database extensions (mysql_* to PDO, for example). This alone closes a significant number of security vulnerabilities and buys time for deeper work.

From there, we introduce structure gradually. Autoloading replaces include chains. Database queries move behind a data access layer. Input validation and output escaping are added systematically. Each change is isolated, tested, and deployed independently. The application continues to function throughout; there is no period where it is half-old and half-new in an unstable state. The common traps are well known: character encoding issues when moving to newer PHP, session handling changes, and the subtle behavioural differences between PHP versions that only surface in edge cases. For a broader view of how this fits into a longer-term programme, see our notes on legacy modernisation. The legacy systems overview covers how these problems typically develop across different technologies.

What You End Up With

  • Application running on a supported, patched PHP version
  • Security vulnerabilities from outdated patterns systematically eliminated
  • Codebase structure that modern developers can navigate and maintain
  • Automated tests covering critical business logic
  • A path to continued incremental improvement rather than another decade of stagnation

A Typical Engagement

Consider a candidate management system built in PHP 5 over several years with no framework, hundreds of PHP files, and SQL queries built by string concatenation throughout. We would upgrade it in stages to a PHP 8 release that still receives security fixes (the PHP supported versions page lists which ones do), fixing breaking changes and adding parameterised queries as we go, and run a security audit before and after to show what changed. Users see the same application. Underneath, the risk profile is very different.

How Much Time Have You Actually Got?

PHP is the one legacy platform where your deadline is published, precise, and trivially checkable. Every release has a fixed support window, and once it passes, security fixes stop.

Find out what version you are on before anything else. Ask whoever hosts it, or check phpinfo() if you have access. Then place yourself:

PHP 7.x or earlier. Security support ended years ago. Every vulnerability found since is unpatched on your system, permanently. If the application handles customer data or takes payment, this is not a modernisation question, it is a disclosure risk.

PHP 8.0 or 8.1. Past end of security support. You are accumulating unpatched issues.

PHP 8.2. Security support runs out at the end of 2026. Plan the move now, while it is cheap.

PHP 8.3 or later. You are current. Your problems, if any, are code quality rather than platform risk, and you have time.

The gap between versions matters as much as the version. Moving 8.2 → 8.3 is usually a weekend. Moving 5.6 → 8.3 is a project, because the language removed things in between.

What Breaks First

  1. Your hosting provider’s patience. Most hosts eventually force-upgrade PHP on shared platforms, and the site breaks on their schedule rather than yours.
  2. TLS and outbound calls to payment gateways and APIs that stop accepting old clients.
  3. Dependencies. Composer packages abandoned upstream, or requiring a PHP version you cannot run.
  4. Security, quietly and invisibly, from the day support ended.
  5. The code, last. PHP is fairly good at running old code, right up until it isn’t.

Check These Six Things This Week

  • What exact PHP version is it running? Down to the minor version.
  • What is that version’s end-of-security-support date? Write it in the calendar.
  • Has your host announced a forced PHP upgrade? Check the control-panel notices, not just email.
  • Is there a staging copy where an upgrade could be tested, or would you be upgrading live?
  • Is dependency management in use (a composer.json), or were libraries copied into the project by hand? The second is much harder to move.
  • Does the code use anything removed in PHP 8: mysql_* functions, each(), curly-brace string offsets? A grep will tell you in minutes how big the job is.

When You Genuinely Don’t Need To Act

If you are on a supported version, dependencies resolve, and there is a staging environment, then an older codebase that works is fine. Age is not the problem. Being on an unsupported version is. Plenty of unglamorous PHP applications earn their keep every day and need nothing from anyone.

The date on your version is the only deadline that matters here. Everything else is preference.

Your PHP System Can Be Fixed Without Starting Over

A full rewrite is rarely the most efficient path. Incremental modernisation preserves what works, addresses what is dangerous, and gives your team a codebase they can actually maintain. Related problems in other technology stacks follow similar patterns: see Classic ASP and Old WordPress Systems for those specific cases. If your PHP application is showing its age, talk to us about what a realistic path forward looks like.

Portrait of Alexander De Sousa, founder of Digital Royalty
Founder-led
“I’ve put everything I know into how this company works — the standards, the method, the care on every project. It runs through the whole team, and I hold us all to it.”

Alexander De Sousa · Founder LinkedIn

Featured on BBC Radio Solent

Get started

Tell us what you need

A few quick questions, then a straight answer from a real person — usually within a few hours.

What happens next

  1. 1 We reply A real person reads your answers and gets back to you, usually within a few hours.
  2. 2 Questions or a short call If anything isn't clear, we ask by email or book a short call. Before any call we audit your website and make the quick fixes it finds, free.
  3. 3 Your fixed quote A clear, fixed price in writing, within 48 hours of any call. There is no obligation to go ahead.

Tell us what you're working on

Whether it's a new site, a platform, or a process that shouldn't be manual any more — we'll tell you honestly if we can help.