PHP:EXEC()不会在后台即使&QUOT运行;>的/ dev / null的2 - ;&放大器; 1和;" [英] PHP: exec() doesn't run in the background even with ">/dev/null 2>&1 &"

查看:272
本文介绍了PHP:EXEC()不会在后台即使&QUOT运行;>的/ dev / null的2 - ;&放大器; 1和;"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的PHP脚本中调用这样的:

I'm calling this in my php script:

    exec("gutschein.php >/dev/null 2>&1 &");

调用脚本(生成PDF并通过电子邮件将其发送的距离)的作品,但过程的在后台没有运行(我里面gutschein.php睡眠声明中检查出来)。浏览器是挂直到gutschein.php执行完毕。

Calling the script (generates a pdf and sends it away by e-mail) works, but the process is not running in the background (I checked it out with a sleep statement inside gutschein.php). The browser is hanging until execution of gutschein.php is finished.

我还检查了以下工作:

    exec("/usr/bin/php gutschein.php >/dev/null 2>&1 &");

shell_exec("/usr/bin/php gutschein.php >/dev/null 2>&1 &");

它不会改变任何东西。该脚本是Linux服务器上实际运行。有没有人一个想法,我在做什么错了?

It doesn't change anything. The script is actually running on a linux server. Has anybody an idea what I'm doing wrong?

推荐答案

试系统和/或中继。我因为它停止试图用数据来填充返回的数组,直到该进程完成之前已经与EXEC问题。

Try system and/or passthru. I've had issues with exec before because it halts trying to fill the return array with data until the process has finished.

这些都将呼应原始输出因此,即使他们的工作,你可能需要处理与丢弃的输出缓冲。

These will both echo raw output so even if they work you may need to handle that with a discarded output buffer.

这篇关于PHP:EXEC()不会在后台即使&QUOT运行;>的/ dev / null的2 - ;&放大器; 1和;"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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