Php-fpm On CentOS 6

Home » CentOS » Php-fpm On CentOS 6
CentOS 11 Comments

What’s the story with php-fpm on CentOS 6?
There’s a php-fpm rpm for CentOS 6 in epel but other essential mods like mod_fastcgi or mod_proxy_fcgi seem to be missing from the repos I’m usually using. Need a push in right direction. Thanks.

11 thoughts on - Php-fpm On CentOS 6

  • Does it? There’s mod_fastcgi in rpmforge but I don’t feel quite comfortable with packages from this repo.

    Eero Volotinen писал 2014-08-22 22:46:

  • Just check the spec file from the src.rpm and see if you find something suspicious. Or, if you have a bit more spare time, check the spec file and just rebuild it.

  • mod_fastcgi is extremely old and dead. If I remember it is superseded by mod_fcgid which became part of the Apache core and actively maintained (or something, sry this is from memory many years ago)

    mod_proxy_fcgi is also very much dead. Not updated since 2006.

    EPEL has mod_fcgid in it and you should absolutely use it, along with suexec, if you need fcgi process mamagement for php-cgi.

    When using php-fpm you do not need any of the above modules as the above modules are fpms that interact with cgi processes having fastcgi support (such as php-cgi).

    php-fpm IS an fpm, written by PHP team. If you want to use php-fpm as the fpm you merely need to use mod_proxy as-is since php-fpm is pretty much a stand alone server – you just proxy your php request to it with ProxyPass.

    For simple servers like pure PHP you may benefit greatly speed wise from Nginx, and support from PHP software (WordPress / Drupal etc) is now very wide. For huge feature sets, modules, and variety, Apache though.

    Hope this helps. I’d been running LAMP stacks for over 6 years and LNMP for last 2.

    Jason

  • Sorry let me fix this. 7am is clearly too early for brain function :(
    Just ignore my last mess email

    mod_fastcgi is gone. That’s now fcgid.

    mod_proxy_fcgi is not dead. It’s too new for CentOS 6 though.

    It needs apache 2.4 and CentOS has lower (2.2?) I think. Thus you’d need to build apache yourself or find packages in rpm forge or something as it requires apache 2.4 and this module for proxy to fcgi.

    You can see the module doesn’t exist for 2.2 here:
    http://httpd.apache.org/docs/2.2/mod/
    But does for 2.4:
    http://httpd.apache.org/docs/2.4/mod/

    To summarise, what you want to do will need apache 2.4. Or just use the old school php-cgi and mod_fcgid.

    Other option is nginx and fastcgi_pass. Benefit here is you can use unix socket if php-fpm is local to drop the TCP overhead

    Sorry for confusion. No more emails this early. Coffee first.

    Jason

  • Thanks, Jason!
    I’ve been using php-cgi, mod_fcgid and suexec combo for years on my servers. Now I want to run php apps in UserDir with user credentials. This probably can be achieved with mod_fcgid and suexec but it seems like I’d need separate fcgi configs and cgi wrappers under suexec docroot for each user. If you know of a simpler way please share your experience.

  • Mihamina Rakotomandimby писал 2014-08-23 08:49:

    Thanks, Mihamina!
    That’s what I did but I’m not sure I’ll be using this mod on production servers.

  • To be fair you’d still need separate configs for each user even with php-fpm to set the user/group for the processes and to set the sessions path.

    I always did it that way. Unique wrappers for each user and apache config for each user setting the suexec user group etc. I had shell scripts to generate them for me.

    Even with nginx you need config per user but at least you don’t need any wrappers – you do need a php-fpm config per user tho so it’s about the same work. I shell scripted this too.

    Jason

  • Jason Woods писал 2014-08-23 11:44:

    I suspected as much :(
    Seems like fpm isn’t worth the effort after all though sharing the opcode cache by php-fpm workers might be interesting. Thanks a lot for your input!

  • You’re welcome! I’ll say though that I did see a boost in response times (can’t remember how much but noticeable) when I switched to fpm. So it may still be worth considering, though on CentOS 6 Nginx will be an easier setup and more maintained than rolling ones own. With SSL and official Nginx repo you’ll get things like SPDY too.

  • Jason Woods писал 2014-08-23 12:28:

    Yeah, maybe I should get out of the groove and try something new like many other fearless old farts on this list do :)
    Just kidding.