I will install PHP directly from Debian PHP Package maintainers site https://packages.sury.org/php/ with apt-get. This will not overwrite the existing installation but will change the default used PHP version to the newest installed one! So it is very important to add a new PHP version for the installed version to ISPConfig and change all sites to this version first. If you are using cron jobs calling PHP scripts you have to adapt them too, later more on that.
Please note that PHP-FPM can be used on both Apache and Nginx servers while FastCGI is available for Apache servers only.
1. Enable PHP versions in ISPConfig
In ISPConfig 3, you can configure the new PHP versions under System > Additional PHP Versions.
Add Debian’s PHP version
First of all you have to add a new version for the already installed PHP version. On the Name tab, you just fill in a name for the PHP version (e.g. Debian 7.3) – this PHP version will be listed under this name in the website settings in ISPConfig:
Go to the FastCGI Settings tab and fill out the fields as follows:
Path to the PHP FastCGI binary:
Path to the php.ini directory:
Then go to the PHP-FPM Settings tab and fill out the fields as follows:
Path to the PHP-FPM init script:
Path to the php.ini directory:
Path to the PHP-FPM pool directory:
Important step for cron jobs
If you use cron jobs calling PHP scripts you also have to tell cron which version to use. Add php7.3 in the beginning of the command to use the Debian’s version. If you are not sure what you exactly are using follow the symlink /usr/bin/php and use its final destination as prefix.
3. Change PHP version of websites
You can skip this step if you do not have a Debian version of PHP installed.
Now change the PHP version of all websites to the newly created version.
And do not forget to change the cron jobs as mentioned above.
4. Add the repository at packages.sury.org
To add the repository at packages.sury.org and its BGP keys to apt use these commands:
apt-get install -y apt-transport-https lsb-release ca-certificates
wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
The next command is just one line, don’t add any line breaks:
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list
To upgrade already installed packages from the new repository use this command:
5. Install PHP from packages.sury.org
I am offering here multiple options to install, please pick the desired versions and simply skip the rest!
5.1. Install PHP 7.3
To install PHP use this command:
apt-get install php7.3 php7.3-cli php7.3-cgi php7.3-fpm php7.3-gd php7.3-mysql php7.3-imap php7.3-curl php7.3-intl php7.3-pspell php7.3-recode php7.3-sqlite3 php7.3-tidy php7.3-xmlrpc php7.3-xsl php7.3-zip php7.3-mbstring php7.3-soap php7.3-opcache php7.3-common php7.3-json php7.3-readline php7.3-xml
6. Set Debian default PHP back to the original version
The default PHP of the operating system has to remain at the original version. To fix that, run these commands:
update-alternatives --config php
update-alternatives --config php-cgi
7. Restart FPM daemon
10 Restart FPM daemon
service php7.3-fpm restart