PHP Velho Oeste 2024

Migrating from PHP 7.2.x to PHP 7.3.x

Table of Contents

This new minor version brings with it a number of new features and a few incompatibilities that should be tested for before switching PHP versions in production environments.

See also the migration guides for PHP versions 7.0.x, 7.1.x and 7.2.x.

add a note add a note

User Contributed Notes 1 note

ben at derrytech dot com
2 years ago
As part of increasing security, it is recommended to keep your version of PHP up to date. Here we have provided the steps to update the current version of PHP 7.2 to 7.3 in Ubuntu versions 14/16/18 / 19/20 without removing the old one. So that we can go back to the previous versions if there is something incompatible with the new one after changing.
    1. Login to the server via SSH as root.
       * If you don't know, it doesn't matter, use the sudo command (like me)
    2. Check your current version of PHP.
       $ php -v
PHP 7.2.36

    3. To install PHP 7.3, we must first add the repository:
       (Be careful here, (CAUTION) ... If you are in Ubuntu 19/20 version, it is not necessary to add repositories, it brings them by default. You can check the repositories with this command:

$ sudo apt-cache policy | grep http | awk '{print $ 2 $ 3}' | sort -u

If app / php or app / apache2 are not found, use this command:

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

    4. Then run an update:
$ sudo apt-get update

    5. After completing the update, we need to install PHP 7.3.
$ sudo apt install php7.3

    6. Then install the required PHP packages according to your current installation:
$ sudo apt install php7.3-common php7.3-cli php7.3-bz2 php7.3-curl php7.3-gd php7.3-intl php7.3-json php7.3-readline php7.3-xml php7 . 3-zip php7.3-fpm php7.3-bcmath php7.3-mbstring

      New commands are added for version 7.3 of Php. In the order they are written so as not to damage the modules.

Stop Apache Server
$ sudo systemctl stop apache2

Disable Php 7.2 Module
$ sudo a2dismod php7.2

Active Proxy Module fcgi
$ sudo a2enmod proxy_fcgi setenvif

Activate fpm module
$ sudo a2enmod php7.3-fpm

Activate Php 7.3 Module
$ sudo a2enmod php7.3

    7. Then restart Apache:
$ sudo systemctl start apache2
    8. Finally we check the Status of the Apache2 Server, turn off and turn on the server a couple of times. (All correct):

$ sudo systenctl status apache2

    9. The new version of PHP should be active now. You can check it from the command line:

$ php -v
PHP 7.3.28
To Top