Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save deanoakley/f4bcfe047c9798b1e667223a7d5dd839 to your computer and use it in GitHub Desktop.

Select an option

Save deanoakley/f4bcfe047c9798b1e667223a7d5dd839 to your computer and use it in GitHub Desktop.
Serverpilot disable display php errors server-wide
# Disable display_errors for all PHP versions on ServerPilot
# This script appends 'display_errors = false' to each version's php.ini
# and restarts the corresponding PHP-FPM services.
# Run the full block as a single command to apply changes in one go:
#
# bash <(curl -s https://gist.githubusercontent.com/yourname/gistid/raw/disable-display-errors-serverpilot.sh)
#
# Useful for production environments to suppress PHP error output in the browser.
# Append 'display_errors = false' to each PHP version's ini file
echo 'display_errors = false' | sudo tee --append /etc/php7.4-sp/php.ini &&
echo 'display_errors = false' | sudo tee --append /etc/php8.0-sp/php.ini &&
echo 'display_errors = false' | sudo tee --append /etc/php8.1-sp/php.ini &&
echo 'display_errors = false' | sudo tee --append /etc/php8.2-sp/php.ini &&
echo 'display_errors = false' | sudo tee --append /etc/php8.3-sp/php.ini &&
echo 'display_errors = false' | sudo tee --append /etc/php8.4-sp/php.ini &&
# Restart each PHP-FPM service to apply the changes
sudo service php7.4-fpm-sp restart &&
sudo service php8.0-fpm-sp restart &&
sudo service php8.1-fpm-sp restart &&
sudo service php8.2-fpm-sp restart &&
sudo service php8.3-fpm-sp restart &&
sudo service php8.4-fpm-sp restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment