I am trying to install PHP FPM on my CentOS 5.6 server, but I wasn't able to get it to work. After downloading PHP 5.3.20 from their php.net, configuring it, making it and installing it, I got this message:

Installing PHP SAPI module:       fpm
Installing PHP CLI binary:        /usr/bin/
Installing PHP CLI man page:      /usr/share/man/man1/
Installing PHP FPM binary:        /usr/sbin/
Installing PHP FPM config:        /etc/
Installing PHP FPM man page:      /usr/share/man/man8/
Installing PHP FPM status page:      /usr/share/fpm/
Installing build environment:     /usr/lib/build/
Installing header files:          /usr/include/php/
Installing helper programs:       /usr/bin/
  program: phpize
  program: php-config
Installing man pages:             /usr/share/man/man1/
  page: phpize.1
  page: php-config.1

At that point, I assumed PHP was installed so I restarted Apache, but it was serving PHP files as plain text. How do I fix this? How do I get PHP FPM enabled on my CentOS 5.6 box?



You're looking for apache to act as a reverse proxy, using php-fpm as the backend application server.

  1. Ensure that php-fpm configured and running: service php-fpm restart and check logs for failure

  2. Ensure that somewhere in your apache config, you have loaded the correct proxying modules:

  3. Also, you need to include a proxypass directive so apache knows where to send the request for fulfillment.

Part of your apache config might look something like this, assuming php-fpm is running on port 9000:

LoadModule  proxy_module         modules/mod_proxy.so
LoadModule  proxy_fcgi_module    modules/mod_proxy_fcgi.so
<VirtualHost *:80>
  ServerName    localhost
  DocumentRoot  "/var/www/html"
  ProxyPass     ProxyPass /myapp/ fcgi://localhost:9000

If this is not sufficient, update your question with more information about your apache config and you php-fpm config and exactly what commands you're running and the results you get.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.