Run program asynchronously

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
Pepuch
Forum Newbie
Posts: 1
Joined: Tue Dec 15, 2009 5:29 am

Run program asynchronously

Post by Pepuch »

Hi,
Sorry for my English :) Since yesterday I have got problem with asynchronously running programs under Linux. Problems started when I tried to run command with && operator (without it everything is ok). Problem example:

Code: Select all

 
$out = -1;
$cmd = 'sleep 10 && echo "ok" 2>&1 &';
system($cmd, $out);
 
Problem is that command is running synchronously. Can anyone help me with it? What is wrong with it?
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Run program asynchronously

Post by Christopher »

I think you want ";" rather than "&&".
(#10850)
Post Reply