how to pass parameters to a PHP file invoked via the shell

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jasongr
Forum Contributor
Posts: 206
Joined: Tue Jul 27, 2004 6:19 am

how to pass parameters to a PHP file invoked via the shell

Post by jasongr »

Hi people

I need to invoke a php script via the php.exe engine like so:
c:\php\php.exe c:\myfile.php

I would like to be able to send parameters to the myfile.php script.
Can anyone show me the correct syntax to doing this?

regards
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

There are several avenues for getting input via the command line. Many choose to use argv and argc.

http://php.net/reserved.variables#reser ... les.server
jasongr
Forum Contributor
Posts: 206
Joined: Tue Jul 27, 2004 6:19 am

Post by jasongr »

thanks, I will indeed use argv and argc
Post Reply