Link to home
Start Free TrialLog in
Avatar of hrolsons
hrolsonsFlag for United States of America

asked on

Command Line PHP variable

I am able to issue command line php such as:

C:\>php test.php

And everything runs fine.

But, when I try to send a variable:

C:\>php test.php?my_variable=hello

It fails with a:

Could not open input file test.php?my_variable=hello

Where am I going wrong?
Avatar of Cong Minh Vo
Cong Minh Vo
Flag of Viet Nam image

ASKER CERTIFIED SOLUTION
Avatar of leakim971
leakim971
Flag of Guadeloupe image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
"test.php?my_variable=hello" is something a web server would recognize as a URL with a query string.  That is not the way it is done on the command line because the command line version does not run thru the web server.  I think you need to come to an understanding of the difference because you have several questions here that confuse those two different ways of running PHP.
Instead of running PHP from the command line, I always put my scripts on my web server and test them there, over the internet, in the live environment that is exactly where they will run, when they are released into the wild.  It saves me a lot of confusion.  You might want to think about that.  My "build process" usually consists of Save->Ftp->Refresh.  Lather, rinse, repeat.  Easy!
Avatar of hrolsons

ASKER

Ray,

I totally see what you're saying, but in this case, the php file is manipulating images(adding the border), and will never leave my machine.