PHP-FPM - Show/Hide Errors
Turning on the display of errors with PHP-FPM is as easy as switching display_errors from Off
to On
in the /etc/php/7.0/fpm/php.ini
file. To make life easier, you can copy/execute the following scripts to do this for you.
Display Errors (Dev)
SEARCH="display_errors = Off"
REPLACE="display_errors = On"
FILEPATH="/etc/php/7.0/fpm/php.ini"
sudo sed -i "s;$SEARCH;$REPLACE;" $FILEPATH
sudo systemctl restart php7.0-fpm
Hide Errors (Production)
SEARCH="display_errors = On"
REPLACE="display_errors = Off"
FILEPATH="/etc/php/7.0/fpm/php.ini"
sudo sed -i "s;$SEARCH;$REPLACE;" $FILEPATH
sudo systemctl restart php7.0-fpm
Last updated: 26th February 2021
First published: 16th August 2018
First published: 16th August 2018