Programster's Blog

Tutorials focusing on Linux, programming, and open-source

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

This blog is created by Stuart Page

I'm a freelance web developer and technology consultant based in Surrey, UK, with over 10 years experience in web development, DevOps, Linux Administration, and IT solutions.

Need support with your infrastructure or web services?

Get in touch