Link to home
Start Free TrialLog in
Avatar of zattz
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.
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

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.
ASKER CERTIFIED SOLUTION
Avatar of zattz
zattz

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.
Avatar of zattz
zattz

ASKER

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
Avatar of zattz

ASKER

the fcgi package works well