How to override register_argc_argv in PHP?

I use a shared host (fasthostingdirect), and for some reason they turned this flag off by default. This means that I can’t access the PHP command line options ... unless I use the -n flag (= --no-php-info ) after php.exe .

Tried ini_set('register_argc_argv', 1) in my php file, but it has no effect. I suppose this is due to the infringement of the nature of the hosting provider, but they do not stop the -n option - they are not sure about the other consequences of using this. Does anyone have any better suggestions?

+7
source share
2 answers

ini_set('register_argc_argv', 1) does not work, because by the time the code is executed they are already registered (or not).

It seems you can run php directly, so copy your own php.ini and pass it:

 php -c yourphp.ini 
+6
source

No need to create a whole new ini file, just use the -d flag

 php -d register_argc_argv=1 myscript.php 
+2
source

All Articles