Displaying detailed PHP errors

Discussion in 'PHP' started by Lotos1, Feb 25, 2010.

  1. #1
    I'm testing some php files on my development server and when there is an error I get: HTTP Error 500.0 - Internal Server Error
    The page cannot be displayed because an internal server error has occurred.
    It does not tell me any details like what line of the file is causing the error. How can I get this to show up? I'm running it on IIS 7 on Vista. I installed PHP in C:\Program Files\PHP and this is the location from where IIS is getting the php-cgi.exe file. I checked the php.ini file inside C:\Program Files\PHP and
    error_reporting = E_ALL & E_STRICT
    display_errors = On
    display_startup_errors = On
    What else do I need to check or change to start seeing detailed error messages?
     
    Lotos1, Feb 25, 2010 IP
  2. bartolay13

    bartolay13 Active Member

    Messages:
    735
    Likes Received:
    14
    Best Answers:
    1
    Trophy Points:
    98
    #2
    do you have .htaccess or .passwrd file?
     
    bartolay13, Feb 26, 2010 IP
  3. HuggyStudios

    HuggyStudios Well-Known Member

    Messages:
    724
    Likes Received:
    20
    Best Answers:
    26
    Trophy Points:
    165
    #3
    That is the correct setting I think, what errors are you looking out for?
     
    HuggyStudios, Feb 26, 2010 IP
  4. Lotos1

    Lotos1 Peon

    Messages:
    454
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #4
    My php.ini file seems to have no effect on the configuration settings and I found this out because when I ran phpinfo, display errors is turned off and in my php.ini file it's set to on. There is something wrong with either my php.ini file or for some reason PHP is ignoring it and loading it's default settings.
     
    Lotos1, Feb 26, 2010 IP
  5. HostingProvider

    HostingProvider Active Member

    Messages:
    1,480
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    95
    #5
    Check the error_log file. It should contain a line explaining the reasons why Apache generated an Internal Server Error. Most popular reasons are permissions (in Linux) and .htaccess misconfiguration (to check it, rename .htaccess to something else and try again.)

    Best of luck!
     
    HostingProvider, Feb 26, 2010 IP
  6. Lotos1

    Lotos1 Peon

    Messages:
    454
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #6
    I'm not using Apache but IIS 7 with Vista.
     
    Lotos1, Feb 26, 2010 IP
  7. HostingProvider

    HostingProvider Active Member

    Messages:
    1,480
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    95
    #7
    Sorry, my bad, Just in case it helps you:
    http://mvolo.com/blogs/serverside/archive/2007/07/26/Troubleshoot-IIS7-errors-like-a-pro.aspx
    (the author explains how to enable detailed error reporting on IIS 7 at the end of the article)

    Anyway, I thought Vista also included a permissions structure similar to Linux's (from what I've heard). If it does, have you tried to give the PHP file full permissions?

    http://social.technet.microsoft.com...y/thread/fe6fc533-8688-4faf-848c-ba98cd6d6ec0
     
    HostingProvider, Feb 26, 2010 IP
  8. Lotos1

    Lotos1 Peon

    Messages:
    454
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Yes, the system and I have full access permissions to the php.ini file. Even when I remove the php.ini file from C:\Program Files\PHP\ nothing changes in the phpinfo() output. It still uses the same local and master values which tells me that something is completely ignoring the php.ini file.
     
    Lotos1, Feb 26, 2010 IP
  9. JEET

    JEET Notable Member

    Messages:
    3,832
    Likes Received:
    502
    Best Answers:
    19
    Trophy Points:
    265
    #9
    I think the problem is because the php is running as cgi. I don't know much about cgi, but I think cgi throws a 500 error in case of script errors.
    You must log your php errors in a file, and check that file. the last error should be the one causing the problem.
    Thanks :)
     
    JEET, Feb 26, 2010 IP
  10. Mail Propeller

    Mail Propeller Peon

    Messages:
    44
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #10
    bartolay is right. It could be an .htaccess issue or other server configuration issue. Are you able to hit other pages? If you save:
    <?php
    echo "hello world";
    ?>
    to a test.php file does it display properly?
     
    Mail Propeller, Feb 26, 2010 IP