Running command line PHP through PHP-FPM Running command line PHP through PHP-FPM nginx nginx

Running command line PHP through PHP-FPM


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.

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.


Very late to this question (4 years) but the correct answer is cgi-fcgi which will let you pass commands and execute code in the already-in-memory php-fpm