I've researched different methods and directives including:
- auto_prepend_file
- .user.ini files
- getcwd()
- debug_backtrace()
And I can't seem to find a way to change the path of the error_log to log in the same path as the file being included/required.
For example, say index.php has the line:
include('subdir/file.php');
If subdir/file.php
has a syntax error, forcing php to create subdir/error_log
, rather than the default behavior of creating error_log in the same path as index.php
, auto_prepend_file suffers from this same limitation as it prepends the specified file before the first script called, rather than each file included.
I've looked around and can't seem to find a legitimate way to do this. I understand the implications of performance overhead by doing this, and plan to only use it for development purposes. I believe this can help isolate errors rather than using stack traces such as debug_backtrace()
, as I can use a terminal script to show the last error logs by last modified, and find the offending files much quicker than reading through a massive error log.
My goal is ultimately not to have these files appear at all, obviously, as debugging already existing sites and having to go through a 10GB error logs or tail
/multitail
ing it can be somewhat cumbersome. I'm trying to devise this method so errors can be isolated by path. Any suggestions?