displayerrors
Show or set PHP's
display_errorsvalue in every php.ini on the server
- Command:
/go/displayerrors - Category: PHP
- Required option: None
- Output: A confirmation message, or the current value with
return - Last updated: 2026-11-20
On this page: Overview · Quick start · Syntax · Arguments · Output · Examples · Troubleshooting · Details · See also
Overview
/go/displayerrors controls PHP's display_errors setting, which decides whether PHP prints errors and warnings in the page or the command output. It writes the value into every php.ini it finds, for all installed PHP versions, and then schedules a PHP-FPM reload so the change takes effect.
The command sets a value. It does not flip the setting back and forth. With no value it always sets On.
[!WARNING] With
display_errorson, PHP can show file paths, database details, and other sensitive information to visitors. Leave itOffon live websites, and read errors from the PHP error log instead.
Quick start
# Show the current value
/go/displayerrors return
# Turn it off (recommended for live sites)
/go/displayerrors Off
# Turn it on
/go/displayerrors On
Syntax
# Show the current value
/go/displayerrors return
# Set the value
/go/displayerrors <value>
# Turn it on
/go/displayerrors
Run the command as root.
Arguments
| Argument | Required | Notes |
|---|---|---|
return |
No | Prints the current value and changes nothing. Not case-sensitive. |
<value> |
No | The value to write, usually On or Off. PHP also accepts values such as 1, 0, stdout, and stderr. The value is not checked. |
| (none) | No | Sets On. |
If the first argument starts with --, it is ignored and the value is set to On.
Pass only the value. The command writes all of its arguments into php.ini, so extra words such as Off --progress end up in the file.
Output
Display Errors updated successfully.
The message is printed after the files have been processed, even if no php.ini was found.
With return, the command prints the current value, for example Off, and exits with status 1, even though nothing went wrong. A blank line means no value is set.
| Message | Meaning |
|---|---|
Display Errors updated successfully. |
The run finished. |
Unknown operating system. |
The OS is not AlmaLinux, Rocky, CentOS, Red Hat, Fedora, Debian, or Ubuntu. Nothing is changed. |
Examples
# Check, change, and check again
/go/displayerrors return
/go/displayerrors Off
/go/displayerrors return
# Check the value that PHP on the command line is using
php -r 'echo ini_get("display_errors"), PHP_EOL;'
# Compare the value in every php.ini
sudo grep -H '^display_errors' /etc/php.ini /etc/opt/remi/*/php.ini 2>/dev/null
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
Errors are still shown after setting Off |
The PHP-FPM reload runs about a minute later. On servers using mod_php, the web server is not reloaded by it. |
Wait a minute. On mod_php servers, run reload. |
| Errors are still shown after the reload | The site overrides the setting with ini_set, a .user.ini file, a php_flag line in .htaccess, or a setting in its PHP-FPM pool. |
Remove the override in the site. |
php.ini contains display_errors = Off --progress |
An extra argument was passed after the value. | Run the command again with only the value. |
Display Errors updated successfully. but nothing changed |
No php.ini file was found. |
Check that PHP is installed and look for the files with the grep example above. |
atq: command not found |
The at package is missing. |
Install it with your package manager, or run fpm yourself. disablefunctions installs it automatically. |
Permission denied |
The command was not run as root. | Run it as root. |
return prints an empty line |
The first php.ini found has no display_errors line. |
Check every file with the grep example above. |
Unknown operating system. |
The OS is not supported. | Edit php.ini by hand. |
Details
Files it changes
| Operating system | Files |
|---|---|
| AlmaLinux, Rocky, CentOS, Red Hat, Fedora | /etc/php.ini and /etc/opt/remi/<version>/php.ini for each version found. |
| Debian, Ubuntu | /etc/php/<version>/fpm/php.ini, cli/php.ini, and apache2/php.ini for each version found. |
Files that don't exist are skipped. The Debian and Ubuntu list includes the command-line (CLI) configuration, so command-line PHP scripts and cron jobs are affected too.
What it does
flowchart TD
A["displayerrors [return or value]"] --> B{"Supported OS?"}
B -- "No" --> X["Print Unknown operating system"]
B -- "Yes" --> C["Build the list of php.ini files"]
C --> D{"First argument is return?"}
D -- "Yes" --> E["Print the first value found, exit 1"]
D -- "No" --> F["For each php.ini: replace or add display_errors"]
F --> G["Print Display Errors updated successfully."]
G --> H{"Reload already scheduled?"}
H -- "No" --> I["Schedule fpm reload in 1 minute"]
H -- "Yes" --> J["Done"]
I --> J
- Appends the call to
/var/log/go/displayerrors.log. - Builds the list of
php.inifiles for the OS. - With
return, prints the value from the first file that exists, and stops. - Otherwise, in each existing file, replaces the
display_errors =line with the new value. If the file has no such line, it adds one at the end. A commented-out line (starting with;) is left alone, and a new line is added. - Prints the confirmation.
- Schedules
/go/fpm reloadto run one minute later, unless a reload is already waiting in theatqueue.
Side effects
- The value is written to every file with no backup.
- The reload is delayed by about a minute, and a second run within that minute doesn't schedule another one.
- Lines are added to files that lack the setting without
sudo, so the command must run as root. - The scheduling step needs the
atpackage, which this command does not install.
See also
| Command | Description |
|---|---|
displaystartuperrors |
Show or set PHP's display_startup_errors value (default Off) in every php.ini on the server |
errorreporting |
Read or set PHP error_reporting across all php.ini files |
disablefunctions |
Show, set, or clear PHP's disable_functions setting in every php.ini on the server |
checkphpini |
Scan every php.ini for startup errors and remove the offending line |
fpm |
Restart all installed PHP-FPM versions on your server |
reload |
Reload PHP-FPM and the active web server |