On Fri, Sep 20, 2002 at 11:24:43AM +0200, Arkadiusz Góralski wrote:
> > I have seen the same problem reported repeatedly on bug tracking system:
> >   in php-cgi mode PHP_SELF is copied from PATH_INFO -> in standard cgi mode
> > it is useless (for example bug report see
> > http://bugs.php.net/bug.php?id=18942&edit=1)
> 
> You can always use $argv[0] as described here:
> http://www.php.net/manual/en/printwn/features.commandline.php

1. Not always, as it is stated on mentioned web page:

   You will only be able to use $argc and $argv if you have in php.ini:
   register_globals = On
   register_argc_argv = On

and I hardly know that, because of that I have lost php-contest (klondike)
because register_argc_argv was set to off on the test system, but ...
nevermind.

2. $argv[0] in PHP contains QUERY_STRING when you execute cgi script from the apacher 
server

<cgi_main.c from php 4.2.2>
    437     if (getenv("SERVER_SOFTWARE")
    438         || getenv("SERVER_NAME")
    439         || getenv("GATEWAY_INTERFACE")
    440         || getenv("REQUEST_METHOD")) {
    441         cgi = 1;
    442         if (argc > 1) {
    443             argv0 = strdup(argv[1]);
                    ^^^^^^^^^^^^^^^^^^^^^^^^
    444         } else {
    445             argv0 = NULL;
    446         }
    447     }
</cgi_main.c>

Summary: argv[0] is not a solution to the problem.

-- 
Piotr Klaban

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to