Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to include a file automatically in PHP?

I would like to have a "site.php" file (similar to Python) that is automatically included on every invocation, e.g. command-line execution or HTTP request. This file contains several important replacement functions which need to be available to both existing applications and new.

(I.e. I need to include this file without modifying any files related to the applications in use.)

Is this possible? And if so, how?

like image 757
amcgregor Avatar asked Apr 29 '11 03:04

amcgregor


1 Answers

In php.ini set

auto_prepend_file="/path/to/site.php"
like image 91
Explosion Pills Avatar answered Sep 20 '22 21:09

Explosion Pills