The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

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

Discussion in 'EasyApache' started by rampinelli, Jan 20, 2008.

  1. rampinelli

    rampinelli Member

    Joined:
    Oct 26, 2006
    Messages:
    17
    Likes Received:
    0
    Trophy Points:
    1
    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
     
  2. rampinelli

    rampinelli Member

    Joined:
    Oct 26, 2006
    Messages:
    17
    Likes Received:
    0
    Trophy Points:
    1
    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.
     
  3. ToddShipway

    ToddShipway Well-Known Member

    Joined:
    Nov 13, 2006
    Messages:
    300
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Houston, TX
    You can set the default php handler per user within that specific users cPanel interface within the Software/Services >> PHP Configuration section.
     
  4. ispro

    ispro Well-Known Member

    Joined:
    Apr 8, 2004
    Messages:
    628
    Likes Received:
    1
    Trophy Points:
    18
    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.
     
  5. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    I know some concurrent PHP setups result in this setting not being available to end-users via the cPanel interface.

    However, there is documentation on how to force a specific PHP version: http://www.cpanel.net/support/docs/ea/ea3/ea3php_php_customize.html
     
  6. ispro

    ispro Well-Known Member

    Joined:
    Apr 8, 2004
    Messages:
    628
    Likes Received:
    1
    Trophy Points:
    18
    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...
     
  7. ispro

    ispro Well-Known Member

    Joined:
    Apr 8, 2004
    Messages:
    628
    Likes Received:
    1
    Trophy Points:
    18
    Any information about HOW to override handlers when PHP run via suPHP?
     
  8. ispro

    ispro Well-Known Member

    Joined:
    Apr 8, 2004
    Messages:
    628
    Likes Received:
    1
    Trophy Points:
    18
    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!
     
  9. electric

    electric Well-Known Member

    Joined:
    Nov 5, 2001
    Messages:
    697
    Likes Received:
    1
    Trophy Points:
    18
    Maybe that is a bug? I think the .htaccess file should be in the web root, not the account root...
     
  10. ispro

    ispro Well-Known Member

    Joined:
    Apr 8, 2004
    Messages:
    628
    Likes Received:
    1
    Trophy Points:
    18
    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.
     

Share This Page