Re: passing an argument to php3 when using binary via shell.

From: Date: Sun, 30 Jul 2000 15:53:26 +0000
Subject: Re: passing an argument to php3 when using binary via shell.
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-9060@lists.php.net to get a copy of this message
You have a couple of choices. The best and easiest is: php script.php blah You can then access 'blah' using $argv[1] in script.php If you want the value=something type of syntax, you can use: php script.php value=blah And then in script.php you can use: parse_str($argv[1]); echo $value; And finally, you can set the QUERY_STRING env variable to "value=blah" and then just call php script.php without any arguments and it will fetch them from the QUERY_STRING variable. ie. QUERY_STRING="value=blah" php script.php -Rasmus On Sun, 30 Jul 2000, Neil M wrote: > Hello > > I am using php3 as a binary under linux , executing it from the command line like so : > > /usr/local/bin/php /home/mydocs/mycode.php3 > > which does things just great , however i now want to pass : > > /usr/local/bin/php /home/mydocs/mycode.php3?value=1 > > using arguments seems to upset the binary , heres what it mumbled : > > [root@ns web]# /usr/local/bin/php > /home/sites/site2/web/build_config/auto_hostmaster/insert_multiref.php3?value=test > Content-type: text/html > > <br> > <b>Fatal error</b>: Unable to open > /home/sites/site2/web/build_config/auto_hostmaster/insert_multiref.php3?value=test in <b>- > </b> on line <b>0</b><br> > [root@ns web] > > if i execute with out the ? argument it seems fine ( i have been using it like this for setting > up php3 cron jobs ) take a look : > > [root@ns web]# /usr/local/bin/php > /home/sites/site2/web/build_config/auto_hostmaster/insert_multiref.php3 > Content-type: text/html > > So if any has succesfully passed values to php3 in this manner basically , i would like to hear > from you :) > Thank you all in advance for reading this desperate attempt for help > > Neil > > >

« previous php.general (#9060) next »