Upgrading PHP 7.2.x > 7.3.x

Important Notes (Read first)

  • These instructions assume that you setup your store using: How to install Magento 2.3 and build a web server
  • You don’t have to add the ppa:ondrej/php repository again
  • You don’t have to reinstall zip or unzip again
  • Before/After upgrading Magento, be sure to check the root .htaccess file to ensure your PHP 7 memory_limit is set to 2G. After a Magento update this value can reset to 756M, which affects site performance (and can result in Readiness Check Failure)
  • Installing PHP 7.3 should also automatically activate it too
  • Backup your Server (not Magento) before running these commands
  • These instructions install the latest version of 7.3.x. I don’t actually know at this stage how to install a specific patched version (e.g. 7.3.8)
  • Bare in mind, just because Magento now supports PHP 7.3.x, it doesn’t mean your 3rd party modules do!

Before going through these steps, my version of PHP was 7.2.13. The following set of commands should be ran as a superuser.

Tell Ubuntu to update its records from all of the connected repositories

sudo apt-get update

Install PHP 7.3.x and all of the subsequent PHP Modules

sudo apt-get install php7.3 libapache2-mod-php7.3 php7.3-mysql php7.3-soap php7.3-bcmath php7.3-xml php7.3-mbstring php7.3-gd php7.3-common php7.3-cli php7.3-curl php7.3-intl php7.3-zip -y

Restart Apache for all changes to take effect

sudo systemctl restart apache2

After running these steps, my version of PHP was 7.3.10.

3 Likes