1

I have access to the server-wide PHP settings on a server with shared hosting. Currently the error_log value is simply "error_log", meaning it logs errors to a file named error_log in the same directory as the script that caused the error. This results in error_log files in the web directory. Even though outsiders can't see the files, I'm not comfortable with them being there all the same. I could specify an exact log file path, but I don't want errors of all the sites to end up in one file. I know that setting error_log to be "~/error_log" will not work (that is, it will NOT put the file in the home directory of whatever website generates the error). Any suggestions on how I can accomplish that? I suppose I need to use an auto-prepended script?

Yes, I know I could override the global php.ini error_log settings with a php.ini file in every site's home directory, however there are a lot of sites, and I don't want to have to remember to do this with every site added.

William Beaumont
  • 357
  • 2
  • 6
  • 15
  • could try apache `Define` variables: http://stackoverflow.com/questions/6569080/how-to-define-a-variable-in-apaches-httpd-conf-file – Marc B Jul 03 '15 at 18:57

1 Answers1

1

You can use ini_set function :

   ini_set("error_log", "/yourhome/yourproject.log");
chandresh_cool
  • 11,753
  • 3
  • 30
  • 45