11

I just set up PHP and Apache and would like to find where the errors are going. What is the default path of the error logs in apache for PHP?

Genadinik
  • 1,103
  • 4
  • 19
  • 39

2 Answers2

6

There are the locations in these popular operating systems:

RHEL / Red Hat / CentOS / Fedora Linux Apache error file location - /var/log/httpd/error_log

Debian / Ubuntu Linux Apache error log file location - /var/log/apache2/error.log

FreeBSD Apache error log file location - /var/log/httpd-error.log

The detailed answer about the Apache log files is here: http://www.cyberciti.biz/faq/apache-logs/

user9517
  • 115,471
  • 20
  • 215
  • 297
Genadinik
  • 1,103
  • 4
  • 19
  • 39
3

Try this:

  1. error_reporting = E_ALL | E_STRICT
  2. error_log = /var/log/php_errors.log
  3. 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

Now you can view PHP errors by this way

    tail /var/log/php_errors.log
chupnik
  • 165
  • 5
  • Would be useful to many more - if you could mention where to add the lines 1 and 2 – vishva8kumara Aug 08 '20 at 09:24
  • 1
    #1 and #2 can be configured in several places: In php.ini (global config) or an apache virtualhost block (per website config)... or at runtime with ini_set(). That is probably why the author of this answer did not get into that particular subject. – Jette Nov 02 '20 at 09:25