Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to define multiple ini settings using php command line?

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.

like image 632
Katrina Avatar asked Apr 05 '17 20:04

Katrina


Video Answer


1 Answers

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>

like image 54
Radon8472 Avatar answered Oct 27 '22 14:10

Radon8472