GoAdmio

errorreporting

Read or set PHP's error_reporting directive across every installed PHP version, then reload PHP-FPM a minute later

On this page: Overview · Quick start · Syntax · Options · Output · Examples · Troubleshooting · Details · See also


Overview

/go/errorreporting sets PHP's error_reporting directive in every php.ini file on the server — one setting, applied to every installed PHP version at once, for FPM, CLI, and (on Debian and Ubuntu) Apache's mod_php. It can also read back the current value.

A reload of PHP-FPM is scheduled for about a minute later, so new PHP requests don't need a separate restart command.

The call is appended to /var/log/go/errorreporting.log.


Quick start

# Show errors and warnings, but not notices or deprecations
/go/errorreporting "E_ALL & ~E_NOTICE & ~E_DEPRECATED"

# Check the current value
/go/errorreporting return

Syntax

/go/errorreporting
/go/errorreporting return
/go/errorreporting <value>
Form Behavior
/go/errorreporting Sets error_reporting to 5 (E_ERROR | E_PARSE) everywhere.
/go/errorreporting return Prints the current value from the first php.ini found, and exits. Case-insensitive.
/go/errorreporting <value> Sets error_reporting to <value> everywhere. Pass it as one quoted argument; see the warning below.

[!WARNING] Pass the value as a single, quoted argument: /go/errorreporting "E_ALL & ~E_DEPRECATED". An unquoted value containing spaces is read as several separate arguments and the command fails or misbehaves. See Known issues.

An argument starting with -- is treated the same as no argument at all: it sets 5 and the flag itself is silently ignored. There is no --help.


Options

Argument Notes
(none) Sets the default, 5.
return Reads instead of writes. Not case-sensitive (RETURN, Return also work).
<value> Any value PHP's error_reporting accepts: a plain integer (5), or a named expression (E_ALL & ~E_DEPRECATED & ~E_STRICT). Not validated.

Output

Outcome Output
Value set Error Reporting updated successfully.
return The current value (may be empty if not set in that file)

The confirmation message prints even if no php.ini file was found or none was changed.


Examples

# Production: hide notices and deprecation warnings, keep errors visible
/go/errorreporting "E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT"
# Development: show everything
/go/errorreporting "E_ALL"
# Reset to the default (errors and parse errors only)
/go/errorreporting
# Check the current value
/go/errorreporting return

Troubleshooting

Symptom Likely cause Fix
New value doesn't show up in phpinfo() right away PHP-FPM reloads about a minute later, not immediately. Wait, or run fpm yourself.
return prints an empty line No error_reporting line exists in the first php.ini the command checked. Set a value first, or check a specific file yourself.
return doesn't match what a site actually uses It reads only the first php.ini file found, which may not be the PHP version that domain runs. Check the specific version's file, or multiphp for which version a domain uses.
A value with & or spaces fails, or runs an unexpected command The value was passed unquoted. Quote it: "E_ALL & ~E_NOTICE".
Passing --something has no visible effect Arguments starting with -- are silently treated as no value, and reset to 5. Don't start the value with --; quote it if it must.
cd: /etc/opt/remi: No such file or directory printed on a RHEL-family server No PHP version is installed yet under /etc/opt/remi. Install a PHP version with installphp first.

Details

Files updated

System Files
RHEL family /etc/php.ini, plus /etc/opt/remi/<version>/php.ini for every installed version
Debian, Ubuntu /etc/php.ini, plus /etc/php/<version>/fpm/php.ini, cli/php.ini, and apache2/php.ini for every installed version

Only files that exist are changed. In each one, an existing error_reporting = ... line is replaced; otherwise the setting is appended to the end of the file.

Default value

With no argument, the value is 5, equal to E_ERROR | E_PARSE: only fatal and parse errors are shown.

Known issues


See also

Command Description
fpm Restart all installed PHP-FPM versions on your server
displayerrors Toggle PHP display_errors across all php.ini files
displaystartuperrors Toggle PHP display_startup_errors across all php.ini files
memorylimit Change the PHP memory limit for all PHP versions
maxexecutiontime Change the max execution time for all PHP versions
multiphp Manage PHP versions per domain
installphp Install a different PHP version on GoAdmio