You can use phps auto_prepend_file
and directives auto_append_file
.
It works like loading every script on your server through require_once()
right between the files specified in auto_prepend_file
(Loaded before your script) and auto_append_file
(Loaded right after your script).
.htaccess
:
php_value auto_prepend_file "/path/to/file/before.php"
php_value auto_append_file "/path/to/file/after.php"
php.ini
( cgi-, - wole):
auto_prepend_file = "/path/to/file/before.php"
auto_append_file = "/path/to/file/after.php"
before.php
try {
after.php
} catch(Exception $e) {
...
}