Our forum Area

Page 1 of 2 1 2 LastLast
Results 1 to 15 of 21

This is a discussion on Why does a simple phpinfo.php causes 500 internal server error on my new VPS? in the Dedicated and Cloud Servers forum
Any idea why a simple php script will not work? ----- The server encountered an internal error or misconfiguration and was unable to complete your ...

  1. #1
    Loyal Client
    Join Date
    Feb 2008
    Posts
    14

    Why does a simple phpinfo.php causes 500 internal server error on my new VPS?

    Any idea why a simple php script will not work?

    -----

    The server encountered an internal error or misconfiguration and was unable to complete your request.

    Please contact the server administrator, REMOVED and inform them of the time the error occurred, and anything you might have done that may have caused the error.

    More information about this error may be available in the server error log.

    Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request

    -----
    It just basic stuff...

    Code:
    <?PHP
    phpinfo();
    ?>
    Code:
    <?php
    echo "Hi";
    ?>
    Last edited by mattsiegman; 02-06-2008 at 08:28 AM. Reason: user request

  2. #2
    I didn't do it! Daniel_DBS's Avatar
    Join Date
    Aug 2007
    Location
    Mars
    Posts
    1,196
    File permissions...

    Most likely they setup PHP as CGI or suPHP...

    No directories are permitted to have permissions over 755 and no script over 644
    -Daniel

    If the automobile had followed the same development cycle as the computer, a Rolls-Royce today would cost $100, get a million miles to the gallon, and explode once every few weeks.

    My scripts never have bugs. They just develop random features.

  3. #3
    Loyal Client
    Join Date
    Feb 2008
    Location
    Spotsy, Va.
    Posts
    50
    According to winscp and by default my vps is set to...

    public_html 0750
    folders 0755
    files 0644 html & php

    So why wouldn't a simple little script like those run?
    Regards
    William

    ImpressCms.org

  4. #4
    Loyal Client
    Join Date
    Feb 2008
    Location
    Spotsy, Va.
    Posts
    50
    My php setup is suPHP
    Regards
    William

    ImpressCms.org

  5. #5
    Loyal Client
    Join Date
    Feb 2008
    Posts
    14
    Darn I cannot edit my post above. Can a mod or staff take my email addy out of the post?

    Side Note: I switched my uname here on the forum to William. Sorry for the inconvenience.
    Last edited by underdog; 02-06-2008 at 06:27 AM. Reason: Needed to add more info

  6. #6
    I didn't do it! Daniel_DBS's Avatar
    Join Date
    Aug 2007
    Location
    Mars
    Posts
    1,196
    Hmmm strange that it still would not work...

    Have you tried, just for the heck of it, to go to WHM to 'Configure PHP and SuExec' and then change the handler to cgi instead of suPHP?

    If not, try that just to see if the phpinfo() works... If it doesn't then there is some other issue... If it does, then it is just a restriction from suPHP
    -Daniel

    If the automobile had followed the same development cycle as the computer, a Rolls-Royce today would cost $100, get a million miles to the gallon, and explode once every few weeks.

    My scripts never have bugs. They just develop random features.

  7. #7
    Loyal Client
    Join Date
    Feb 2008
    Location
    Spotsy, Va.
    Posts
    50
    Thanks for the suggestion...

    I went ahead a switched to cgi...
    Default PHP Version (.php files) 5
    PHP 5 Handler cgi
    PHP 4 Handler none
    Suexec on

    Still no dice...
    Regards
    William

    ImpressCms.org

  8. #8
    Loyal Client
    Join Date
    Feb 2008
    Location
    Spotsy, Va.
    Posts
    50
    I went ahead a switched back to suPHP and submitted a ticket.
    Regards
    William

    ImpressCms.org

  9. #9
    Loyal Client
    Join Date
    Sep 2001
    Location
    Wichita, KS
    Posts
    1,523
    Quote Originally Posted by Daniel_DBS View Post
    File permissions...

    Most likely they setup PHP as CGI or suPHP...

    No directories are permitted to have permissions over 755 and no script over 644
    Really? In all my experience with Perl as CGI, I've never seen it work that way. Normally, a CGI script has to CHMODDED to 755, as it requires the execute permission to be set. Directories also are normally 755 because the permission work a little different and the execute bit chages to an 'allow listing' bit.

  10. #10
    CTO JPC-Masood's Avatar
    Join Date
    Aug 2002
    Location
    Jaguar Servers
    Posts
    1,968
    Please login to your vps via ssh and change the directory to the folder where this script is residing and issue this command:

    ls -l

    and post the result here.
    [COLOR="DarkRed"]Masood N. [/COLOR] | [COLOR="Red"]Chief Technical Officer[/COLOR][SIZE="3"] JaguarPC.com[/SIZE]

  11. #11
    Community Leader jason's Avatar
    Join Date
    Sep 2001
    Location
    Rochester, NY
    Posts
    5,884
    Quote Originally Posted by mattsiegman View Post
    Really? In all my experience with Perl as CGI, I've never seen it work that way. Normally, a CGI script has to CHMODDED to 755, as it requires the execute permission to be set. Directories also are normally 755 because the permission work a little different and the execute bit chages to an 'allow listing' bit.
    PHP is a bit different. Perl scripts are executed directly by the OS--that is Apache tries to execute the script directly, the OS sees the file is executable, it looks at the first line to find out how to execute it, and then it executes it. With PHP all valid extensions for PHP scripts (ie .php, .php4, .php5, etc.) are mapped to an appropriate processor (the PHP interpreter). When a request is received, Apache runs that processor passing it the path to the requested script, the processor then opens the file and runs it (similar to runing a script from the command line using "perl myscript.pl" or "sh myscript.sh"). Since PHP scripts are not executed directly by the OS they do not need to be executable.

    It is possible to run a PHP script "perl style," but this is very rarely done over the web (those I've seen it used for shell scripts a few times):

    PHP Code:
    #!/usr/local/bin/php
    <?php phpinfo(); ?>
    In this case the file would need an extension such as .cgi (so that it isn't invoked the normal way) and would need execute permissions. The OS would then be able to run the script directly.

    I haven't tried it, but I bet you could set up suPHP to run perl scripts the same way as it handles PHP. It isn't necessary though because suExec is already available to give the same benefits.

    --Jason
    Jason Pitoniak
    Interbrite Communications
    www.interbrite.com www.kodiakskorner.com

  12. #12
    Community Leader jason's Avatar
    Join Date
    Sep 2001
    Location
    Rochester, NY
    Posts
    5,884
    @William/underdog: Have you looked at your error log in cPanel? That should give you some clue as to why the error is appearing.

    --Jason
    Jason Pitoniak
    Interbrite Communications
    www.interbrite.com www.kodiakskorner.com

  13. #13
    was loyal client until...
    Join Date
    Mar 2002
    Posts
    161
    Hmmm. According to the upgrade schedule my server is to be upgraded today. I'm getting that same error on my php pages now so perhaps the upgrade is not going too smoothly?

  14. #14
    CTO JPC-Masood's Avatar
    Join Date
    Aug 2002
    Location
    Jaguar Servers
    Posts
    1,968
    Quote Originally Posted by shwn View Post
    Hmmm. According to the upgrade schedule my server is to be upgraded today. I'm getting that same error on my php pages now so perhaps the upgrade is not going too smoothly?
    Which server?
    [COLOR="DarkRed"]Masood N. [/COLOR] | [COLOR="Red"]Chief Technical Officer[/COLOR][SIZE="3"] JaguarPC.com[/SIZE]

  15. #15
    was loyal client until...
    Join Date
    Mar 2002
    Posts
    161
    saturn

    Two types of errors being reported in cPanel:

    Premature end of script headers
    file has no execute permission

    Do I need to change something?
    Last edited by shwn; 02-06-2008 at 10:50 AM.

Page 1 of 2 1 2 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •