During development its useful to have error reporting enabled. Once a project goes live, (or if you've not yet enabled error reporting in your development code) the server error log is the place to go to get accurate information about errors and other conditions affecting your code. But where is it?

Where is the server error log?

There's no single, definitive answer to this question as the web server configuration can place it almost anywhere. Here are some suggestions:

Debian, Ubuntu and related flavours of Linux/var/log/apache2
Fedora, RHEL, Centos, and related flavours of Linux/var/log/httpd
WindowsC:\Windows\temp\php??_errors.log where ?? is the major and minor version number of your PHP release. E.g. php73_errors.log, or php80_errors.log

If all that fails, try looking at the PHP configuration. From the command line:

php --info | grep error_log
php --info | findstr /r /c:"error_log"

Alternatively, create a small file in you web root containing this line:

<?php phpinfo(); ?>

Visit that file with your browser and scroll down until you find the error_log entry.

My PHP.INI file has no entry for error_log. What now?

Both Apache and NGINX have directives that can set the location of the error log. Find the configuration files and search through them for the directive.

ProductFolderSearch for
Debian etc. with Apache/etc/apache2/sites-available/*.confErrorLog
Fedora etc. with Apache/etc/httpd/conf/httpd.conf and sub-foldersErrorLog

What about shared hosting?

Hosting companies have many different ways to handle error logs. Look in the folder above your web root for a file called php_error.log, or something similar. If you can't find a likely file your best bet is to contact support at your host.