Hi Lan,
I was just checking out the php web site for the command line interface
http://au3.php.net/manual/en/features.commandline.php Anyways, someone else posted this message that may be of help.
This one took me all morning to finally figure out. My problem was that I needed to run a PHP script via command line in the background. I have my script run automatically every 15 seconds.
I am running Apache 2 on Windows XP Pro with PHP 4.3.11. I am also connecting to a MySQL database.
I was calling my script like this:
c:phpcliphp.exe d:webservermysitescript.php?foo=bar
And I was accessing my GET parameters via $_GET. Well, calling it this way was giving me a "Input file not specified" error message. I could not understand why. I was able to run another script just fine like this:
c:phpcliphp.exe d:webserverscript.php
As it turns out, attempting to pass parameters through the GET method renders the file name invalid to php.exe. So, to fix my problem, I realized I need to call my script and parameters like this:
c:phpcliphp.exe d:webservermysitescript.php bar
And in my script, I can see bar like this:
$argv[1] // grab [1] because
That solved my problem! I HOPE this helps someone else in the future!
There were lots of other good contributions. Perhaps once of those may help you.
Kind regards
Ian