Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy does display_errors change the HTTP status code?
    text
    copied!<p>As pointed out in many other questions, turning display_errors to Off in php.ini makes the web server answer with status code 500 Internal server error instead of 200 OK when encountering a fatal error. I set up a simple test with an undefined function to explain the behaviour:</p> <p>php.ini</p> <pre><code>display_errors = On </code></pre> <p>index.php</p> <pre><code>&lt;?php test(); </code></pre> <p>Gives:</p> <pre><code>Fatal error: Call to undefined function test() in D:\xampp\htdocs\index.php on line 1 </code></pre> <p>or just a blank page if i silence the function call like this:</p> <pre><code>&lt;?php @test(); </code></pre> <p>In both cases answer headers are as following:</p> <pre><code>HTTP/1.1 200 OK Date: Tue, 10 Jul 2012 20:08:22 GMT Server: Apache/2.2.21 (Win32) mod_ssl/2.2.21 OpenSSL/1.0.0e PHP/5.3.8 mod_perl/2.0.4 Perl/v5.10.1 X-Powered-By: PHP/5.3.8 Content-Length: 0 Keep-Alive: timeout=5, max=100 Connection: Keep-Alive Content-Type: text/html </code></pre> <p>While changing php.ini to:</p> <pre><code>display_errors = Off </code></pre> <p>Causes:</p> <pre><code>HTTP/1.0 500 Internal Server Error Date: Tue, 10 Jul 2012 20:10:35 GMT Server: Apache/2.2.21 (Win32) mod_ssl/2.2.21 OpenSSL/1.0.0e PHP/5.3.8 mod_perl/2.0.4 Perl/v5.10.1 X-Powered-By: PHP/5.3.8 Content-Length: 0 Connection: close Content-Type: text/html </code></pre> <p>Can anybody explain me the underlaying mechanism that makes the web server answer with 500 when display_errors is Off?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload