note 126734 added to errorfunc.configuration
| From: | iio7 at protonmail dot com | Date: | Fri, 31 Dec 2021 21:52:21 +0000 |
| Subject: | note 126734 added to errorfunc.configuration | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-217448@lists.php.net to get a copy of this message | ||
It's important to note that when display_errors is "on", PHP will send a HTTP 200 OK
status code even when there is an error. This is not a mistake or a wrong behavior, but is because
you're asking PHP to output normal HTML, i.e. the error message, to the browser.
When display_errors is set to "off", PHP will send a HTTP 500 Internal Server Error, and
let the web server handle it from there. If the web server is setup to intercept FastCGI errors (in
case of NGINX), it will display the 500 error page it has setup. If the web server cannot intercept
FastCGI errors, or it isn't setup to do it, an empty screen will be displayed in the browser
(the famous white screen of death).
If you need a custom error page but cannot intercept PHP errors on the web server you're using,
you can use PHPs custom error and exception handling mechanism. If you combine that with output
buffering you can prevent any output to reach the client before the error/exception occurs. Just
remember that parse errors are compile time errors that cannot be handled by a custom handler, use
"php -l foo.php" from the terminal to check for parse errors before putting your files on
production.
----
Server IP: 45.112.84.4
Probable Submitter: 80.90.5.135 (proxied: 185.65.134.232)
----
Manual Page -- https://php.net/manual/en/errorfunc.configuration.php
Edit -- https://main.php.net/note/edit/126734
Del: integrated -- https://main.php.net/note/delete/126734/integrated
Del: useless -- https://main.php.net/note/delete/126734/useless
Del: bad code -- https://main.php.net/note/delete/126734/bad+code
Del: spam -- https://main.php.net/note/delete/126734/spam
Del: non-english -- https://main.php.net/note/delete/126734/non-english
Del: in docs -- https://main.php.net/note/delete/126734/in+docs
Del: other reasons-- https://main.php.net/note/delete/126734
Reject -- https://main.php.net/note/reject/126734
Search -- https://main.php.net/manage/user-notes.php