How to define multiple ini settings using php command line?

血红的双手。 提交于 2019-12-02 04:57:28

问题


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.

Something like this:

php -d allow_url_fopen=on rename=on <file>

I'm using PHP 5.6

Update

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:

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)?

Update Two

This works for my situation:

php -d disable_functions=fn1,fn2,etc -r 'ini_set("allow_url_fopen", "1");' <file> <args>

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.


回答1:


You must only define a -d OPTION block for each setting you like to define.

You need to run:

php -d allow_url_fopen=on -d rename=on <file>



来源:https://stackoverflow.com/questions/43241036/how-to-define-multiple-ini-settings-using-php-command-line

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!