[SOLVED]How to upgrade Virtualmin PHP7 to PHP7.1/7.2/7.3 on Ubuntu

3 posts / 0 new
Last post
#1 Thu, 12/20/2018 - 12:34
afdhaal

[SOLVED]How to upgrade Virtualmin PHP7 to PHP7.1/7.2/7.3 on Ubuntu

Howdy,

I'm using Virtualmin for the past 3 years. Recently I noticed some of my web applications requesting to change the PHP version to 7.1.

VERSIONS

ubuntu14.04
Webmin 1.900
Current PHP version: 7.0.3

PROBLEM

I installed PHP 7.1/7.2/7.3 following this tutorial (https://www.virtualmin.com/documentation/web/multiplephp).
Eg: codes to install PHP7.1 :

sudo apt-get install php7.1 php7.1-cli php7.1-common php7.1-json php7.1-opcache
php7.1-mysql php7.1-mbstring php7.1-mcrypt php7.1-zip php7.1-fpm

Results of clicking "System Settings -> Re-Check Config" as follows

The following PHP versions are available : 5.5.9 (/usr/bin/php5-cgi), 5.6.39 (/usr/bin/php-cgi5.6),
7.0.33 (/usr/bin/php-cgi7.0), 7.1.25 (/usr/bin/php7.1), 7.2.13 (/usr/bin/php7.2),
7.3.0 (/usr/bin/php7.3), 5.5 (mod_php)

I created a subdomain and created index.php file with phpinfo

<?php
 phpinfo();
?>

Phpinfo works fine with PHP 5.6 and PHP 7.0.3. But when I change it to PHP 7.1 or above from "Server config -> PHP version", it shows 500 internal server error.

APACHE ERROR LOG

With Maximum PHP script runtime: 30 Seconds

  1. With FCGId:
[fcgid:warn] [pid 16450] (104)Connection reset by peer: [client ***.***.**.**:2875]
mod_fcgid: error reading data from FastCGI server
[core:error] [pid 16895] [client ***.***.**.**:2876] 
End of script output before headers: index.php
  1. With CGI:
[cgi:error] [pid 15079] [client ***.***.**.**:2873] 
End of script output before headers: php7.1.cgi

I would really appreciate if someone helps me out to figure out my mistake.

Thank you. Regards

Thu, 12/20/2018 - 15:29
noisemarine

I don't use Virtualmin's PHP version management so proceed carefully and be prepared to back track if necessary...

I edit each www.conf and change it to listen on a port. For example:

/etc/php/5.6/fpm/pool.d/www.conf
/etc/php/7.0/fpm/pool.d/www.conf
/etc/php/7.1/fpm/pool.d/www.conf
/etc/php/7.2/fpm/pool.d/www.conf
/etc/php/7.3/fpm/pool.d/www.conf

Change the listen statement as appropriate. Use a port that fits in with whatever 5.6 and 7.0 are using (should be different ports).

;listen = /run/php/php7.3-fpm.sock
listen = localhost:8073

Restart phpX.X-fpm services.

Your apache/nginx config file for each site should reference the appropriate port for the PHP version you want to use.

Thu, 12/20/2018 - 22:40
afdhaal

Thank you very much for looking at the post and spending your valuable time, noisemarine. I really appreciate it.

Once again I tried to troubleshoot the problem and found out the fault. I didn't install phpX.X-cgi. That caused the problem. Now it just works fine.

If anyone is looking for upgrading to PHP 7.1/7.2/7.2 these steps might help you.

Installing PHP 7.1/7.2 on Ubuntu 14.04

Install the PPA:
add-apt-repository ppa:ondrej/php && apt-get update

Install the PHP packages
apt-get install php7.1 php7.1-mysql php7.1-cgi php7.1-cli php7.1-fpm
apt-get install php7.2 php7.2-mysql php7.2-cgi php7.2-cli php7.2-fpm

Click System Settings -> Re-Check Config. You might see something like

The following PHP versions are available : .... 7.0.33 (/usr/bin/php-cgi7.0),
7.1.25 (/usr/bin/php7.1), 7.2.13 (/usr/bin/php7.2) ...

.
Configure the PHP version being used for a specific Virtual Server by selecting Server Configuration -> PHP Versions.

Read this to expand your knowledge about what you are doing

  1. PHP CGI: Common Gateway Interface: another way of running PHP (as opposed to an Apache module).
  2. PHP CLI: Command Line Interface: As the name implies, this is a way of using PHP in the system command line.
  3. PHP FPM: FastCGI Process Manager: is an alternative PHP FastCGI implementation with some additional features.
  4. PHP mysql: Connect to and manipulate MySQL databases.
  5. Personal Package Archives ('PPAs'): are provided by the community. "ppa:ondrej/php" helps to install several versions of PHP.

Please point out any mistakes in feel free to suggest improvements.

Thank you
Regards

Topic locked