Error Log Fills Up Disk
The server's main stderr.log
is growing very fast and is filling up the disk space rapidly, like so:
34G /var/log/apache2/stderr.log.2019_01_07 6.1G /var/log/apache2/stderr.log.2019_01_07.01 6.3G /var/log/apache2/stderr.log.2019_01_07.02 6.0G /var/log/apache2/stderr.log.2019_01_07.03 5.7G /var/log/apache2/stderr.log.2019_01_07.04 6.2G /var/log/apache2/stderr.log.2019_01_08 6.0G /var/log/apache2/stderr.log.2019_01_08.01 6.2G /var/log/apache2/stderr.log.2019_01_08.02 6.2G /var/log/apache2/stderr.log.2019_01_08.03 36G /var/log/apache2/stderr.log.2019_01_08.04 6.2G /var/log/apache2/stderr.log.2019_01_08.05 5.8G /var/log/apache2/stderr.log.2019_01_08.06 5.9G /var/log/apache2/stderr.log.2019_01_09
When you check the contents of stderr.log
you see many PHP warning messages:
PHP Warning: next() expects parameter 1 to be array, null given in /home// /wp-includes/class-wp-hook.php on line 291 PHP Warning: current() expects parameter 1 to be array, null given in /home// /wp-includes/class-wp-hook.php on line 275 PHP Warning: Invalid argument supplied for foreach() in /home// /wp-includes/class-wp-hook.php on line 277 PHP Warning: next() expects parameter 1 to be array, null given in /home// /wp-includes/class-wp-hook.php on line 291
The warnings are from different shared hosting users but all are logged to the main server stderr.log
log.
We believe the excessive logging is due to a PHP change. The PHP engine generates a lot of error/warning messages. So, how do you stop this?
Upgrade and Disable Entirely
Upgrade to the latest LSWS build (version 5.3.5 or above), navigate to LSWS Admin Panel > Server > Log and set Enable stderr Log to No
. This should stop writing error output to stderr.log
.
Disable only for PHP
If you only want to stop PHP-related error reporting in stderr.log
, you can leave Enable stderr Log set to Yes
, and then add a special environment variable to LSPHP external application configuration:
LSAPI_STDERR_LOG=/dev/null
This will discard PHP-generated warning messages.