How to override register_argc_argv in PHP?

前端 未结 2 1470
借酒劲吻你
借酒劲吻你 2021-01-18 06:26

I\'m using a shared host (fasthostingdirect) and for some reason they have this flag turned off by default. This means I\'m unable to access PHP command line parameters... u

相关标签:
2条回答
  • 2021-01-18 07:12

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

    php -d register_argc_argv=1 myscript.php
    
    0 讨论(0)
  • 2021-01-18 07:16

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

    It seems you are able to run php directly, so copy your own php.ini file and pass it:

    php -c yourphp.ini
    
    0 讨论(0)
提交回复
热议问题