prepend a php script in all requests

Reinis Rozitis r at roze.lv
Thu Sep 25 21:44:47 UTC 2014


> Once i have nginx installed with php fastcgi. Is it possible to preppend a 
> php script to be executed when serving any request? (similar to apache 
> prepend function). If yes could I please have an example. Thanks

PHP itself has such functionality 
http://php.net/manual/en/ini.core.php#ini.auto-prepend-file .

If you want to change it from nginx you can add following line to your 
particular php/fastcgi block:

fastcgi_param  PHP_VALUE   "auto_prepend_file=/path/to/your/file.php";


rr 



More information about the nginx mailing list