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.

PHPSuexec Problem

Discussion in 'General Discussion' started by webdave, Jan 29, 2004.

  1. webdave

    webdave Active Member

    Joined:
    Jul 4, 2002
    Messages:
    25
    Likes Received:
    0
    Trophy Points:
    1
    I just installed PHPSuexec the other night. One of my clients is having problems with his PHP script. I have verified the file is chmoded 755 and he is the owner. When we run script we get a internal server error 500. The only problem is that for some reason the script does not have a .php extension, in fact it does not have any extension. Could this be causing the problem?

    I am waiting for some more details from the client but the script is an auctiion type script.
     
  2. haze

    haze Well-Known Member

    Joined:
    Dec 21, 2001
    Messages:
    1,550
    Likes Received:
    3
    Trophy Points:
    38
    tail -f /usr/local/apache/logs/error_log
    then load the script and see what errors are coming up.

    Have you run /scripts/fixsuexecscripts ?
    You may also need to run /scripts/enablefileprotect
     
  3. webdave

    webdave Active Member

    Joined:
    Jul 4, 2002
    Messages:
    25
    Likes Received:
    0
    Trophy Points:
    1
    This is the error:

    Premature end of script headers: /home/XXXXXXX/public_html/de/go
     
  4. haze

    haze Well-Known Member

    Joined:
    Dec 21, 2001
    Messages:
    1,550
    Likes Received:
    3
    Trophy Points:
    38
    1. That can't be the full message, looks like its missing file extension, ie. go.php

    2. Have you run /scripts/fixsuexeccgiscripts ? Might be a good idea to set that up in cron every 10 minutes for a while.

    3. Does the user have any modifications to php values or anything php in .htaccess? If so, they need to be moved to a php.ini file.
     
  5. webdave

    webdave Active Member

    Joined:
    Jul 4, 2002
    Messages:
    25
    Likes Received:
    0
    Trophy Points:
    1
    He has this in his .htaccess

    <Files browse>
    ForceType application/x-httpd-php
    </Files>
    <Files go>
    ForceType application/x-httpd-php
    </Files>
    <Files go2>
    ForceType application/x-httpd-php
    </Files>
    <Files go3>
    ForceType application/x-httpd-php
    </Files>

    browse, go, go2, and go3 look like they are all php scripts. How can I fix this without him having to update his scripts?
     
  6. haze

    haze Well-Known Member

    Joined:
    Dec 21, 2001
    Messages:
    1,550
    Likes Received:
    3
    Trophy Points:
    38
    It doesn't look like phpsuexec is recognizing those as php files. What he might need to do is add the following at the very top of each file:

    #!/usr/bin/php
     
  7. myusername

    myusername Well-Known Member
    PartnerNOC

    Joined:
    Mar 6, 2003
    Messages:
    691
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    chown -R us.*yourbase*
    cPanel Access Level:
    DataCenter Provider
    Twitter:
    What the user is trying to do is have search engine friendly urls. Meaning he wants a file called "index" to execute as php.

    I tried adding the php shebang suggested above and that just presented more errors.

    Here is an example .htaccess file.

    Code:
    <Files index>
       ForceType application/x-httpd-php
    </Files>
    <Files edit>
       ForceType application/x-httpd-php
    </Files>
    <Files display>
       ForceType application/x-httpd-php
    </Files>
    <Files list>
       ForceType application/x-httpd-php
    </Files>
    <Files calendar>
       ForceType application/x-httpd-php
    </Files>
    
    DirectoryIndex index.htm index.html index.php index
    ErrorDocument 404 /index/help/page_not_found
    PHP Suexec does not seem to like ForceType, at least the way I have it above.

    Perhaps mod rewrite would be needed to make this work with PHP SUexec? Just when I thought I had every quirk in PHP Suexec down pat...
     
  8. Faldran

    Faldran Well-Known Member

    Joined:
    May 28, 2002
    Messages:
    136
    Likes Received:
    0
    Trophy Points:
    16
    Yeah, forcetype does not work in php+suexec, best suggestion is to use mod_rewrite to do it.
     
  9. jdonoso

    jdonoso Well-Known Member

    Joined:
    Nov 15, 2004
    Messages:
    61
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    The Third Rock from The Sun!
    Bless your inmortal soul. I was experiencing the same problem "Premature end of script headers", in a php script (I have phpsuexec enable. Running both scripts fixed the problem. Thank you, Thank you! :)

    Best,
     
  10. kahoz

    kahoz Well-Known Member

    Joined:
    Nov 7, 2003
    Messages:
    78
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Portugal
    how can i do it ?

    Code:
    <Files "*.php">
        ForceType application/x-httpd-php5
    </Files>
    instead of application/x-httpd-php (php4)
     
    #10 kahoz, May 19, 2005
    Last edited: May 19, 2005
  11. jols

    jols Well-Known Member

    Joined:
    Mar 13, 2004
    Messages:
    1,111
    Likes Received:
    2
    Trophy Points:
    38
    Yes, but how exactly?
     
  12. Zion Ahead

    Zion Ahead Well-Known Member

    Joined:
    Nov 10, 2006
    Messages:
    347
    Likes Received:
    0
    Trophy Points:
    16
    Same problem here and rewrite module is checked in apache update

    apache error logs:

    [Sun Jan 21 16:16:06 2007] [error] [client xxx.96.77.143] Premature end of script headers: /home/coopera/public_html/client/index.php
    [Sun Jan 21 16:16:06 2007] [error] [client xxx.96.77.143] File does not exist: /home/coopera/public_html/client/500.shtml
    [Sun Jan 21 16:17:59 2007] [error] [client xxx.96.77.143] File does not exist: /home/coopera/public_html/client/cpanl
    [Sun Jan 21 16:17:59 2007] [error] [client xxx.96.77.143] File does not exist: /home/coopera/public_html/client/404.shtml
     
  13. nickp666

    nickp666 Well-Known Member

    Joined:
    Jan 28, 2005
    Messages:
    770
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    /dev/null
    this is how you do it with suexec:

    <FilesMatch "^filenamewithoutextension$">
    SetHandler application/x-httpd-php
    </FilesMatch>

    where 'filenamewithoutextension' is the name of the file, works for both php4 and php5
     
Loading...

Share This Page