本文介绍了通过PHP-FPM运行命令行PHP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前我使用PHP-FPM与NGINX前端请求,但也运行一些后台进程通过长时间运行PHP脚本使用exec运行其他脚本与命令行PHP。我想的是,如果这些也通过PHP-FPM运行,这将更有效率?任何想法如何我会这样做?感谢。

Currently I use PHP-FPM with NGINX for front end requests but also run some background processes through a long running PHP script using exec to run other scripts with the command line PHP. What I'm thinking though is that this would be more efficient if these were also run through PHP-FPM? Any ideas on how I would do this? Thanks.

推荐答案

FPM是 M anage F astCGI P rocesses。只是洗牌的字母。虽然它管理长时间运行的PHP进程,但它只能在FastCGI的精神保护下执行。

FPM is a tool to Manage FastCGI Processes. Just shuffle the letters. While it manages long-running PHP processes, it does so only under the mental umbrella of FastCGI.

因为你正在创建一个后台工作队列, >设计以管理后台工作队列和正在运行的进程。

Because you're creating a background work queue, you want something designed to manage a background work queue and running processes.

是工作队伍的理想选择。它的平台和语言不可知,扫描规模的天堂和背部。 工作良好。

Gearman is an excellent choice for the work queue half. It's platform and language agnostic, and scan scale to the heavens and back. The PECL extension works well.

要保持这些长期运行的流程,请查看。

For keeping those long-running processes going, take a look at Supervisor.

这两个人是一个伟大的二重奏。查看,记录了他与Gearman和主管的一些探索。

The two make a great duo. Check out this blog post by PHP hacker Matthew Weier O'Phinney that documents some of his exploration with Gearman and Supervisor.

这篇关于通过PHP-FPM运行命令行PHP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-28 12:02