我需要在共享托管环境中运行一个
legacy PHP application.我已经答应我的客户,我会支持这个遗留应用程序一段时间,但我发现它不起作用,因为它广泛使用不推荐的$HTTP_POST_VARS.
降级PHP不是一个选择.修补应用程序可能是不可行的,因为PHP文件是从Windows可执行文件生成的(我不是在开玩笑!),每次从桌面重新生成站点时,都可能会丢失修改.
我问,是否有办法让PHP重新引入$HTTP_POST_VARS为主机上的所有网站或仅为特定的虚拟主机.任何其他选项/建议是赞赏
你可以这样做
原文链接:https://www.f2er.com/php/139894.html$HTTP_POST_VARS = &$_POST; $HTTP_GET_VARS = &$_GET; $HTTP_COOKIE_VARS = &$_COOKIE;
的.htaccess
PHP_value auto_prepend_file /path/to/config.PHP
PHP doc auto_prepend_file string
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.
The special value none disables auto-prepending.
编辑:要更加彻底,这些还可以是别名的其他超帧:
$HTTP_SERVER_VARS = &$_SERVER; $HTTP_POST_FILES = &$_FILES; $HTTP_SESSION_VARS = &$_SESSION; $HTTP_ENV_VARS = &$_ENV;