Jump to content


Photo

Command Line PHP - 2 Questions


  • Please log in to reply
2 replies to this topic

#1 jvalarta

jvalarta
  • Members
  • PipPipPip
  • Advanced Member
  • 42 posts

Posted 21 August 2006 - 03:56 PM

QUESTION 1:

Q-- Is it possible to append GET variables to a PHP string via command line? I can not get this to work:

> myscript.php?f00=1&bar=2&etc=blah




QUESTION 2:

When I start a PHP script via command line, it runs fine, until I close the terminal window (then it dies). If I do this, it returns a prompt, but still dies if I close the terminal window:

> myscript.php &

Q-- How can I start a PHP script to run and then be able to close the terminal window and have it continue to execute?

#2 shocker-z

shocker-z
  • Members
  • PipPipPip
  • Advanced Member
  • 864 posts
  • LocationNottingham

Posted 21 August 2006 - 06:46 PM

myscript.php?f00=1&bar=2&etc=blah

No it doesnt work from my knolledge as the $_GET is used in conjuntion with the webserver and running from command line it wouldnt pass them correctly

i've seen that from a php file you can launch like this exec("php $path $param > /dev/null &");
but not sure if php $path $param > /dev/null & will work from command line aloan...


regards
Liam
www: www.ukchat.ws | irc: irc.ukchat.ws chan: #blufudge

#3 jvalarta

jvalarta
  • Members
  • PipPipPip
  • Advanced Member
  • 42 posts

Posted 21 August 2006 - 08:09 PM

Ok, I see. I could use exec() but I don't quite understand the syntax. I went to php.net/exec but that's no clearer. Can you explain how I say foo=bar&etc=blah using exec?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users