Where are the Apache and PHP log files?

I’ve installed Apache, PHP, and MySQL on Ubuntu 10.10 desktop edition, and it’s working fine.
Except I have no clue where to look for Apache or PHP log files.

Asked By: Stann


By default, /var/log/apache2/error.log.

This can be configured in /etc/php5/apache2/php.ini.

Answered By: misterben

You can also define a specific error log file for each VirtualHost in Apache. If you have any VirtualHost defined in /etc/apache2/sites-available/ and enabled in /etc/apache2/sites-enabled (enable with sudo a2ensite [your-virtualhost-definition-file]), you can change the error log by adding the following line inside your VirtualHost config:

ErrorLog ${APACHE_LOG_DIR}/[your-vhost]-error.log

That might be useful if you have a lot of vhosts and want to split where they report the errors.

Also, you can watch your error log live by issuing the following command (adapt to your own log file if different from the default):

sudo tail -f /var/log/apache2/error.log

This is particularly useful when doing live debugging.

Answered By: ywarnier

Check these settings in php.ini:

  1. error_reporting = E_ALL | E_STRICT (as recommended for development in php.ini)

  2. error_log = /var/log/php_errors.log

  3. Then create log file manually

    touch /var/log/php_errors.log
    chown www-data: /var/log/php_errors.log
    chmod +rw /var/log/php_errors.log
  4. And finally

    sudo service apache2 restart

Now you can view PHP errors by this way

tail /var/log/php_errors.log

This is an agreeable solution to this issue for me.

Answered By: Nikolay Chuprina

If Apache was setup with Webmin/Virtualmin there is a separate folder for each VirtualHost.

It is


folder for each VirtualHost user.

These are two files:




So they are







To view log files for each particular domain login as VirtualHost owner user of that hostname and run

tail -f ~/logs/error_log

Answered By: Ilyich

If you use a bitnami distribution, it is at:

tail /opt/bitnami/apache2/logs/error_log

Bitnami distributions have their own directory structure. I had to find what it was for my server, and this is where it resides by default for bitnami. I would assume lots of people are looking for the same thing when using a bitnami distribution.

For more info see here: https://docs.bitnami.com/bch/infrastructure/lamp/troubleshooting/debug-errors-apache/

Answered By: eyal_katz
Categories: Answers Tags: , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.