kinda urgent: Easy Apache 3 and PHP4 + PHP5 for different accounts.

rampinelli

Member
Oct 26, 2006
17
0
151
Hello,
yesterday I upgraded my server to Easy Apache 3, with support for concurrent php4 and php5! I've never had PHP5 before. But now, as expected, some of my hosted sites have compatibility problems with php5 therefore I need to switch those accounts back to use php4. How can I do that? I want to do this only for some of my customers who already asked me, not for everyone.
When I go to WHM and "modify accounts", there's no option to allow them to use PHP4 and not the 5.... Please help me
 

rampinelli

Member
Oct 26, 2006
17
0
151
Just tell me if its possible or not so that I know in the worse case to revert all the changes and go back to old good apache 1 and php4 and not with this buggy apache 3.
Thanks.
 

Todd Mitchell

Well-Known Member
Staff member
Nov 13, 2006
301
1
243
Houston, TX
You can set the default php handler per user within that specific users cPanel interface within the Software/Services >> PHP Configuration section.
 

ispro

Well-Known Member
Verifed Vendor
Apr 8, 2004
628
2
168
cPanelTodd, where is that option? We run "WHM 11.15.0 cPanel 11.17.0-S19434" and at PHP Configuration of cPanel there are few options which are read-only.
 

cPanelDavidG

Technical Product Specialist
Nov 29, 2006
11,212
13
313
Houston, TX
cPanel Access Level
Root Administrator

ispro

Well-Known Member
Verifed Vendor
Apr 8, 2004
628
2
168
The program doesn't work. At least in the way it should.
Because there are no files /usr/local/apache/conf/php4.htaccess nor /usr/local/apache/conf/php5.htaccess and program can't to know what mime type(s) it should to use.

In fact overriding AddHandler doesn't work with suphp.
We have the following in php.conf:

AddHandler application/x-httpd-php4 .php4
AddType application/x-httpd-php4 .php4
AddHandler application/x-httpd-php5 .php5 .php .php3 .php2 .phtml
AddType application/x-httpd-php5 .php5 .php .php3 .php2 .phtml

As well as suphp directives.

But having AddHandler in .htaccess don't override these settings.
It is strange as if we have PHP4 secondary via cgi (not via suphp) we may override handlers.

P.S. We are experienced enough, but can't sort this out unfortunately and at this time on production servers have PHP4 as CGI instead suphp...
 

ispro

Well-Known Member
Verifed Vendor
Apr 8, 2004
628
2
168
Any information about HOW to override handlers when PHP run via suPHP?
 

ispro

Well-Known Member
Verifed Vendor
Apr 8, 2004
628
2
168
Well, after deeper debug we found that cPanel's suPHP requires AddHandler to be inside /home/USER/.htaccess

cPanel either set file empty (PHP system default), for PHP5:

# Use PHP5 as default
AddHandler application/x-httpd-php5 .php

For PHP4

# Use PHP4 as default
AddHandler application/x-httpd-php4 .php

It is absolutely not documented, fortunately we were able to work this out.

Both PHP now works via suPHP, it is great!
 

electric

Well-Known Member
Nov 5, 2001
790
11
318
Maybe that is a bug? I think the .htaccess file should be in the web root, not the account root...
 

ispro

Well-Known Member
Verifed Vendor
Apr 8, 2004
628
2
168
Maybe that is a bug? I think the .htaccess file should be in the web root, not the account root...
It looks to be a feature. Try to change PHP version via cPanel -> PHP Configuration and you would notice it update file /home/USER/.htaccess

Just chosen PHP5 for the fresh (e.g. without any PHP overrides set) account and got the following:

# cat /home/USERNAME/.htaccess
# Use PHP5 as default
AddHandler application/x-httpd-php5 .php

# ls -la /home/USERNAME/.htaccess
-rw-r--r-- 1 USERNAME USERNAME 63 Feb 20 22:29 /home/USERNAME/.htaccess

As you may see, file hasn't been created in web root. Server time is EET.