Last active
September 8, 2017 09:11
-
-
Save obriat/86f0e3b772bcf55e80aa2e01468f5b3a to your computer and use it in GitHub Desktop.
Error 500 handling with PHP-FPM
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Config Apache PHP-FPM | |
<FilesMatch \.php$> | |
SetHandler "proxy:fcgi://127.0.0.1:5555" | |
# Catch backend errors | |
ProxyErrorOverride On | |
# Return a custom error | |
ErrorDocument 500 "==== hoho =====" | |
</FilesMatch> | |
=============================================== | |
Fichier de test | |
<?php | |
/* | |
* @file | |
* 500.php | |
* Test page: trigerring error 500. | |
*/ | |
echo '<pre>'; | |
//error_reporting(E_ALL); | |
// If enable return a 200 page with printed errors. | |
//ini_set('display_errors', 1); | |
// Synthax Error | |
// thisisanerror | |
// exception | |
throw new Exception('Nooooooooooooooo!'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you want to catch errors on a frontend apache (with proxy pass) use this:
`
ProxyPass http://drupal-backend:80/
`