I got a message from my webhosting company telling me that the support of PHP version 7.2 will end soon, so I need to update to a newer version.

The most logical would be to upgrade to the newest version, which at this moment is 7.4.

My question is, do I need to upgrade to 7.3 first and from there to 7.4. Or can I just simply upgrade to version 7.4 at once? The server is running on Ubuntu 18.04.03 LTC.

Thanks in advance!

  • FYI: Your server could be behind in security updates, as it should have reported 18.04.4, and you potentially haven't had upgrades installed since before 12-Feb-2020 (fridge.ubuntu.com/2020/02/12/ubuntu-18-04-4-lts-released). I'd check it's upgrade status (unless you listed the install ISO and not current version)
    – guiverc
    Jun 9, 2020 at 11:03

2 Answers 2


You can directly upgrade to PHP 7.4.

PHP versions are separately installed in different directories. Therefore you can also install 7.4 next to 7.2 (if you are running your web hosting yourself, that is).

There are however some compatibility issues between these versions, but in many cases, these do not pose a problem (in my experience). See also:
https://www.php.net/manual/en/migration73.incompatible.php https://www.php.net/manual/en/migration74.incompatible.php

I hope this answers your question. Otherwise, please let us know.

  • Thank you! So, what your saying is: I can install version 7.4 and test it. In case anything goes wrong I can always go back to version 7.2?
    – Joost
    Jun 9, 2020 at 8:16
  • If you my downgrade depends on your hosting provider. Ask them for those posibilities. But, in my experience, issues are rare with this type of upgrade. So i expect no problems with the upgrade.
    – Papagaai35
    Jun 9, 2020 at 9:34

A developer called Ondřej Surý maintains packages for PHP which include the latest minor versions - he is awesome.

You can install his repositories for PHP & Apache2:

sudo add-apt-repository ppa:ondrej/php
sudo add-apt-repository ppa:ondrej/apache2

Then update your repos & upgrade your packages:

sudo apt update
sudo apt upgrade

Finally, remove PHP7.2 from Apache & replace it with PHP7.4:

sudo a2dismod php7.2
sudo a2enmod php7.4

Note: you may need to install the 7.4 version of some PHP modules separately, but see how you go.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .