1

I have a legacy PHP application running on:

HTTP   1.0
Apache 2.4.10
PHP    5.4.45
MySQL  5.5.42

I have an open source framework which the previous team have manually been writing changes into, so we can no longer rely on auto updates - I have to manually upgrade all the code myself.

The end goal should be PHP 7 / 8 (FPM?), I think nginx instead of apache, MySQL 8 and HTTP 2. I have also introduced git and composer as these were never used.

I have dockerised this setup, so we are now free to test out upgrades of different things.

How should I go about this?

1

The "right" way to update everything is from dependencies to the top, so the order should be :

  • HTTP/2 and Apache, upgrading Apache will allow you to use HTTP/2, PHP have (almost) nothing to do with it.
  • MySQL
  • PHP to 7.3
  • (optional) PHP to 7.4 AFTER PHP 7.3

Apache

Upgrading Apache will be the easiest part because there is not much dependencies between Apache and PHP. If you want to go to NGinx, i recommend to do it as the first step.

MySQL

Upgrading MySQL is a little bit trickier, depending of how much the PHP code rely on specific function. After this step, please test EVERYTHING and if needed, update queries in the code. If PHP is using an ORM, try update it first (only ORM) and this should work fine.

PHP

The last part and for sure the one you will suffer the most is upgrading PHP. I recommend you upgrading first to 7.2 or 7.3, test everything and update the code if needed. At this step you can upgrade PHP dependencies with composer.

When everything is now up to date, you can consider updating to 7.4 (there is a lot of changes between 7.3 and 7.4, this is why you should to it in 2 steps).

Updating to PHP 8 is a bit early now, so you can make the code warning and notice free to be ready to update when PHP 8 will have it's first release.

| improve this answer | |
  • Thanks this is really helpful! Especially 7.3 -7.4, I'd not heard about these issues. – userqwert Jul 22 at 13:25

Not the answer you're looking for? Browse other questions tagged or ask your own question.