问题描述
我正在尝试暂时将allow_url_fopen
和rename
函数用于脚本.我可以只使用一个功能,而不能同时使用这两个功能.
I am trying to allow the allow_url_fopen
and rename
functions temporarily for a script. I can do it with just one function, but not both.
类似这样的东西:
php -d allow_url_fopen=on rename=on <file>
我正在使用PHP 5.6
I'm using PHP 5.6
显然rename()
在我的php.ini文件的disable_functions
中(而allow_url_fopen
在该文件之外已关闭),所以我假设-d
选项不会更改disable_functions
指令.
Apparently rename()
is in the disable_functions
in my php.ini file (whereas allow_url_fopen
is turned off outside of that), so I'm assuming the -d
option doesn't change the settings for the disable_functions
directive.
因此,原始问题仍然存在,而新问题仍然存在:
Therefore, the original question still stands, and a new one:
是否可以使用命令行工具启用禁用的功能?还是我必须重新定义整个disable_functions
指令(如果可能)?
Is it possible to enable a disabled function with the command line tool? Or would I have to redefine the whole disable_functions
directive (if possible)?
这适用于我的情况:
php -d disable_functions=fn1,fn2,etc -r 'ini_set("allow_url_fopen", "1");' <file> <args>
您不能使用ini_set()
更改disable_functions
指令.如果您的php.ini文件中还有另一条指令不能被ini_set()
更改,那么我不知道该如何解决.我的问题已经解决,尽管原始问题尚未得到解决.
You cannot use ini_set()
to change the disable_functions
directive. If there is another directive in your php.ini file that cannot be changed by ini_set()
then I don't know how to solve that. My issue has been resolved, although the original question hasn't been answered yet.
推荐答案
您只需为要定义的每个设置定义一个-d OPTION
块.
You must only define a -d OPTION
block for each setting you like to define.
您需要运行:
php -d allow_url_fopen=on -d rename=on <file>
这篇关于如何使用php命令行定义多个ini设置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!