You are here: Re: running an exec in the background, let page go on. « All PHP « IT news, forums, messages
Re: running an exec in the background, let page go on.

Posted by Arjen on 04/28/06 09:01

news@celticbear.com wrote:
> I've a PHP script that does some stuff, zips up some files, and starts
> an FTP process.
>
> I need it to do the Zip and FTP in the background and let the page
> finish, otherwise the user could have that page sitting there loading
> for 20 minutes while the FTP completes.
>
> Here's what I have:
>
> $zipfile = $order_po.".zip";
> exec("/var/www/html/services/ftp.sh $zipfile 2>&1 &", $output2,
> $status);
> echo "<div align='center' class='style1_hd'>Your auto-created ZIP file
> is currently being sent through FTP!</div></body></html>";
> exit();
> ?>
>
> (The ftp.sh is the FTP logon and transfer script.)
> As you can see I have the & to make it a background process, and
> sending the stdoutput elsewhere.
>
> Any ideas?
>
> Thanks!
> Liam

Im not quite sure if it is the neatest solution but for these kind of
operations I create a todo file/table/etc and have crontab check the
file every x mins and then execute the a script based on the parameters
given in the todo file. You can catch the output and store it wherever u
like.

Arjen

 

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

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