After many hours of searching the net, and forums to upgrade to PHP 7.1 on Debian Jessie (8) while using virtualmin, i thought i’d post an easy how to that works with Virtualmin 6.03.gpl and Webmin 1.881… which is all in one place and lets you choose PHP versions for each Vhost.
i have done this on 3 different production systems after first testing them on clones, and i can confirm this works perfectly if you’re using FCGId.
Follow this step by step (please backup your server/servers first! i cannot be held responsible if things go wrong!)
Update and upgrade OS using APT:
- apt-get update && apt-get upgrade
Install Sury Repository for PHP7.1:
apt-get install apt-transport-https lsb-release ca-certificate
wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
echo “deb https://packages.sury.org/php/ $(lsb_release -sc) main” > /etc/apt/sources.list.d/php.list
Update APT, and install PHP7.1:
apt-get install php7.1 php7.1-mysql php7.1-cgi
Update Virtualmin Config:
- Login to virtualmin > System settings > Re-check configuration
Update Vhost with new PHP version:
- choose vhost > Server Configuration > PHP versions. select PHP 7.1 next to “default HTML directory”, click “save versions”
At this point, your site should be working with PHP 7.1. Your php.ini file will now be located in /etc/php/7.1/cgi/php.ini
If you need to install PHP modules such as cURL etc, you can do this using:
- apt-get install php7.1-*
I have read about issues where sometimes after doing this, you will see an error 500. i have found that many people have not installed “apt-get install php7.1-cgi” .this needs to be there to avoid this issue. generally, you will find within /home/site/fcgi-bin/php7.1.fcgi that it does specify “exec /usr/bin/php-cgi7.1”. so without php7.1-cgi package, you will see error 500’s.
If for any reason you cannot get this to work, you can revert to PHP 5.6 by:
Revert Vhost to older PHP 5 version
- choose vhost > Server Configuration > PHP versions
- select PHP 5.6 next to “default HTML directory”
- click “save versions”