note 51836 deleted from features.commandline by bjori
| From: | bjori@php.net | Date: | Sun, 02 Apr 2006 02:20:03 +0000 |
| Subject: | note 51836 deleted from features.commandline by bjori | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-107147@lists.php.net to get a copy of this message | ||
Note Submitter: Nicole at AeonTrek dot com
----
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:\php\cli\php.exe d:\webserver\mysite\script.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:\php\cli\php.exe d:\webserver\script.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:\php\cli\php.exe d:\webserver\mysite\script.php bar
And in my script, I can see bar like this:
$argv[1] // grab [1] because [0] holds the script name
That solved my problem! I HOPE this helps someone else in the future!
Enjoy!
Nicole
AeonTrek.com