display_errors writes an error into the output, the HTML page on a web server. log_errors writes it to the file named by error_log; with none set, the CLI uses standard error and Apache 129 its error log (Logs and LogFormat). Ubuntu 225 installs php.ini-production for every SAPI, the CLI included, so this chapter's messages read PHP Warning: on standard error: the log format.
cat > total.php <<'PHP'
<?php
$total = 3 * $price;
echo "total: $total\n";
PHP
php total.php # Ubuntu's CLI php.ini: production values
php -d display_errors=1 -d log_errors=0 total.php # development: shown in the output
php -d error_log="$PWD/logs/php-errors.log" total.php # production: into a log file
cat logs/php-errors.logPHP Warning: Undefined variable $price in /home/dev/shop/total.php on line 2 total: 0 Warning: Undefined variable $price in /home/dev/shop/total.php on line 2 total: 0 total: 0 [23-Sep-2026 08:11:07 UTC] PHP Warning: Undefined variable $price in /home/dev/shop/total.php on line 2
The development template sets error_reporting = E_ALL, display_errors = On and zend.exception_ignore_args = Off; production sets E_ALL & ~E_DEPRECATED, Off and On, and both log. Never display errors in production, where a path or SQL fragment maps the server for an attacker. Set error_log per FPM pool (FPM Pools) and rotate it (Log Rotation).