Virtualmin + CentOS 7 + PHP7 the right way?

30 posts / 0 new
Last post
#1 Sun, 01/17/2016 - 07:22
cognosco

Virtualmin + CentOS 7 + PHP7 the right way?

Hello,

I did a couple of tries to get PHP7 working 100% correctly on VirtualMin, but I failed.
What are the official instructions (if they exist) to get Virtualmin working 100% correctly with CentOS and PHP7? I prefer the Software Collections way, (so you be able to switch!)
I tried lots of guides and tutorials, even older ones which are pre-virtualmin 5. Now Virtualmin 5 exists and it problably changed. I am looking for the best way, I hope someone can help! (Virtualmin + CentOS or Debian is no problem, just PHP7!)

What I tried:
CentOS7 minimal install. Yum update/upgrade. Reboot
Setup ssh.
Install Virtualmin.
Then
yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum install php70

Virtualmin detects PHP7 and I choose it as default. But Apache fails to start after installing and choosing PHP7.
Maybe this isn't the right way. I hope someone can tell me the best way.

Thanks in advance!

Sun, 01/17/2016 - 10:50
andreychek

Howdy,

I would actually try installing PHP 7 alongside your existing PHP version using the software collections repository.

I wouldn't recommend any third party repositories, as those can cause some trouble.

If you have trouble using the software collections repository, let us know the details of the issue you're seeing.

Also, there's details for using the software collections repo here:

https://www.virtualmin.com/documentation/web/multiplephp

Tue, 01/26/2016 - 03:34
cognosco

Thanks for your fast reply.
I tried it again and it's working now.

This is what I did:
I used Remi repo and PHP7 seems to work perfect. This is what I did (if someone sees something bad, just say because I am not an 100% sure if it is perfect, but here it works).


yum install scl-utils
yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum install php70
yum install php70-php-mysqlnd
yum install php70-php-curl
yum install php70-php-simplexml
yum install php70-php-devel php70-php-gd php70-php-json php70-php-mcrypt php70-php-mbstring php70-php-opcache php70-php-pear php70-php-pecl-apcu php70-php-pecl-geoip php70-php-pecl-imagick php70-php-pecl-json-post php70-php-pecl-memcache php70-php-pecl-xmldiff php70-php-pecl-zip php70-php-pspell php70-php-soap php70-php-tidy php70-php-xml php70-php-xmlrpc

With this you have PHP7 and all important extensions running next to the other PHP versions!
If anyone sees room for improvement, then I am very interested. Would be good information on this topic.
And I know it would be better to not use third party repos, but I could not find PHP7 for CentOS 7.2 then. Is it correct you only can get this with a third party (Remi) repo?
Also I hope it wasn't a bad choice to choose this repo.

Wed, 01/27/2016 - 12:09
tokar86a

So if i understand you right php70 works for you now when you run this commands?

Thu, 01/28/2016 - 01:58 (Reply to #4)
cognosco

Yes, after these commands it was installed properly and it's running very well!

I am really happy with VirtualMin (and PHP7).

Mon, 08/29/2016 - 21:23
Cloud4G

I installed PHP7 on Centos 7 with NGINX. Then installed Virtualmin/webmin pro. After some debugging everything appears to be working except use of PHP 7 as the default PHP version. I have PHP 5.4.16 and PHP 7 (as per latest update) installed. Virtual servers or sub-servers that are set up using (default) server template with highest PHP version selected results in the server(s) beinng setup using PHP 5.4.16 rather than PHP7. Attempts to select the PHP version using Server Configuration> PHP Versions results in the mentioned "Error
Website options cannot be edited, as no Apache virtual host for yourserver.com port 80 was found!" message.

I am considering uninstalling PHP 5.4.16 or, alternatively, upgrading that version to a later PHP 5 version that is compatible with PHPMyadmin, Joomla, and other application scripts that require higher than 5.4.

Advice on how to proceed to fix this impass would be appreciated.

Mon, 08/29/2016 - 21:53
Freddy63
Freddy63's picture

I got everything working on Ubuntu 16.04 with this, https://tjosm.com/4937/install-virtualmin-nginx-php-7-mariadb-ubuntu-16-04/

I suggest you installing Virtualmin first with the script and then installing Nginx. I don't have much experience with CentOS, but I think the default php version is 7. But I might be wrong.

Tue, 08/30/2016 - 13:33
unborn
unborn's picture

guys centos is not working properly with standard install.. even from forums posts - why bother to support it at all.. it does not meet requirements even after fresh install.. php7 is buggy and not officially released yet @ freddy63.. means you will have a troubles.

Configuring/troubleshooting Debian servers is always great fun

Tue, 08/30/2016 - 13:50 (Reply to #8)
Freddy63
Freddy63's picture

Ubuntu 16.04 now ships with PHP 7. I'm using PHP 7 on my Ubuntu 14.04 server. It's working I don't have a doubt about that.

Tue, 08/30/2016 - 14:18 (Reply to #9)
unborn
unborn's picture

ah I see.. well, as I said its not ready , was not released yet to be used as an stable and if you will have look around net and this forums - you will found out that it is not working very well.. :) I would say, if your standard php version shipped with your os is working then use that.. no issues at all..... good luck.

Configuring/troubleshooting Debian servers is always great fun

Tue, 08/30/2016 - 19:56 (Reply to #10)
cybster

But I installed Virtualmin yesterday on Centos7 wthout any issues

Tue, 08/30/2016 - 13:52
Welshman
Welshman's picture

Centos fine with me.

Chaos Reigns Within, Reflect, Repent and Reboot, Order Shall Return.

Wed, 08/31/2016 - 11:28
Cloud4G

Centos is the most widely used linux for servers .. it is slower to officially support new capabilities because stability is prized and, probably, because of inertia. I have PHP7 working on Centos 6.8 without any problems and with wider support for applications than PHP5.x However, I thought it was time to shift to Centos 7 as it has been out for some time, over a year and a half and it comes with MariadB. The major problem is lack of experience on the platform including lack of documentation for specific software stacks such as Centos 7, MariadB 10, NGINX, PHP7 with Virtualmin/Webmin/Cloudmin.
It looks like the issue I am having has to do with sequence of installation. I will first try uninstalling PHP 5.4 and PHP 7 and then reinstall PHP7. That may not be the best or easiest thing to do but I am curious to see if it works. Then I will do a fresh install of Centos 7, install needed repos and upgrades, and then follow the sequence that others have found to work. If I find irregularities or information left out, I will feed that back.

Thu, 11/03/2016 - 10:37 (Reply to #13)
Cloud4G

I upgraded the Centos 7 standard to PHP5.6 and then installed PHP7 on the VPS using the steps found here. I then installed NGNX, CSF (Configserver Firewall), and all appear to be working.

Wed, 08/31/2016 - 13:02
Welshman
Welshman's picture

Get a server running fine with PHP7 is one thing, what about the software like web scripts etc etc.

Would love to know scripts that are running fine with PHP7

Chaos Reigns Within, Reflect, Repent and Reboot, Order Shall Return.

Thu, 09/08/2016 - 11:50 (Reply to #15)
aschenbr

I currently have upgraded to php 7 , and as of right now , the scripts don't work or upgrade as they are all wanting to use php 5.X dependencies.

Not sure if there is a fix for this.

Fri, 09/09/2016 - 16:07 (Reply to #16)
Cloud4G

My experience with PHP7 is limited to Joomla 3.6.2, PHPmyAdmin. All J extensions work.

Fri, 10/27/2017 - 10:27 (Reply to #17)
Cloud4G

I have installed Virtualmin v6 LEMP stack. Then I tried various upgrades of PHP including both replacements with Remi's PHP7.1 and also multiple PHP versions. Some observations:

  • Centos 7 continued packaging of PHP 5.4 sucks big time. What a waste since this will be obsolete before long. Maybe that is to satisfy lingering users. I don't know why Centos 7 repo doesn't come with PHP5.6 and PHP 7 out of the box.
  • If you are installing a new server to support fresh scripts such as CMS with related plugins that are recent to within the past year, you may find there are no incompatibility issues with running just PHP7/7.1.
  • If the server needs to support older scripts, PHP7/7.1 may break the applications such as web servers/CMS.
  • Keeping PHP5.4 will run into problems as PHPMyAdmin, popular CMS including Wordpress and Joomla cannot be used while transferring of the CMS that use older scripts may not run on the server stack.
  • My experience is that Virtualmin's install of PHP5.4 plus PHP7 is not a good choice. PHP5.4 must be upgraded to PHP5.6. PHP7 is OK but my preference is to install Remi's repo, enable PHP5.6, upgrade the Centos standard 5.4 to PHP5.6, remove or leave the redundant PHP7, and then install Remi's PHP7.1.x as the additional version.
  • That seems to work OK. given that many scripts will not run on PHP5.4 and it is no longer supported, this PHP5.6 + PHP7.1 multi-version will allow support of older scripts. This can be done by setting up of an alternate VM template with PHP.5.6 chosen.

It would be great if Virtualmin/Webmin fully supported NGINX with multiple versions of PHP so that the configuration could be chosen/changed after the install of a virtual server. The PHP selection does not work. NGINX with PHP7 have become a mainstream choice alongside LAMP. More new servers are reportedly installed using LEMP/NGINX and PHP7/7.1 use has accelerated.

Thu, 09/08/2016 - 17:16
andreychek

Howdy,

PHP should work on any supported distro out of the box.

As far as using PHP7 -- PHP7 is indeed supported. It comes with Ubuntu 16.04 by default.

However, switching from PHP5 to PHP7 on an existing domain may require some tweaking. You might want to try switching the PHP Execution Mode to something like mod_php, then back to FCGID -- which will re-generate the Apache config and PHP wrapper scripts.

However, I wouldn't just upgrade to PHP7 on CentOS. Instead, I would install it side-by-side with the existing PHP version, which can be done with these instructions here:

https://www.virtualmin.com/documentation/web/multiplephp

Now, to my knowledge PHP7 isn't yet available in that repo... but there's a test version of that available, which is described here:

http://blog.remirepo.net/post/2015/03/25/PHP-7.0-as-Software-Collection

Tue, 09/20/2016 - 22:53 (Reply to #19)
Cloud4G

The remi repo blog now shows php7 as 'remi-safe' repository release, elevated from the 'test' repo. Remi's blog says " php5.5 is Dead'. a pretty bold statement, and says it is no longer being maintained. However, the site continues to support downloads.

Fri, 09/09/2016 - 14:42
aschenbr

Just an update , switching the PHP Execution Mode to something like mod_php, then back to FCGID, worked. and everything updated.

Thank you

Sat, 09/10/2016 - 19:05
ninjaboxes

I'm chiming in here because I am having a related issue. I posted a thread here : https://www.virtualmin.com/node/41976

I have CentOS 7.2 / Virtualmin , PHP 5.4.16 (BASE PHP) / same as outputted on php -v (terminal) and it's the only PHP version that is displayed in any of my Virtual Server's phpinfo.php file. The re-check configuration doesn't detect php71* packages which are installed successfully. But even disregarding the PHP 7.1 detection...

I have my Virtual Servers setup for a PHP 5.6.5 template and it's only outputting PHP 5.4.16 ... I even tried the above solution for Switching Website Options on each Virtual Server to mod_php and then back to FCGID, saved, restarted httpd & php-fpm . No Dice.

Anything would be greatly appreciated.

Thanks Elite Linux Badasses :)

Sat, 09/10/2016 - 19:23
ninjaboxes

Update:

I found a tutorial here: https://www.server-world.info/en/note?os=CentOS_7&p=php71

Then hit the terminal and knocked these keysets out:

  • systemctl stop php-fpm
  • systemctl disable php-fpm
  • systemctl start php71-php-fpm start
  • systemctl enable php71-php-fpm

[root@MaximumLightning brandon]# php -v PHP 7.1.0RC1 (cli) (built: Sep 1 2016 14:09:54) ( NTS ) Copyright (c) 1997-2016 The PHP Group Zend Engine v3.1.0-dev, Copyright (c) 1998-2016 Zend Technologies

And phpinfo.php outputs as the following: (on the PHP 5.6.5 configured Virtual Server)

PHP Version 7.1.0RC1

... Guessing Solved. However, I don't know how versatile this is or if it's proper.

Hope it helps someone.

P.S: In Virtualmin , when I run Re-Check configuration it outputs :

The following PHP versions are available : 5.4.16 (/bin/php-cgi), 5.6.5 (/opt/rh/php56/root/usr/bin/php-cgi)

Not even acknowledging the installed and active PHP 71.0RC1

Anyone? :)

Tue, 03/14/2017 - 11:14
monsieurQ

Sorry for opening an old thread. I want to install PHP7 alongside older versions but following the SCL route the range of PHP modules for PHP7 is pretty limited.

Does @cognosco's method using Remi and yum install php70.. etc still give me the ability to allocate PHP version per virtual server?

Many thanks

Sun, 03/19/2017 - 08:33
cognosco

Hi, the author of the topic here. This same config is still running very well here! It's still my main server and one year and a lot of updates later it is still running strong :)

Mon, 03/20/2017 - 04:12
monsieurQ

Thank you for the reply cognosco - it's good to hear this is running so well for you. What I'm wondering is if you still have the ability to allocate PHP version per virtual server?: Virtualmin > Server Configuration > PHP Versions > Version

Mon, 03/20/2017 - 05:24 (Reply to #26)
cognosco

Yes, this does still work perfect. I can choose between 5.6 and 7.

Mon, 03/20/2017 - 05:42
monsieurQ

Perfect - thanks again for responding to an older thread :)

Thu, 12/21/2017 - 09:12
7stars

Hello, when the execution mode is on PHP-FPM, how to choose the php version per virtual server? At the moment this is not possible by Virtualmin option and this is an issue in my opinion... thanks

Tue, 03/13/2018 - 01:28
Peter Simon

I suggest you must install virtualmin first.

spy hunter arcade

Topic locked