sudo apt install software-properties-common -y
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:ondrej/php -y
sudo apt-get update
sudo apt-get install -y php7.3
Now install PHP-FPM 7.1 with all extensions needed.
sudo apt install php7.3-fpm php7.3-curl php7.3-cli php7.3-mysql php7.3-gd php7.3-xsl php7.3-json php7.3-intl php-pear php7.3-dev php7.3-common php7.3-mbstring php7.3-zip php7.3-soap php7.3-bcmath -y
After the installation is complete, check the PHP version and installed extensions using PHP commands.
php -v
php -me
Next, we will configure the php.ini file for the PHP-FPM and PHP-CLI.
Edit the php.ini files using nano
nano /etc/php/7.3/fpm/php.ini
nano
/etc/php/7.3/cli/php.ini
Change the value of those lines as below.
memory_limit = 512M max_execution_time = 180 zlib.output_compression = On
Save and exit.
or
sed -i "s/memory_limit = .*/memory_limit = 512M/"/etc/php/7.3/fpm/php.ini
sed -i "s/upload_max_filesize = .*/upload_max_filesize = 128M/"/etc/php/7.3/fpm/php.ini
sed -i "s/zlib.output_compression = .*/zlib.output_compression = on/"/etc/php/7.3/fpm/php.ini
sed -i "s/max_execution_time = .*/max_execution_time = 18000/"/etc/php/7.3/fpm/php.ini
sed -i "s/memory_limit = .*/memory_limit = 512M/"/etc/php/7.3/cli/php.ini
sed -i "s/upload_max_filesize = .*/upload_max_filesize = 128M/"/etc/php/7.3/cli/php.ini
sed -i "s/zlib.output_compression = .*/zlib.output_compression = on/"/etc/php/7.3/cli/php.ini
sed -i "s/max_execution_time = .*/max_execution_time = 18000/"/etc/php/7.3/cli/php.ini
update-alternatives –set php /usr/bin/php7.3