You are here: Re: exec() in the background « All PHP « IT news, forums, messages
Re: exec() in the background

Posted by J.O. Aho on 02/14/06 18:05

MS wrote:
>> When checking the php.net site there were a few examples of background
> processes
>> using exec() that may work out okay. I think some of these writing all
> output to
>> /dev/null and setting it as a background process with "&".
>>
>> exec('php /path/to/thumb.php > /dev/null 2>&1 &');
>>
>> Similar to your suggestion, but it looked like shell_exec may be expecting
>> results to store in a variable.
>>
>
> I will give this a go, but could you point me in the direction of where I
> can learn what the parameters are in this function.
>
> the http://uk2.php.net/manual/en/function.exec.php page does not let me know
> what the parameters are or could be. etc..
>
>
$lastlinefromfunction = exec('limited by the console
command',$array_ofwholeoutput,$returnvaluefromconsolecommand);

In *nix world the console command returns either 0 or 1 (there are exemptions
where an error value is returned), depending if the function did execute
properly or not. $returnvaluefromconsolecommand

the exec() returns the last line from the command executed. $lastlinefromfunction

the $array_ofwholeoutput is the complete output from the command, first line
is $array_ofwholeoutput[0], next line is $array_ofwholeoutput[1] and so on.

This is quite well documented at the
http://www.php.net/manual/en/function.exec.php

What you put in between the single/double quotes depends on what you want to
do, and parameters for the console command depends which one you use, for more
info there you will need to use the manual page: man <command>


//Aho

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация