在后台执行shell脚本,同时页面在屏幕上显示给用户 [英] Execute shell script in the background while a page is displayed on screen to the user in php
问题描述
在我的应用程序中,我正在运行一个shell脚本,但直到脚本完成执行屏幕为空。我无法在屏幕上显示任何内容。我希望将日志文件显示给用户,以便生成日志文件时,我希望用户在屏幕上看到一些文本内容。
我读过以前的问题 有没有一种方法可以做到这一点?
这两个问题可能有一些帮助:
$ b
1> exec(sprintf(%s> ;%s 2& 1& echo $!>>%s,$ cmd,$ outputfile,$ pidfile));
In my application, I am running a shell script but till the script completes executing the screen is blank. I am not able to display anything on screen. I want to display the log file to the user so till the log file is generated, i want the user to see some text content on the screen.
I read previous questions posted where they say multithreading in php is not possible.
Is there a way i can do this?
These two questions might be of some help:
1> exec(sprintf("%s > %s 2>&1 & echo $! >> %s", $cmd, $outputfile, $pidfile));
php execute a background process
这篇关于在后台执行shell脚本,同时页面在屏幕上显示给用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!