append and prepend script with apache

Sometimes we need to run a script in our localhost (or maybe in production) but we don’t want to edit our application to test the current environment. To solve this problem we can just add the file via apache virtual host configuration.

So go on and edit your virtual host, and add this line to the <Directory> directive.

To execute at the end:
[cc_apache]
php_value auto_append_file “/Users/walter/workspace/append.php”
[/cc_apache]

To execute before everything:
[cc_apache]
php_value auto_prepend_file “/Users/walter/workspace/prepend.php”
[/cc_apache]

Don’t forget to restart apache before reloading the app.

Tags: