Avatar of zattz
 asked on

Calling php-fpm directly without using a webserver

Hi :)

I have a php script that I run multiple threads of 24hrs a day doing background processing. Originally I would call the php script using apache with mod_php, resulting in a lot of http processes using around 200mb of ram.

I then changed my setup to call php and run the script via the command line, and I also niced command line php to the lowest cpu priority.

I am now trying to improve memory usage. Would it be possible to run php-fpm, and call that directly? I would also run php-fpm at the lowest cpu priority, and was hoping that would reduce memory usage because if I understand it correctly php-fpm would have multiple threads sharing the php memory, unlike apache prefork mod_php.
PHPLinuxWeb ServersWeb Languages and StandardsWeb Development

Avatar of undefined
Last Comment

8/22/2022 - Mon
Dave Baldwin

This page http://php-fpm.org/ says that...

PHP-FPM (FastCGI Process Manager) is an alternative PHP FastCGI implementation with some additional features useful for sites of any size, especially busier sites.

FastCGI is the Web Server interface.  I don't see any references to anything but web server usage.

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Dave Baldwin

Maybe.  But PHP thru the command line doesn't need cgi or fastcgi.  Everything I read about them says they used to respond to requests thru a web server.  It's the incoming requests that are threaded.  ??  You might want to click on "Request Attention" cause I'm getting confused here.

Yes I know php through the command line does not require fastcgi, but I will have multiple threads so each command line process will be consuming memory. I was hoping to reduce that memory requirement with fpm
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.

the fcgi package works well