I’ve tried installing PHP 5.4 by compiling it to a different directory in /etc (/etc/php54 I think it was) but Virtualmin is unable to detect my compiled version of 5.4. However, the SCL PHP 5.4 is detected.
My question is does anyone know, or can provide some insight or even code sample of how Virtualmin finds and detects the PHP versions that are installed? Mainly I am curious as I am attempting to build a administration panel to help manage all my servers (DigitalOcean Droplets) and automate a bunch of tasks. (Like creating a new droplet, building and compiling php, apache etc) with the click of a form submit. I think it would be kind of cool if I could also make it tell me which droplets (virtual machines) have what in terms of PHP versions available and things like that.
Copied the php.ini-development file from the source tar to /opt/rh/php-5.6/root/etc/php.ini (seemed during previous testing that the php.ini file had to be there for Virtualmin to use it, by use it I mean for it to be copied to the users home directory instead of defaulting to /etc/php.ini) and re-checked configuration in Virtualmin:
The following PHP versions are available : 5.4.16 (/bin/php-cgi)
So it did not properly detect the version. Not exactly sure why yet. If anyone has any ideas, I’d love to hear them please. In the meantime, I’ll keep working on this to see if I can narrow down the issue.
[UPDATES]
So I thought perhaps it was either the dash or periods in the path name, so I compiled php-5.5.16 to /opt/rh/php5516, it made no difference.
I think I found out what the problem is. I can’t be so specific with my --prefix. There is an all_possible_php_versions variable in the code that detects PHP versions. That variable is defined as the following: ./webmin/virtual-server/virtual-server-lib.pl:196:@all_possible_php_versions = (4, 5, 5.2, 5.3, 5.4, 5.5);
Then their is a function called list_available_php_versions that takes each item in that variable, forms the paths /opt/rh/php$php_version/ ($php_version being one item, without the dots between the version numbers, from that array) and then checks around inside that folder for the appropriate php binaries. I moved my /opt/rh/php5516 to /opt/rh/php55 and re-checked the configuration again, and it was successfully detected! This works for me really. I had no need to really be that specific as I don’t plan on having two of the same PHP 5.x.y versions installed, only one version for like php 5.5, 5.4 and 5.6. Speaking of 5.6, Due to this, it would seem that I am not able to use it until Virtualmin updates to support it. Little sad about that but that’s okay I guess.
I guess I should also mention why I am doing this the way I am. For a long time now, I’ve been compiling httpd and php and overwriting the system installed (via yum in my case) version with my compiled version. Adding httpd* and php* to the yum.conf exclude list to prevent updates. I have always felt like this was a sloppy “hack” if you will. So doing things to separate directories allows me to not need to mess with yum and can simply allow it to update the system packages as it pleases, hopefully without disrupting anything I have done with my compiled binaries.
ReArmedHalo above wrote…
Speaking of 5.6, Due to this, it would seem that I am not able to use it until Virtualmin updates to support it. Little sad about that but that’s okay I guess.
Can anyone tell me if it is even possible to run PHP 5.6 in Virtualmin now?
I’m using CentOS 7. I installed rh-php56 from the rhscl repo and was having trouble getting it to be recognized but I read more carefully your that you wrote ReArmedHalo…
I moved my /opt/rh/php5516 to /opt/rh/php55 and re-checked the configuration again, and it was successfully detected! ### FIX #1 (this now lets Virtualmin see php56)
I looked and saw that my PHP 5.6 was installed as /opt/rh/rh-php56 so I created a link php56 that pointed to rh-php56.
### FIX #2 (is this one necessary?)
When I tried to run scl enable php56 bash it failed so in the directory /etc/scl/conf I also create another link php56 that pointed to rh-php56 and was then able to run scl enable php56 bash in addition to the one I already added scl enable rh-php56 bash.
I’m not sure about using the SCL command. To be honest I don’t even know what it does. I’m assuming you don’t need to use it as I haven’t and things have been working.
Also just to clarify, are you still requiring assistance or did you sort out the issue? I wasn’t too sure.
Hello again ReArmedHalo. Yes my questions are all answered but not until after you wrote the last reply.
I now at least mostly know what scl enable php55 does. After running it, which php responds /opt/rh/php55/root/usr/bin/php instead of the default /usr/bin/php. So it appears that changes command line php to use a specific version by default if there’s more than one version installed. However when I log back into the bash again later it doesn’t save that setting. After searching a bit I found that it needs to be included in ~/.bashrc so it gets updated each time a new bash instance is initiated.
I’ll review that as I write up this documentation – it’s likely that we can use a symlink as temporary workaround, which we’ll include in the write up. I have a suspicion that the path used by the newer PHP version is slightly different than where Virtualmin is looking.