开发者

PHP shell_exec() issue

I am having an issue using the PHP function shell_exec().

I have an application which I can run from the linux command line perfectly fine. The application takes several hours to run, so I am trying to spawn a new instance using shell_exec() to manage better. However, when I run the exact same command (which works on the command line) through shell_exec(), it returns an empty string, and it doesn't look like any new processes were started. Plus it completes almost instantly. shell_exec() is suppose to wait until the command has finished correct?

I have also tried variations of exec() with the same out开发者_如何学编程come.

Does anyone have any idea what could be going on here?

There are no symbolic links or anything funky in the command: just the path to the application and a few command line parametes.


Some thing with you env

See output of env from cli (command line interface) and php script
Also see what your shell interpreter?

And does script and cli application runs from one user?
If so, se option safe_mode


Make sure the user apache is running on (probably www-data) has access to the files and that they are executable (ls -la). A simple chmod 777 [filename] would fix that.

By default PHP will timeout after 30 sec. You can disable the limit like this:

<?php
set_time_limit(0);
?>

Edit:

Also consider this: http://www.rabbitmq.com/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜