Add possibility to set PHP version for each directory in GUI of cPanel
Right now we can use PHP Selector to set PHP version for an account. Also, we can change PHP version for each directory using SuPHP handlers (via .htaccess)
Anyway, we get many requests from customers to set custom PHP versions for directories and .htaccess is not a comfortable way for everyone. It would be really great if you could add functionality to set custom PHP versions for directories using GUI (in cPanel), like H1's Hive product does.
If it only works with suPHP in the GUI that would be a very good start,
but ideally options like FastCGI should also be supported in the GUI.

This is now available in cPanel via MultiPHP and in Plesk via PHPSelect. We will make both of those systems to work with mod_lsapi, and our PHPs. Yet we will not implement per directory php in PHP Selector.
-
Anonymous commented
*** Part 2/2 ***
For example, add all of the following to httpd.conf...
# This default would be managed by "PHP Selector" & might not point to lsphp on some hosts...
Action application/x-httpd-php /etc/cl.selector/lsphp
AddHandler application/x-httpd-php .php# These are the important part! Expose everything! Whether these (x-httpd-php*) point to "lsphp" or not would be based on the server.
Action application/x-httpd-php52 /opt/alt/php52/usr/bin/lsphp
Action application/x-httpd-php53 /opt/alt/php53/usr/bin/lsphp
Action application/x-httpd-php54 /opt/alt/php54/usr/bin/lsphp
Action application/x-httpd-php55 /opt/alt/php55/usr/bin/lsphp
Action application/x-httpd-php56 /opt/alt/php56/usr/bin/lsphp# These are the important part! Expose everything! Regardless of server, have matching "x-httpd-lsphp*" mime types pointing to "lsphp", even if it "dupes" the above on some servers.
Action application/x-httpd-lsphp52 /opt/alt/php52/usr/bin/lsphp
Action application/x-httpd-lsphp53 /opt/alt/php53/usr/bin/lsphp
Action application/x-httpd-lsphp54 /opt/alt/php54/usr/bin/lsphp
Action application/x-httpd-lsphp55 /opt/alt/php55/usr/bin/lsphp
Action application/x-httpd-lsphp56 /opt/alt/php56/usr/bin/lsphp# These are the important part! Expose everything! Regardless of server, have matching "x-httpd-php-cgi*" mime types pointing to "php-cgi".
Action application/x-httpd-php-cgi52 /opt/alt/php52/usr/bin/php-cgi
Action application/x-httpd-php-cgi53 /opt/alt/php53/usr/bin/php-cgi
Action application/x-httpd-php-cgi54 /opt/alt/php54/usr/bin/php-cgi
Action application/x-httpd-php-cgi55 /opt/alt/php55/usr/bin/php-cgi
Action application/x-httpd-php-cgi56 /opt/alt/php56/usr/bin/php-cgi# These are less important, you could setup default file extensions, or not.
# Once I have a mime-type, I can handle the file extensions myself in .htaccess
AddHandler application/x-httpd-php52 .php52
AddHandler application/x-httpd-php53 .php53
AddHandler application/x-httpd-php54 .php54
AddHandler application/x-httpd-php55 .php55
AddHandler application/x-httpd-php56 .php56...I'm sorry for the long examples, but I didn't wanna leave any confusion. There should be a default mime-type mapping for EVERY VERSION OF PHP installed on the server, that means when PHP 5.7 & 7.0 are released, you must add more lines/mime-types...
# ...
Action application/x-httpd-php57 /opt/alt/php57/usr/bin/lsphp
Action application/x-httpd-php70 /opt/alt/php70/usr/bin/lsphp# ...
Action application/x-httpd-lsphp57 /opt/alt/php57/usr/bin/lsphp
Action application/x-httpd-lsphp70 /opt/alt/php70/usr/bin/lsphp# ...
Action application/x-httpd-php-cgi57 /opt/alt/php57/usr/bin/php-cgi
Action application/x-httpd-php-cgi70 /opt/alt/php70/usr/bin/php-cgi...(& maybe remove old versions too)...since I just noticed the "70" vs "7" issue, I'm also gonna recommend these...
Action application/x-httpd-lsphp5 /opt/alt/php57/usr/bin/lsphp
Action application/x-httpd-lsphp7 /opt/alt/php70/usr/bin/lsphp...the recommendation here is that "x-httpd-lsphp5" should point to the NEWEST release of "version 5" on the server (5.6 or 5.7 based on my examples). Ditto for version 7. "x-httpd-lsphp70" would always point to 7.0, but "x-httpd-lsphp7" would point to 7.0, then 7.1, etc...I only demonstrated with "x-httpd-lsphp", but this applies to the other examples too: "x-httpd-php*" & "x-httpd-php-cgi*". For every version of PHP installed on the server, there should be these mappings...
"x-httpd-php*" should point to whatever the DEFAULT PHP handler for the server is, be that "lsphp", suphp or php-cgi
"x-httpd-lsphp*" should point to the LSAPI PHP handler for the server (if lsphp/LSAPI is used on that server)
"x-httpd-suphp*" should point to the suPHP PHP handler for the server (if suPHP is used on that server)
"x-httpd-php-cgi*" should point to the CGI/FastCGI PHP handler for the server...(the "*" means the version number).
I also wanted to say the Error Log ("errlog.html") in cPanel has been UTTERLY UNHELPFUL when diagnosing this, I try something in .htaccess & get either a 403 or 500 error in the browser & the CloudLinux/LiteSpeed Error Log (at least as seen by an end user, not the server admin) only told me that the file 403.shtml or 500.shtml was not found, not WHY the 403 or 500 happened. Apparently LiteSpeed has BAD error logging.
-
Anonymous commented
*** Part 1/2 ***
I support this idea, but a "GUI" is not necessary, at least not as the 1st pass of implementing this, we need to make sure the functionality is working on all systems, then add a GUI.
Currently there are Guides & KB articles for doing this in suPHP & mod_lsapi but NOT for suEXEC...& of course my host uses suEXEC!
The ability for the END USER to set a different versions of PHP on a per-directory basis should exist NO MATTER WHAT the server is using, whether that be suEXEC or suPHP or mod_lsapi.
Note: if this is already possible (at all) when using suEXEC, PLEASE REPLY & TELL ME HOW, my host needs to know.
The following is a copy/paste of feedback I tried to post as a comment to a KB article (so some of it may repeat the above)...
Question: How can I use different PHP versions in different directories (per-dir {per-directory}) when using suEXEC? (I need an answer for the case of using all of the following: cPanel, CloudLinux, CageFS, LiteSpeed, suEXEC)
I'm not even sure how "using suEXEC" affects this...it should JUST BE POSSIBLE, anyway. I can find guides on how to do this in suPHP & mod_lsapi, but what about when using suEXEC?
I don't care if the solution is released as a feature inside "PHP Selector"/"Select PHP Version" (that would be nice, but not necessary), I just want unique mime-types exposed to .htaccess & A LIST OF THE AVAILABLE MIME-TYPES (that list can/should be inside "PHP Selector").
It seems simple to me: Inside LiteSpeed (or Apache) (or maybe integrated with the PHP Selector?), just EXPOSE ALL VERSIONS OF PHP to the webserver as a mime-type. Only the default mime-type (for .php files) is what PHP Selector needs to toggle on an account-wide basis, but mime-types for the REST of the versions of PHP need to be added & available to users to turn on inside .htaccess files.
I'm trying to guess what mime-types COULD BE assigned to the different PHP versions, but there's no way for me to LIST what mime-types Apache/LiteSpeed has registered. I'm just a customer & don't have access to tinker/test all the settings (so, if I was the server admin, it might be possible to do this right now). I've found out that application/x-httpd-php is working & points to the version chosen in PHP Selector & also that application/x-httpd-php55 points (oddly) to the server-default version (which, on my host, is 5.4 not 5.5), I would recommend a mime-type of application/x-httpd-php-server-default for that.
Basically, I can already do a different version of PHP on a per-dir basis (even with suEXEC), but I can only choose between 2 versions, my account's default & the server's default.
Please, CloudLinux or LiteSpeed or cPanel or WHOEVER is responsible for this. PLEASE MAKE THIS DEFAULT. Don't have server admins needing to "enable" this or follow a guide on how to do it. Just turn this ON by default...NO MATTER WHAT they are using, whether that be suEXEC or suPHP or mod_lsapi.
(continued in Part 2)
-
AISO.Net commented
Also make it so that it works with mod_lsapi