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

Author

Programster

Stuart is a software developer with a passion for Linux and open source projects.

comments powered by Disqus
We are a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for us to earn fees by linking to Amazon.com and affiliated sites. More info.