Upgrading PHP 7.2.x > 7.3.x

Hi Craig,

I’ve upgraded my M 2.3.2 to the newer 2.3.3

From what I can see the new version supports PHP 7.3.x (it was tested with PHP 7.3.8)
I looked at benchmarks and the new 7.3 version should be faster than 7.2

I have then question how to upgrade the PHP.

My Environment

  • Digital ocean
  • 18.04 Ubuntu
  • M2.3.3

Initially I installed my php following your tutorial running the following commands:

sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php7.2 libapache2-mod-php7.2 php7.2-mysql php7.2-soap php7.2-bcmath php7.2-xml php7.2-mbstring php7.2-gd php7.2-common php7.2-cli php7.2-curl php7.2-intl php7.2-zip zip unzip -y

I found an article indicating that I could upgrade my php running these commands.

sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt install php7.3  

The commands look similar except that you specified php modules. Can you please let me know how to update the php?

Thank you.

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.

1 Like

Hi Craig,

Fair comment. I will leave it then.
Or familirise it with the proccess on my Mag on localhost.