note 47711 added to function.func-get-arg
| From: | skippy-at-offshoremailroom dot com dot se at osu1 dot php dot net | Date: | Fri, 26 Nov 2004 02:49:14 +0000 |
| Subject: | note 47711 added to function.func-get-arg | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-81045@lists.php.net to get a copy of this message | ||
To save someone else the grief, I'll share my experience with trying to pass command line
arguments to a php script (from Radius for example). It does not work with the cgi version of php
which most rpm's tend to install. Try var_dump($argv). If it says NULL, you need to get the CLI
version of PHP.
Download the source do a ./configure and then:
make install-cli
It puts the cli version in /usr/local/bin. Put #!/usr/local/bin/php at the top of your script and
then dive right in with <?php .... ?>. $argv[1] contains the first command line argument you
passed the script.
Having the cli version installed does not seem to interfere with apache at all. The default also
allows access to mysql.
Hope I saved somebody else the time I spent on this.
Skippy
Remove .se from my email address above.
----
Manual Page -- http://www.php.net/manual/en/function.func-get-arg.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+47711
Delete -- http://master.php.net/manage/user-notes.php?action=delete+47711&report=yes
Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+47711&report=yes&reason=bad+code
Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+47711&report=yes&reason=spam
Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+47711&report=yes&reason=useless+example
Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+47711&report=yes&reason=contains+commercial+links
Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+47711&report=yes&reason=useless+note
Reject -- http://master.php.net/manage/user-notes.php?action=reject+47711&report=yes
Search -- http://master.php.net/manage/user-notes.php