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.

Apache 2.2 with PHP4

Discussion in 'EasyApache' started by JonathanLIVE, Oct 30, 2007.

  1. JonathanLIVE

    JonathanLIVE Well-Known Member

    Joined:
    Nov 1, 2003
    Messages:
    50
    Likes Received:
    0
    Trophy Points:
    6
    Can someone explain why PHP4 is not recommended with Apache2.2? We cannot move to PHP5 with too many scripts being incompatible... During install there is just a note from cpanel saying 'php4 not recommended' ... no idea just why not. Is it really not a good idea.. or is it alrlght?

    Thanks
     
  2. 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
    PHP 4 was originally built with Apache 1's threading model in mind. That changed significantly with Apache 2, however PHP 4 did not. Unfortunately, now the two don't play well together. Not saying it wont work, just don't be surprised if you run into issues.
     
  3. JonathanLIVE

    JonathanLIVE Well-Known Member

    Joined:
    Nov 1, 2003
    Messages:
    50
    Likes Received:
    0
    Trophy Points:
    6
    Ok.. thats a start... but can you give me some idea as to what kind of issues?

    If I compiled Apache 2.2 with PHP4 and FastCGI as the handler and mysql 4.1.. what issues could I expect from that?
     
  4. mtindor

    mtindor Well-Known Member

    Joined:
    Sep 14, 2004
    Messages:
    1,281
    Likes Received:
    37
    Trophy Points:
    48
    Location:
    inside a catfish
    cPanel Access Level:
    Root Administrator
    Why don't you compile PHP4 and PHP5 both - set one to be the default and then test with the others. I realize you are worried that you will compile, then have problems with PHP4 because of it not working well with Apache 2.2 and then have problems with PHP5 because scripts may be incompatible. Is there some absolute need for you to move up to Apache 2.2?

    Mike
     
  5. JonathanLIVE

    JonathanLIVE Well-Known Member

    Joined:
    Nov 1, 2003
    Messages:
    50
    Likes Received:
    0
    Trophy Points:
    6
    I have done that with one server already. I have compiled with php4 and 5 and set php4 as the default.. but I have no need/use for php5 now and it seems like just a waste of system resources.

    The move to Apache 2.2 is because the performance increase over 1.3 is huge.. very huge.. but too many scripts break in php5.

    Has anybody done the config I mentioned above? I still am not clear as to what kind of issues I will face with apache2.2 and php4 other than what was said above that is just not specific enough for me to get a grasp as to how extensive an issue we are talking about.
     
  6. bazzi

    bazzi Well-Known Member

    Joined:
    May 23, 2004
    Messages:
    119
    Likes Received:
    0
    Trophy Points:
    16
    we could get php4 work as cgi or fcgi. So we compiled php4 as module and php5 as fcgi.

    You would be surprised how many scripts will work with php5. From al of our customers only one with a very old "post-nuke" script didn't work. SO we sayd to the client that we only support php4 till Q1 of 2008, because of the end of life of php5.
    He totaly understaind and is now changing his website....
     
  7. cPanelKenneth

    cPanelKenneth cPanel Development
    Staff Member

    Joined:
    Apr 7, 2006
    Messages:
    4,461
    Likes Received:
    22
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    The issues arise when using mod_php (for version 4) and one of the Apache threaded MPMs. If you want to use mod_php with Apache 2.x, use the prefork MPM, it gives you the same behavior as Apache 1.3.

    If you are using PHP via CGI, then you won't have issues (this includes via Fast CGI) particular to threading. See the following for more details:

    http://www.php.net/manual/en/faq.installation.php#faq.installation.apache2
     
  8. JonathanLIVE

    JonathanLIVE Well-Known Member

    Joined:
    Nov 1, 2003
    Messages:
    50
    Likes Received:
    0
    Trophy Points:
    6
    Thanks that helps...

    I have tried enabling FastCGI with PHP4 as the handler vs. dso .. however everytime I do it breaks scripts. I don't know exactly what difference it makes, but it appears scripts really do not like FastCGI handling PHP4. When running DSO they load normal.

    I am noticing on some of my servers that with this config.. I am getting a LOT of Write sessions that seem to stay going for a long time before they are gracefully shutdown. Could this be a symptom of running PHP4 as the default and PHP5 as the second version with Apache2.2. For PHP5 I have FastCGI as the handler.

    Thanks
     
  9. cPanelKenneth

    cPanelKenneth cPanel Development
    Staff Member

    Joined:
    Apr 7, 2006
    Messages:
    4,461
    Likes Received:
    22
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    It's possible the scripts are relying upon some settings in the VirtualHost or .htaccess files. Such settings are not (normally) available to a script executed via CGI.
     
  10. JonathanLIVE

    JonathanLIVE Well-Known Member

    Joined:
    Nov 1, 2003
    Messages:
    50
    Likes Received:
    0
    Trophy Points:
    6
    Actually.. the scripts that don't work tend to rely heavily on .htaccess. Since this is the situation does this mean that it would be preferable to disable prefork config in apache2.2 in order for php4 to run OK with it?

    Does this mean that .htaccess will only run properly under apache2.2 with php5 enabled as the default with FastCGI?
     
  11. cPanelKenneth

    cPanelKenneth cPanel Development
    Staff Member

    Joined:
    Apr 7, 2006
    Messages:
    4,461
    Likes Received:
    22
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    Let me rephrase:

    To use settings in .htaccess files in your PHP scripts, you need to use mod_php.

    If you want/need to use PHP 4 as mod_php with Apache 2.2 (in order for the settings in .htaccess to work), then you need to use the prefork MPM, as it is not a threaded MPM.
     
Loading...

Share This Page