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 results in 500 Error

Discussion in 'General Discussion' started by Dan_EZPZ, Jun 5, 2008.

  1. Dan_EZPZ

    Dan_EZPZ Member

    Joined:
    May 8, 2008
    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    1
    Hey,

    I'm trying to get suPHP working on a cPanel box but am having some trouble.

    I have rebuild PHP with suPHP using EasyApache, however i'm not sure what to do now.

    With my suPHP installed and my current config (below) everything works fine.
    Current Configuration

    Option Configured Value
    Default PHP Version (.php files) 5
    PHP 5 Handler dso
    PHP 4 Handler none

    Apache suEXEC on

    However, changing the PHP 5 Handler to suphp results in 500 Errors for any sites wanting to run PHP scripts.

    Any idea what the problem would be? The files seem to be chmod correctly and nothing is 0777.

    I've also tried setting the handler to cgi but everything still needs to be chmod 0777 to get certain scripts to work.

    Thanks,

    Dan
     
  2. UBERHOST

    UBERHOST Well-Known Member

    Joined:
    Jan 13, 2008
    Messages:
    102
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    California, US
    Make sure you check all .htaccess files and remove any "php_flag" references. These will need to be translated in to the proper syntax and added to the user's php.ini file.
     
  3. Dan_EZPZ

    Dan_EZPZ Member

    Joined:
    May 8, 2008
    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    1
    Hey uberhost,

    Thanks for the reply.
    The .htaccess in the users directory doesn't have any php_flags in it.

    I'm wondering if I set it up wrong from the start, alot of threads on this forum seem to show that its a fairly painless process.
     
  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
    Dan,

    If you have to chmod 777 any scripts in order to get htem to work, then suPHP is not enabled. If it were, it would not be possible for you to get a script working with 777 permissions.

    With SuPHP and SuEXEC compiled in, here are my experiences:
    - set php files to chmod 644 or less
    - set cgi/pl scripts to 755 or less
    - set html / graphics / etc to chmod 644 or less

    SuPHP will cause a 500 Internal error to be thrown for any PHP script set to 777. If yours doesn't work until you _do_ set it to 777, then SuPHP isn't active.

    Mike


     
  5. 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
    Dan,

    Set your PHP4 and/or PHP5 handlers back to SuPHP and make sure your php scripts are chmod 644 or less, cgi/pl scripts 755 or less.

    Mike
     
  6. ChrisRHS

    ChrisRHS Well-Known Member

    Joined:
    Jul 12, 2006
    Messages:
    292
    Likes Received:
    5
    Trophy Points:
    18
    Check your logs once you enable suphp, they will help you narrow down the problem!!

    tail /usr/local/apache/logs/suphp_log
     
  7. psipro

    psipro Member

    Joined:
    Jul 20, 2006
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    My money is on the ownership or group being wrong.

    The file needs to be owned by someone other then root/nobody or it will throw an error.

    chown username:username * -R (in the users public_html directory)
     
    #7 psipro, Jun 5, 2008
    Last edited: Jun 5, 2008
  8. Dan_EZPZ

    Dan_EZPZ Member

    Joined:
    May 8, 2008
    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    1
    I put the PHP5 handler back to suPHP and chmod all the users files to 0644 but that resulted in a 403 Forbidden page. I tried 0744 but this did the same thing.

    Here is the tail of the log..

    Code:
    [Fri Jun 06 11:23:47 2008] [warn] Directory "/home/****/public_html/pilot.gr/pilot_employees" is writeable by group
    [Fri Jun 06 11:23:56 2008] [warn] Directory "/home/****/public_html/pilot.gr/pilot_employees" is writeable by group
    [Fri Jun 06 11:24:17 2008] [warn] Directory "/home/****/public_html/pilot.gr/pilot_employees" is writeable by group
    [Fri Jun 06 11:24:20 2008] [info] Executing "/home/****/public_html/*********.com/chat/admin/logout.php" as UID 32015
    Interestingly, the file I was trying to execute didnt show up in the logs.

    The ownership/group of the files is set correctly.

    Thanks for your help so far guys
     
  9. ChrisRHS

    ChrisRHS Well-Known Member

    Joined:
    Jul 12, 2006
    Messages:
    292
    Likes Received:
    5
    Trophy Points:
    18
    Chmod the directory "/home/****/public_html/pilot.gr/pilot_employees" to 755.
     
  10. Dan_EZPZ

    Dan_EZPZ Member

    Joined:
    May 8, 2008
    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    1
    I got a reply back from the cPanel guys and apparently I had to chmod files to 644 and directories to 751.

    Though what I don't understand is which directories are supposed to be chmodded.

    I gave them a test site to play with to get working correctly but all files are either chmod 755 or 640 and the directories are 755.. Though it seems to work correctly using these settings?

    Confused!

    Cheers
     
  11. Dan_EZPZ

    Dan_EZPZ Member

    Joined:
    May 8, 2008
    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    1
    Also, if I have to do this in all users directories...

    How are my clients that don't have SSH going to get on? Will any new files have the correct permissions or will they still be owned by 'nobody'.
     
  12. 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
    New files, including those created by PHP scripts, will have proper permissions.
     
  13. Dan_EZPZ

    Dan_EZPZ Member

    Joined:
    May 8, 2008
    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    1
    Thanks guys - Everything seems to be working fine now :)
     
Loading...

Share This Page