在后台运行 PHP 脚本的最佳解决方案是什么:Gearman 还是通过 shell?
我希望能够让 PHP 脚本在后台运行。所以我做了一些研究,发现了两种解决方案:
- 通过 shell。
- http://gearman.org/
我想知道哪种解决方案是最好的。
另外,我发现 PHP.ini 中有内存限制。我想知道这个限制将如何影响我的“后台”PHP 脚本,以及如果我需要更多内存,哪种解决方案是最好的。
更多详细信息:
在后台运行的脚本将在 PHP 和 Kohana 框架的帮助下加密文件。
我使用的是 Ubuntu 11。
I want to be able to have a PHP script working in the background. So I did some research and I found two solutions:
- Via the shell.
- http://gearman.org/
I am wondering which solution is the best.
Also, I have seen that in PHP.ini there is a memory limitation. I am wondering how this limitation will affect my "background" PHP script, and if I need more memory which solution is the best.
More details:
The script that will be working in the background will encrypt a file with the help of PHP and Kohana framework.
I am using Ubuntu 11.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
显然,这取决于你是否需要 Gearman 的功能。 Gearman 中是否有某种魔力可以使您的实际脚本更好地工作是值得怀疑的,因此除非您需要并行工作、负载平衡处理以及在语言之间调用函数 em>,一个简单的 shell_exec('... &') (或一个 cron 作业)的工作量就更少了。
Obviously, it depends on whether you need Gearman's features or not. It's doubtful there is some magic in Gearman that would make your actual script work better, so unless you need to do work in parallel, to load balance processing, and to call functions between languages, a simple shell_exec('... &') (or a cron job) is simply less work.