php - file_put_contents() to log errors works fine - EXCEPT for fatal errors -


so figured out how generate own php error handler , record errors in log file - not visible user. made second log file, records unique errors.

now figured out how can go fatal errors, calling register_shutdown_function('fatal_handler');

my fatal_handler utilized same functions regular error handler uses, fatal errors logged exact same way.

but here things weird: when invoke fatal error, these errors error logging functions:

warning: file_put_contents(): open_basedir restriction in effect. file(errors.log) not within allowed path(s): ...

warning: file_put_contents(errors.log): failed open stream: operation not permitted

warning: fopen(unique_errors.log): failed open stream: operation not permitted

and subsequently fgets, fclose, , file_put_contents functions fail simmilar errors.

why these errors occur fatal_handler not regular error handler? have differently when logging fatal errors?

e d t :

*maybe should mention log file trying access resides in sub folder of on of paths open_base_dir restriction error message lists option. error doesn't make sense, because within allowed path - mean after works effortless when it's notice, rather fatal error.*

so again question: why file_put_contents() work on regular error handler not in fatal error handler?

i assume have specify path file differently in fatal error handler, because events happening @ different level or maybe...? know nothing php's inner workings... have opinion or idea?

though php executable can access lot of places default. such directory php installed, log files reside, php.ini, windows temp directory , on...

you can restrict access directories scripts run can read/write. security measure if php script has exploit, rest of computer isn't compromised. done open_basedir.

i think (i'm not sure) can set multiple directories in open_basedir. advise not set open_basedir have access directory php.ini resides. because in case might remove open_basedir.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -