Why/how is my PHP shared host setting argc/argv?
Until now, I had been checking for the presence of argc
and argv
in my script to determine whether requests were coming from the CLI, which worked on several development machines. When placed on a particular shared host, though, the program went into fits. Looking at my routing code, I discovered that the host was setting both argc
and argv
for my requests, which mystifies me a 开发者_如何学Cbit.
I've since switched to php_sapi_name
to solve the CLI routing issue, but I wanted to know why and how the shared host was setting those variables in the $_SERVER array. Any help is appreciated. Thanks!
Probably due to this option (register_argc_argv
).
Maybe my class help for your script?
Php command line argument parser
精彩评论