我想在我的服务器上加载任何网站之前运行在“/var/www/html/file.php”上找到的PHP脚本。 我有Nginx作为反向代理。 我尝试在apache上做到这一点:
<Location "/">
Action pre-script /var/www/html/file.php
SetHandler pre-script
</Location>
但是因为Nginx是反向代理我需要在他身上做。 怎么做?谢谢!
答案 0 :(得分:1)
您可以使用核心php.ini - auto_prepend_file
指令。
Specifies the name of a file that is automatically parsed before the main file. The file is included as if it was called with the require function, so include_path is used.
来源:http://php.net/manual/en/ini.core.php#ini.auto-prepend-file