Some applications do not yet support PHP 7.2. If you’re currently running applications that do not fully support PHP 7.2, you should probably downgrade to a supported version of PHP.
For instance, Ubuntu 18.04 doesn’t include PHP 7.1 packages by default. So, if you upgrade and attempt to run an application that doesn’t fully support PHP 7.2, you may run into issues.
The good thing about this is you can install PHP 7.1 along with PHP 7.2 and have multiple applications with different PHP needs.
If you can’t get PHP 7.1 packages on Ubuntu by default, you’ll want to add this third-party repository to your system. the repository contains multiple versions of PHP packages.
sudo add-apt-repository ppa:ondrej/php sudo apt-get update
After adding the repository, you can install PHP 7.1 and related modules.
sudo apt install php7.1 sudo apt install php7.1-cli php7.1-common php7.1-json php7.1-opcache php7.1-mysql php7.1-mbstring php7.1-mcrypt php7.1-zip
The main configuration file for PHP 7.1 with Apache2 support can be found at
sudo nano /etc/php/7.1/apache2/php.ini
The file above is where you configure PHP-related settings with Apache2 support. Some relaxed settings are:
file_uploads = On allow_url_fopen = On memory_limit = 256M upload_max_filesize = 64M max_execution_time = 30 display_errors = Off max_input_vars = 1500 date.timezone = America/Chicago
After making those changes save the file and exit.
If you don’t want to run PHP 7.2, run the commands below to disable it for Apache2.
sudo a2dismod php7.2
Then run the commands below to enable PHP 7.1 for Apache2 to use.
sudo a2enmod php7.1
Restart Apache2 for the changes to apply by running the commands below.
sudo systemctl restart apache2.service
That’s it! Now PHP 7.1 should be the default PHP processor.
If at the end I execute sudo apt-get remove php7.2 it does not break work of php 7.1?
No