(Howto) Debian 8.x Jessie upgrade to PHP7.1 without breaking Virtualmin

1 post / 0 new
#1 Thu, 07/26/2018 - 02:53

(Howto) Debian 8.x Jessie upgrade to PHP7.1 without breaking Virtualmin

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:

Update APT, and install PHP7.1:

  • apt-get update

  • 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"