How Best to Manage PHP.INI with Multiple Versions of PHP Under PHPBrew?

8 posts / 0 new
Last post
#1 Wed, 01/06/2016 - 07:34
jbrice

How Best to Manage PHP.INI with Multiple Versions of PHP Under PHPBrew?

I have managed to set up multiple versions of PHP (5.x and 7.0) on a test server (Ub. 12.04) under V.min with latest W.min V5.0 update. I have symlinked the PHPBrew PHP installation folders to appropriate subfolders in /opt/rh/. V.min then recognises the various versions of PHP and permits switching virtual servers between those versions of PHP, as proven by the ouput from phpinfo().

However there appears to be no obvious method for managing separate php.ini files for each virtual server as the "non-native" versions of PHP load the version of php.ini found within their own phpbrew folder, irrespective of what V.min reports as being the active php.ini file for the server in Services > PHP 5 Configuration.

What is the best practice when it comes to managing PHP config files in this situation?

TIA

Wed, 01/06/2016 - 07:59
cognosco

Hi, I also did a phpbrew installation. Ubuntu 14.04 + phpbrew (php 7.0.1 added). Phpbrew and php 7.0.1 installed succesfully. After that I also made the symlink.

Virtualmin doesn't recognize the new PHP version. I am also interested in the best practice!

I hope someone can help topicstarter and me.

Wed, 01/06/2016 - 10:04
jbrice

cognosco, is your Webmin updated to (the very recent) V5.0? If not it will fail to recognise PHP 7.x.

It works OK for me now after W.min updated, but I am left wondering how best to integrate php.ini management across virtual servers and for additional versions of PHP (5.x and 7.x).

Wed, 01/06/2016 - 10:05
jbrice

cognosco, is your Webmin updated to (the very recent) V5.0? If not it will fail to recognise PHP 7.x.

It works OK for me now after W.min updated, but I am left wondering how best to integrate php.ini management across virtual servers and for additional versions of PHP (5.x and 7.x).

Wed, 01/06/2016 - 10:47
pwr9lp Pro Licensee

Hi

First thanks for a great hosting software.

But after upgrading to virtualmin v5.0 i get this error.

AH00526: Syntax error on line 505 of /etc/httpd/conf/httpd.conf: SSLCACertificateFile takes one argument, SSL CA Certificate file ('/path/to/file' - PEM encoded)

There is a posibility that this cut have been there also on 4.18 after installing Let's Encrypt on most of my domain's. I have not made a config tjek after the SSL installation.

Is there som body that have seen this error before ?

Regards Lars Pedersen

Wed, 01/06/2016 - 11:13 (Reply to #5)
pwr9lp Pro Licensee

Hi

Sorry for this. But the error was from installing the Let's Encrypt on most of my domain's I made 3 errors and this resolting in 3 lines with SSLCACertificateFile. That was not having any other parameters on it. I just deleted the lines and now the config tjek was okay :-)

Thu, 01/07/2016 - 10:42
jbrice

No answer to my original question so another question...

How does VirtualMin manage PHP so that it is possible to have a separate php.ini for each virtual site?

If I understood that then there is a chance of getting the compile options etc. right to get it to working the same manner with additional versions of PHP (Fcgi an Ubuntu server).

Sat, 01/09/2016 - 04:58
jbrice

The answer is simple - once you know it. V.min sets up an environment variable (PHPRC) for each version of PHP that it has found (f/cgi only). PHPRC defines the first place to be checked by PHP for a php.ini file before looking in the default folder (defined when PHP was compiled).

So the trick is to add add suitably-named folder(s) for each additional PHP version in the virtual server's /etc folder. There will be a /php5 folder there already for the PHP originally installed,.

So add folder(s) for each additional PHP version like (e.g. for newly added PHP5.5.x) /home/your_domain_id/etc/php5.5 alongside the existing folder - /php5. Pop your domain-specific php.ini files for the new PHP in there and it will be loaded in preference to the default php.ini. Or you can add a symlink with a name like 'php5.5' pointing to a folder containing the generic php.ini file you wish to use for that PHP.