Apache 2 error log only shows the error message "0"

1.2k views Asked by At

Since a few days, my Apache 2 error log is showing a lot messages like the following (IP addresses and URIs redacted):

[Thu Dec 12 13:46:42 2013] [error] [client 111.222.333.444] 0
[Thu Dec 12 13:52:27 2013] [error] [client 222.333.444.555] 0, referer: http://www.mydomain.com/
[Thu Dec 12 13:52:27 2013] [error] [client 222.333.444.555] 0, referer: http://www.mydomain.com/
[Thu Dec 12 13:53:54 2013] [error] [client 333.444.555.666] 0, referer: http://www.mydomain.com/subdirectory/
[Thu Dec 12 13:46:42 2013] [error] [client 444.555.666.777] 0
[Thu Dec 12 13:54:07 2013] [error] [client aaaa:1111:2222:ffff::] 0, referer: http://www.otherdomain.com/subdirectory/

What is this 0? There are no other messages shown (besides sometimes some other, normal messages, but very rarely).

The IP addresses are both IPv4 and IPv6. I checked the access log for the same date/time and IP addresses. Most of the times, there was an access for the exact same moment from this IP for different URIs on my webpage. But sometimes, there wasn't an access according to the access log.

It's a shared hosting environment, so I can't access the Apache settings (but I have ssh access to my home directory if this helps). I already googled and searched the Apache documentation, but didn't found anything (it's hard to search for "0"...)

/edit: I also asked the webhoster, they said they don't know what it's causing. I cross checked it with the Apache access log, these are requests to PHP scripts (mostly Joomla), but also requests to images as well as JS and CSS files. So I assume it's not a PHP script which is causing this.

2

There are 2 answers

4
freedev On BEST ANSWER

If your error_log directive is unset errors will be written in your Apache log file for current VirtualHost. So double check your PHP configuration (php.ini) or write a simple page with phpinfo()

If this is true, you should look inside your code (may be even into index.php).

Pay attention to this: usually there are two separate php.ini files for Apache /etc/php5/apache2/php.ini and CLI configuration /etc/php5/cli/php.ini.

Please also consider that, if you want change your PHP configuration, you can use ini_set function.

ini_set('error_log', '/var/log/php/error_new.log');

Remember: the destination directory must exist and your web server (or php engine) must have all permission to write into.

4
swserg On

error_log format is not customizable, I suspect that it can be set to some higher level: debug or trace, where it can produce additional information.

Also please take into account, that error_log contains debug info from CGI/PHP/Perl scripts, so that 'zero' can be produced by some script that executed through apache as its module.