1

We have a linux hosting from a company and if any php script on that server has any PHP FATAL errors, it is automatically written into a file separately for each directory. So, although PHP errors are off in my scripts, I can still get the error logs as log files in each directory of those PHP scripts.

What I know that I can enable PHP error from configurations for my local server and set a specific file path which will contain all PHP errors from all scripts AND from all directories. But, I would love something automatic and separate like them.

How can I achieve the function in my local servers that we have on our hosting? Have they written a special script or is that a PHP ini settings that I should know?

UPDATED Let's say public_html directory has three A, B and C directory or folder. There are three scripts a.php, b.php and c.php in those directories respectively. So, each of those directories will have error_log file that can contain all errors of those scripts separately. Let's say, folder A has also another script called d.php. But, errors from a.php and d.php will be written under public_html/A/error_log file.

Other directories will also have following files:

public_html/B/error_log file

public_html/C/error_log file

Robi
  • 248
  • 5
  • 12
  • Can you define what you mean by "directory" here. It would be very usual indeed to want to log errors for each individual directory within a single web directory to different places. – Mike Brant Jun 10 '13 at 17:30
  • Folder. Please see my updated example too. – Robi Jun 10 '13 at 21:17
  • This question appears to be answered in this port http://stackoverflow.com/a/6128036/2310830 – RiggsFolly Jun 27 '13 at 13:32
  • The error_log has to be set like I typed out in the answer. Since, there is no slash, the path of error file is relative and the error file is written for each directory. – Robi Oct 24 '13 at 21:48

1 Answers1

0

In php.ini, I had to enable the following setting and restart the server. It worked like I needed.

error_log = "error" 
Robi
  • 248
  • 5
  • 12