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.

SuPHP with PHP5 (howto)

Discussion in 'General Discussion' started by flen, Aug 28, 2006.

  1. flen

    flen Member

    Joined:
    Jun 12, 2005
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    1
    Hi,

    Are there any howto's for cPanel with PHP5 and SuPHP? :)
     
  2. sparek-3

    sparek-3 Well-Known Member

    Joined:
    Aug 10, 2002
    Messages:
    1,381
    Likes Received:
    23
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    In order for suPHP to work on a CPanel server you need to apply a lot of patches. You also have to edit the VirtualHost template and insure that the template does not get overwritten.

    I really think suPHP is a better offering than the phpsuexec offering that CPanel currently offers. I wish they would investigate incorporating suPHP instead of phpsuexec into the CPanel application. But it would require some work to get it working. I have gotten it to work on a couple of our CPanel servers, but unfortunately, I just do not have a how to guide on how to do it. I know there were a lot of patches applied and some of these patches conflicted with other patches, meaning you had to manually edit the suPHP code.

    If I ever get enough free time, I will see if I can do a how to guide.
     
  3. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    They have. suPHP is available in the new easyapache2 available in EDGE at the moment ;)
     
  4. eger

    eger Well-Known Member

    Joined:
    Feb 28, 2003
    Messages:
    128
    Likes Received:
    0
    Trophy Points:
    16
    I am testing out the latest edge and easyapache right now. SO far it LOOKS really nice. I'll post a reply of how well it works. Trying latest php 5 with apache 2.0 (since 2.2 doesn't support suPHP...yet).
     
  5. sparek-3

    sparek-3 Well-Known Member

    Joined:
    Aug 10, 2002
    Messages:
    1,381
    Likes Received:
    23
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    Really? Thats great. But is easyapache2 for Apache 2 only? Or what is the significance of the 2? I'd be interested in seeing how they integrated it. I don't currently have a test server where I can install Edge, but if I can get a server where I can play around, I'll have to try Edge and see how suPHP works.
     
  6. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    easyapache2 is simply the latest version of easyapache which will build apache v1.37 v2.0* and v2.2*. suPHP is an option for apache v2.0* at present (among a very long list of new options).
     
  7. cinusik

    cinusik Active Member

    Joined:
    Jul 31, 2003
    Messages:
    31
    Likes Received:
    0
    Trophy Points:
    6
    cPanel Access Level:
    Root Administrator
    eger, waiting for your reply how suphp is working with apache2 and php5.
    I wonder if there is any way to change php.ini settings per user in httpd.conf or any other way in this php5+suphp configuration.
     
  8. eger

    eger Well-Known Member

    Joined:
    Feb 28, 2003
    Messages:
    128
    Likes Received:
    0
    Trophy Points:
    16
    The new easy apache is for both 1 and 2 and 2.2. It is a complete rewrite and I must say it is very nice and clean (surprised since most cPanel scripts don't have very clean output).

    Was going well for my test. But I guess it was too good to be true. Here was the error I was returned right as it was finished:

    Code:
    **** Done building apache 2, starting post run tasks **
    
    Cleaning up build directories...
    Done
    Resolving possible problems caused by apache 2.0's apxs adding apache 1 style entries to an apache 2 config
    httpd.conf SRC: 2 TRG: 1
    Done!
    Done!
    Error: postcheck() returned a failed status
            Restoring previously working apache
    Done!
    
    There are some new options to put everything into a .bad dir if postcheck fails so I will try that next run and see if I can spot the problem. I am also testing on a machine that I was testing betas on with Dan and may have something very askew...
     
  9. eger

    eger Well-Known Member

    Joined:
    Feb 28, 2003
    Messages:
    128
    Likes Received:
    0
    Trophy Points:
    16
    Did a second round with Verbose building and got the error causing postcheck to fail.

    Code:
    Cleaning up build directories...
    Done
    Resolving possible problems caused by apache 2.0's apxs adding apache 1 style entries to an apache 2 config
    httpd.conf SRC: 2 TRG: 2
    Done!
    Syntax error on line 310 of /usr/local/apache/conf/httpd.conf:
    Port was replaced with Listen in Apache 2.0
    Error: postcheck() returned a failed status
            Restoring previously working apache
    Copying postcheck() failed build to .bad...
    Done!
    
    Trying now with a removed httpd.conf to see if it will rebuild it for apache 2. Strange it did not autofix this error making it fail when trying to go from a 2.2 config file to 2.0.

    Will try removing the httpd.conf and then just removing line 310 next and see what happens.

    EDIT: Just also noticed that the httpd.conf SRC says 2 and the TRG says 2 where the source should have been 2_2. Possibly the error in postcheck...
    EDIT2: Couldn't get it to work with missing httpd.conf, or edited httpd.conf. Fails then on something about ssl.conf. Calling it a day, if interested I will try to update this thread tomorrow when I try some more =)
     
    #9 eger, Aug 29, 2006
    Last edited: Aug 29, 2006
  10. eger

    eger Well-Known Member

    Joined:
    Feb 28, 2003
    Messages:
    128
    Likes Received:
    0
    Trophy Points:
    16
    Well I have given up for now. I have probably run easyapache about 20 times now and everytime it is something else wrong... ssl.conf, httpd.conf, mod_auth_passthrough, mod_ssl, log folders not being found, can't bind to ports even when 80 and 443 are free, etc..

    Also tried going back to apache 1.3 and 2.2 with no luck. Definitely not working at least without some manual configuration hacking.
     
  11. dave9000

    dave9000 Well-Known Member

    Joined:
    Apr 7, 2003
    Messages:
    891
    Likes Received:
    1
    Trophy Points:
    16
    Location:
    arkansas
    cPanel Access Level:
    Root Administrator
    edit the /usr/local/apache/conf/httpd.conf and change the line that says Port 80 to Listen 80 and apache will start
     
  12. timdorr

    timdorr Well-Known Member
    PartnerNOC

    Joined:
    Jul 9, 2002
    Messages:
    93
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Atlanta, GA
    That's just regular CGI with some bells and whistles? What's the point then?

    Go with FastCGI and you'll have PHP5 running at proper speed in comparison to running it as a slow, wasteful CGI: http://timdorr.com/archives/2006/02/php4_and_php4_s.php
     
  13. eger

    eger Well-Known Member

    Joined:
    Feb 28, 2003
    Messages:
    128
    Likes Received:
    0
    Trophy Points:
    16
    That may be the case, I haven't checked. But the point I think was more that it was a solution created and supported by cPanel in easyapache so no 'external hacking' should be required. Though there is always going to be some hacking to get the new things working.
     
  14. dave9000

    dave9000 Well-Known Member

    Joined:
    Apr 7, 2003
    Messages:
    891
    Likes Received:
    1
    Trophy Points:
    16
    Location:
    arkansas
    cPanel Access Level:
    Root Administrator
    Here is what I had to do to get suPHP working with apache 2.0.x and php 4.4.4

    edit the httpd.conf and add this line to the LoadModules section

    LoadModule suphp_module modules/mod_suphp.so

    and then comment out this line in the below section

    <IfModule mod_suphp.c>
    suPHP_Engine On
    suPHP_ConfigPath /opt/suphp_php_bin
    ------> #suPHP_AddHandler x-httpd-php

    <Directory /home*/*/public_html>
    suPHP_AddHandler x-httpd-php
    </Directory>
    AddHandler x-httpd-php .php .php3 .php4 .phtml
    AddType application/x-httpd-php .php .phtml .php3 .php4
    </IfModule>
    <IfModule !mod_suphp.c>
    AddHandler x-httpd-php .php .php3 .php4 .phtml
    AddType application/x-httpd-php .php .phtml .php3 .php4
    </IfModule>

    restart apache and you should have suPHP enabled apache2

    Here is a link to a phpinfo page on the test server

    http://test.isitetech.com/php.php
     
  15. eger

    eger Well-Known Member

    Joined:
    Feb 28, 2003
    Messages:
    128
    Likes Received:
    0
    Trophy Points:
    16
    Dave,

    I noticed that too. Looks like it doesn't belong there and the one below it is the correct one. Here is what I had to do to get 2.0 with suPHP up and running.

    First, leave when running easyapache you will need to leave build as is and manually resolve errors.

    Then I had to:

    1. Change the 'Port 80' line to 'Listen 80' in httpd.conf
    2. Remove 'ClearModuleList' from httpd.conf
    3. Change 'SSLLog' to 'ErrorLog' in httpd.conf
    4. Change 'SSLLogLevel' to 'LogLevel' in httpd.conf
    5. Comment or remove the first suPHP_AdddHandler line (as stated by dave's post above)

    Then it was up and running for me. Guess once they fix those kinks out it should be good. I would think these are things the postcheck is supposed to be doing since it even detects which config version it is coming from and moving to.

    Hope this might help someone.

    EDIT: removed last step. not sure how to get the main hostname working. defaults to the first virtualhost on the IP for me. Not a big deal.
     
    #15 eger, Aug 31, 2006
    Last edited: Aug 31, 2006
  16. sparek-3

    sparek-3 Well-Known Member

    Joined:
    Aug 10, 2002
    Messages:
    1,381
    Likes Received:
    23
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    This is one place where using various suPHP patches to get this to work. The suphp.conf file (in /etc?) defines the docroot, for my custom servers this is defined as /home. But the hostname VirtualHost entry refers to /usr/local/apache/htdocs as the hostname directory, which is not within /home.

    There are a couple of patches that you apply to suPHP that allows you to overwrite this setting within the VirtualHost setting and another that does not check this docroot requirement. You have to apply these patches to suPHP before it is compiled. Then within the hostname's VirtualHost section you have to add:

    suPHP_GlobalDocRoot /usr/local/apache/htdocs
    suPHP_DontCheckVHostDocRoot Yes


    Unforunately, I'm not sure where these patches are. I know I found them on the suPHP mailing list. And again, I'm not sure how this works with CPanel's rendition of suPHP. Also, I'm only using Apache 1.3, I have never used Apache 2 (not really looking forward to its adoption, but I guess its coming sooner or later) so I don't know how much of this applies to my suPHP customizations. I just know that there was a lot of customizations applied for me to get this to work with Apache 1.3, but I really like some of the added capabilities that suPHP allows for.
     
  17. eger

    eger Well-Known Member

    Joined:
    Feb 28, 2003
    Messages:
    128
    Likes Received:
    0
    Trophy Points:
    16
    Hopefully cPanel devs take notes on threads and they will work around these bugs. Maybe I should give Dan at cPanel a heads up about these issues so he can resolve them before merging easyapache2 into current or release...
     
  18. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    I'd suggest letting them know directly, they may ask for a bugzilla entry.
     
  19. rachweb

    rachweb Well-Known Member

    Joined:
    Jun 26, 2004
    Messages:
    268
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    amsterdam
  20. dave9000

    dave9000 Well-Known Member

    Joined:
    Apr 7, 2003
    Messages:
    891
    Likes Received:
    1
    Trophy Points:
    16
    Location:
    arkansas
    cPanel Access Level:
    Root Administrator
    What I have been doing is when I verify a issue and fix I drop Dan a note with the specifics of the issue and the fix so he can look it over for the next release of the easyapache
     
Loading...

Share This Page