在后台运行一个exec,让页面继续。 [英] running an exec in the background, let page go on.

查看:165
本文介绍了在后台运行一个exec,让页面继续。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个PHP脚本可以做一些事情,拉上一些文件,然后启动

一个FTP进程。


我需要它在后台执行Zip和FTP,让页面完成

,否则用户可以让那个页面在FTP完成时加载

20分钟。 />

这就是我所拥有的:


$ zipfile = $ order_po。" .zip";

exec(" /var/www/html/services/ftp.sh $ zipfile 2>& 1&",$ output2,

$ status);

echo"< div align =''center''class =''style1_hd''>您自动创建的ZIP文件

目前正在通过FTP发送!< / div>< ; / body>< / html>" ;;

exit();

?>


(ftp .sh是FTP登录和传输脚本。)

你可以看到我有&使它成为一个后台进程,并且

将stdoutput发送到其他地方。


任何想法?


谢谢!

利亚姆

解决方案

zipfile =


order_po。 ; .zip" ;;

exec(" /var/www/html/services/ftp.sh


zipfile 2>& 1&" ,

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

解决方案

zipfile =


order_po.".zip";
exec("/var/www/html/services/ftp.sh


zipfile 2>&1 &",


这篇关于在后台运行一个exec,让页面继续。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆