3

Hi i not have access to php.ini and i use this post How to log errors and warnings into a file?

i have 23 file and 47 sub directory in public_html

i want Anywhere happening error or warning all errors write in public_html/my_error.log

but now i have in any sub directory a error.log file

i try this code but this only change name log erors files in public_html and sub directory

<IfModule mod_php5.c>
php_flag log_errors on 
php_value error_log ./path_to_MY_PHP_ERRORS.log
</IfModule>

thanks

nazanin
  • 729
  • 1
  • 6
  • 13

1 Answers1

0

i not have access to php.ini

The error_log ini directive is writable from everywhere, so you dont need access to the ini file itself. You can just set it with ini_set, e.g.

ini_set("error_log", "/path/to/your/error.log");

but now i have in any sub directory a error.log file

If you have a log file in every subdirectory you likely specified a relative path instead of an absolute path for the destination argument in [error_log()][1]. Mind the example:

error_log("You messed up!", 3, "/var/tmp/my-errors.log");

Likewise, in the httpd configuration snippet, use an absolute path:

php_value error_log /absolute/path_to_MY_PHP_ERRORS.log
Gordon
  • 312,688
  • 75
  • 539
  • 559