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/php build with suphp

Discussion in 'EasyApache' started by betoranaldi, Dec 22, 2007.

  1. betoranaldi

    betoranaldi Well-Known Member

    Joined:
    Dec 5, 2007
    Messages:
    105
    Likes Received:
    0
    Trophy Points:
    16
    So using easyapache3 complied installed this build.

    I went into WHM > Service Configuration > Configure PHP and SuExec

    I made sure that the PHP 5 Handler was set to suPHP.

    I keep on getting internal server errors when trying to access a php file so I looked in the error log and found a lot of "Premature end of script headers" errors"

    In doing some research I found the following FAQ http://www.suphp.org/FAQ.html

    "Why do my scripts not work and why do I get an "Premature end of script headers" in the error_log?
    You probably have installed the CLI version of PHP, but you need the CGI version. Copy the file /build/path/sapi/cgi/php to /where/ever/you/have/installed/bin/php to use the CGI version."

    My question is why would WHM automatically do this when i specifically compilied it to use suphp? How do I correct this issue?

    Thanks
    Brian
     
  2. nickp666

    nickp666 Well-Known Member

    Joined:
    Jan 28, 2005
    Messages:
    770
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    /dev/null
    that error message is worthless, there is a whole host of reasons why it would spit that out, have you just compiled suphp on a server that wasnt running php as cgi before?

    does php -v from the shell return the version numbers? (when I first ran ea3 on one of my servers, php refused to compile although ea3 didnt tell me, took a few attempts turning modules on and off, to get it to do it)
     
  3. betoranaldi

    betoranaldi Well-Known Member

    Joined:
    Dec 5, 2007
    Messages:
    105
    Likes Received:
    0
    Trophy Points:
    16
    This is my first time compiling suphp I have never done it before which might be the reason why I am having to so many problems.


    when I do php -v I get the following...

    PHP 5.2.5 (cli) (built: Dec 22 2007 23:36:28)
    Copyright (c) 1997-2007 The PHP Group
    Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies

    Which was the last time I tried to compile it. it looks like it did not compile as cgi

    Any ideas as to what I could do to get it to compile correctly?
     
  4. nickp666

    nickp666 Well-Known Member

    Joined:
    Jan 28, 2005
    Messages:
    770
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    /dev/null
    It is more than likely a permissions/ownership problem if this server has been running before without it, your scripts should be owned by user:user (where user is the accounts username, i suspect at present it is probably user:nobody) and should be chmod 0644
     
  5. betoranaldi

    betoranaldi Well-Known Member

    Joined:
    Dec 5, 2007
    Messages:
    105
    Likes Received:
    0
    Trophy Points:
    16
    This is driving me nuts.

    user permissions are correct. now when i get the internal server error a core files is created in the same directory as the php file i am trying to run.

    I just tried to install both php4 and php5. it was working until i restarted apache and not it throws a 500

    this is a brand new box so i am not worried about messing anything up. just would like the added security of running suphp.
     
  6. nickp666

    nickp666 Well-Known Member

    Joined:
    Jan 28, 2005
    Messages:
    770
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    /dev/null
    what does /usr/local/apache/logs/error_log say? still the 'premature end of script headers' ?
     
  7. betoranaldi

    betoranaldi Well-Known Member

    Joined:
    Dec 5, 2007
    Messages:
    105
    Likes Received:
    0
    Trophy Points:
    16
    First off, Nickp666, I want to thank you for putting in the time and responding to my post to figure this thing out.

    After an entire day of fooling around with it I think i am going to just give up. To sum up what I have figured out today...

    If i recompile apache/php and enable the php5 handler as suphp the server will server php files correctly. Although when pages do work, there seems to be a problem with freetype/gd since the captcha doesnt work although looking at phpinfo php was compiled with that option.

    Once I restart apache the server starts throwing internal server errors again. I checked the error log and the errors are still "Premature end of script headers" errors so it looks like its still the same problem, whatever it is.

    If I go back to WHM >> Service Configuration >> Configure PHP and SuExec and set up the php 5 handler to be dso, the pages start to serve again but the permission across the account is messed up, tmp doesn't all to be written two and files can't be read. this totally mucks up the CMS system I am using on the server and has to be reinstalled.

    If I go back into WHM >> Service Configuration >> Configure PHP and SuExec and set up the php 5 handler to be suphp, it throws 500s again. The only way to get it to work is to recompile apache/php and not restart apache.

    So I am officially giving up and going to rebuild my system, fresh, without trying to get suphp working. Maybe in the future this will be easier, I was just hoping to get it working before I transfer all of my clients to this new box.

    This might be for the better since I'm sure once I transfer the 10 or so clients suphp would mess up again with all of the existing files.

    Thanks again and happy holidays!

    -Brian
     
  8. cPanelNick

    cPanelNick Administrator
    Staff Member

    Joined:
    Mar 9, 2015
    Messages:
    3,426
    Likes Received:
    2
    Trophy Points:
    38
    cPanel Access Level:
    DataCenter Provider
    With suphp you cannot have php directives in the .htaccess files. Make sure to move them to a php.ini. If you are still stuck, feel free to put in a ticket at https://tickets.cpanel.net/submit/
     
Loading...

Share This Page