0

System information

Operating system CentOS Linux 6.7

Kernel and CPU Linux 2.6.32-042stab108.1 on x86_64

yum repolist enabled

only ones i added manually

  • base - CentOS-6 -
  • Base epel - Extra Packages for Enterprise Linux 6 - x86_64
  • extras - CentOS-6 - Extras
  • ius - IUS Community Packages for Enterprise Linux 6 - x86_64
  • mod-pagespeed - mod-pagespeed
  • remi-safe - Safe Remi's RPM repository for Enterprise Linux 6 - x86_64
  • rhscl-php55-epel-6-x86_64 - PHP 5.5.21 -
  • epel-6-x86_64 updates - CentOS-6 - Updates
  • virtualmin - RHEL/CentOS/Scientific 6 - x86_64 -
  • Virtualmin virtualmin-universal - Virtualmin Distribution Neutral
  • Packages vz-base - vz-base vz-updates - vz-updates

available installed versions

  • /usr/bin/php 5.3.3
  • /usr/bin/php55 5.5.30

i tried the following (using virtualmin)

  1. enabled 5.5.30 for a specific directory and that didn't worked out got this error from virtualmin This virtual server is using the mod_php execution mode for PHP, such does not allow per-directory version selection.
  2. enabled the directory specific version home/<domain>/domains/<subdomain>.<domain>.com/public_html/public , and phpinfo(); returns 5.3.3 version
  3. tried yum replace php-common --replace-with=php55-php-common got too many packages in WARNING: Unable to resolve all providers and didn't proceed.
  4. tried to remove version 5.3 but other php code breaks that's why i hesitate replacing that version
  5. Browsed the web for answers only to find out that more than half of the things i read are broken, repositories outdated or conflicting with other packages when i try to yum upgrade php

Can someone please help with this frustrating situtation? i really thought that installing another version and enabling it for a directory would solve this problem.

  • You have a lot of repos there. Are you looking to have multiple PHP versions on your system or do you just want to upgrade, and if so to what version? – Taylor Taff Oct 29 '15 at 14:01
  • @TaylorTaff i want the "upgrade" be the last solution, multiple version is what i want to accomplish , sorry if that wasnt clear inside the post – Gntem Oct 29 '15 at 14:05
1

We recommend you use SCL versions of packages, so that the PHP versions can co-exist peacefully with each other and not cause the conflicts you're running into. I've got Remi's PHP 5.6.15 packages running on our new server, under Virtualmin, and it's working fine (I did have to tweak the detection code in php-lib.pl, though that won't be needed in a few days when new Virtualmin comes out).

Also, you should use the fcgid execution mode, and not mod_php. mod_php can only exist in one version in a single Apache instance and will never work with multiple versions. fcgid is the default execution mode in a Virtualmin system installed with install.sh, but it is configurable in System Settings:Server Templates:Template Name:Apache Website. "Default PHP execution mode" is the option you want, and FCGId is the right value for using multiple PHP versions (and for a variety of other good reasons).

Current version of Virtualmin doesn't support all of the SCL PHP packages, yet, but the next version will handle arbitrary versions easily (and will likely have the ability to query the SCL command to figure out what your preferred PHP version is; I don't know how much of that has been implemented yet).

There has been quite a bit of discussion about this subject in our forums over the past few weeks, as SCL has gotten more PHP versions, and as Virtualmin support for SCL packages has been expanded.

There's some docs here (which I'm not sure if Eric has updated yet, to address recent changes in SCL, but they will be soon if not already):

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

  • yes i ended up using SCL packages , with mod_php since i managed to get my application working in newer version. Virtualmin indeed doesn't support SCL packages i had to specify to *.conf file paths so it can read/write to them. – Gntem Nov 6 '15 at 9:28
4

Notice that Apache is unable to manage various versions of PHP (using mod_php), so you can only install "php" OR "php55-php"

To enable different versions of PHP in Apache HTTPD server, you need to use "FPM".

With Apache 2.2 (in CentOS 6.x) you have to use mod_proxy_fastcgi (available in EPEL, backported from 2.4) and ProxyPass directive.

Simpler with Apache 2.4 (in CentOS 7.x) which support SetHandler to fastcgi proxy.

Some example on :

  • does this work with apache2.2 ? if i want later to switch php to just use >=5.5 what would i do? – Gntem Oct 30 '15 at 8:57
  • As I wrote, yes it works with Apache 2.2 (using ProxyPass) – Remi Collet Oct 30 '15 at 9:32
  • Virtualmin sets up under fcgid+suexec, by default. mod_php isn't recommended for any deployment unless the user really, really, needs some behavior of mod_php. Not sure how OP ended up with mod_php while trying to use multiple PHP versions (when running in mod_fcgid mode, multiple PHP versions are supported in Virtualmin). – swelljoe Nov 5 '15 at 19:18
  • although i tried like several time it didn't work as i wanted to, ended up updating apache to 2.4 and fresh install php55 , and tried solving the problems that occured with version update after many hours i got my application up & running thought i dont recommend doing that, still thanks for your answer – Gntem Nov 6 '15 at 9:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.