How to run old PHP applications

February 23, 2022

Lang: cs en de es

Development is moving forward rapidly. PHP eventually became a programming language that was used by many serious projects. And also due to the rapid development of the PHP language, projects that are maintenance-free have become so-called "legacy projects". A legacy project is a technologically obsolete project for which further maintenance and especially development is a problem. And over time, the operation of such legacy applications is also a problem. In this article, I will describe the possibilities of providing an environment for running legacy projects in the PHP programming language.

Technological shift

With the advent of PHP7 and PHP8, support for old versions of PHP has ended and has long been unavailable on Linux distributions. With the new version of PHP came many changes, but there are some projects that did not reflect this shift. The owners of these projects are wondering where and how to run the old projects?.

Video operation of old PHP applications

You can also listen to a summary of the article content in the video:

Does it make sense to program in PHP?

In the beginning, some people may wonder if it makes sense to program in PHP. Does it make sense to program in PHP?:

Old PHP

First of all, it must be said that running old applications with old PHP is a fallback option because it is inefficient in terms of security, maintenance cost. And if the application in question were to be developed further, it's often unsustainable, both in terms of getting someone and paying for that heavy maintenance. Plus, there will be more problems with running and modifying the old application.

It depends on how much old PHP you need. Getting PHP older than version 5.6 up and running will be a very big problem on current servers.

Operating PHP5.6

If you have a matching linux admin, he will be able to set up your server with the current OS and versions PHP 5.6, 7.0 to 7.4 and 8.0 or 8.1 (January 2022). There are many ways to get this working, just please skip the actual compilation! Personally, I prefer to use the Debian distribution on the server to install PHP from the sury repositories. and run PHP on FPM. This is mainly because you can run a webserver with multiple versions of PHP on the server at the same time and easily update PHP.

You can see how to get old PHP versions working in this video tutorial, where I describe how to run different versions of PHP, whether newer or older than your Linux distribution provides.

ISP Config and old PHP versions

If you use the ISP Config tool on your web host's report, then adding other versions of PHP is similar. And using ISP Config itself, you can switch PHP versions and set up transient PHP versions for individual projects.
I recommend ISP Config for users, who want a user-friendly tool for setting up their own hosting.

Video tutorial for setting up other PHP versions in ISP Config

Prehistoric PHP

VPS

Installing and compiling PHP older than 5.6 will be a problem on current Linux distributions. So the simplest solution is to reserve a separate VPS for these old projects and keep an old version of some Linux distribution there, with the required version of PHP.

Docker

An interesting option might be Docker, you can use it to run a lightweight Linux container with a given OS version and libraries. This offers the possibility to prepare a container with a specific old version of PHP and run a prehistoric application in this container. The container is isolated from the OS, so the security risk is reduced and no OS intervention is required. The OS can therefore be up to date, and so can other components of the application such as databases and others.

Application staging

Even if you have a new app, expect it to become obsolete at some point. Old technologies will not be supported at the same time and users will have new requirements for its operation and features. Sooner or later, you won't be left with, than to update and upgrade the application or, if you fall behind, to rewrite the whole thing - and that's a very difficult and risky process.
The only other option is that it will become more and more expensive to operate and maintain, so you're more likely to just shut it down.
For an outdated application, you'll also have a hard time finding a programmer let alone a quality one.

Unfortunately, I've seen quite a few projects where the application was allowed to become obsolete and then it always ended up that there was no motivation to invest in upgrading.

Moving Forward

You just have to be careful, and that goes for projects in other programming languages, to make sure that working on a project doesn't become riding a dead horse.

If you have a working business on an application, I recommend that you start as soon as possible contact the developer. Have them do at least a small analysis of what state the app is in and how they see the possibilities of upgrading and rewriting it.

Články na podobné téma

Python program to control Docker using the API
How to use MailCatcher to test emails
Python OpenAI API
Creating a WebSocket web application and setting up a proxy
Project management: agile software development
What a good programmer should know
Rust programming language
NodeJS: development, server configuration
Nette security bug CVE-2020-15227
REST API: platform API
Custom web and mail hosting with ISP Config software
Programming in SQL: PostgreSQL, MySQL/MariaDB
HTTPS: secure web
NoSQL database Mongo DB
Connecting to Microsoft SQL Server from Linux
What is the job description of a programmer
Python application localization
Which mail and web hosting to choose
Digispark - Program Atmel ATtiny microcontroller with Arduino IDE
Development for ARM processors with Arduino IDE
How to program the ESP8266 WiFi processor
Open smartphone with Linux - Openmoko Neo FreeRunner

Newsletter

If you are interested in receiving occasional news by email.
You can register by filling in your email news subscription.


+