Where can I find error log files for PHP?

user1010966 picture user1010966 · Oct 11, 2012 · Viewed 152.8k times · Source

Where can I find error log files?

I need to check them for solving an internal server error shown after installing suPHP.

Answer

user4344563 picture user4344563 · Mar 31, 2015

You can use lsof to find open logfiles on your system. lsof just gives you a list of all open files.

Use grep for "log" ... use grep again for "php" (if the filename contains the strings "log" and "php" like in "php_error_log" and you are the root user you will find the files without knowing the configuration).

lsof | grep log

... snip
gmain     12148 12274       user   13r      REG              252,1    32768     661814 /home/user/.local/share/gvfs-metadata/home-11ab0393.log
gmain     12148 12274       user   21r      REG              252,1    32768     662622 /home/user/.local/share/gvfs-metadata/root-56222fe2.log
gvfs-udis 12246             user  mem       REG              252,1    55384     790567 /lib/x86_64-linux-gnu/libsystemd-login.so.0.7.1
==> apache 12333             user  mem       REG              252,1    55384     790367 /var/log/http/php_error_log**
        ... snip
lsof | grep log | grep php

**apache 12333             user  mem       REG              252,1    55384     790367 /var/log/http/php_error_log**
... snip

Also see this article on finding open logfiles: Find open logfiles on a Linux system