[How to]Install PHP-FPM on Linux Centos 6.5 / 6.6

PHP – FPM mean Fcgi Process Manager, I usually pair with nginx, here is how to install nginx.

  1. Set Repository

    		yum update -y
    		sudo rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
    		cd /etc/yum.repos.d
    		curl -O http://rpms.famillecollet.com/enterprise/remi.repo
    		
  2. PHP-FPM 5.4

    		yum install php-fpm php php-devel -y --enablerepo=remi
    		yum install php-mbstring -y --enablerepo=remi
    		yum install php-mcrypt -y --enablerepo=remi
    		yum install php-mbstring -y --enablerepo=remi
    		yum install php-soap -y --enablerepo=remi
    		yum install php-intl -y --enablerepo=remi
    		yum install php-apc -y --enablerepo=remi
    		yum groupinstall "PHP Support" --enablerepo=remi -y
    		
  3. PHP-FPM 5.5

    		yum install gd-last --enablerepo=remi
    
    		yum install php-fpm php php-devel -y --enablerepo=remi-php55
    		yum install php-mbstring php-mcrypt php-soap php-apc -y --enablerepo=remi-php55
    		yum groupinstall "PHP Support" --enablerepo=remi-php55 -y
    		
  4. PHP-FPM 5.6

    		yum install php-fpm php php-devel -y --enablerepo=remi-php56
    		yum install php-mbstring php-mcrypt php-soap php-apc -y --enablerepo=remi-php56
    		yum install gd-last --enablerepo=remi
    		yum groupinstall "PHP Support" --enablerepo=remi-php56 -y
    		
  5. Setting PHP-FPM

    Change this line

    		vim /etc/php-fpm.d/www.conf
    
    		listen = /var/run/php5-fpm.sock
    		listen.allowed_clients = 127.0.0.1
    		listen.owner = nginx
    		listen.group = nginx
    		listen.mode = 0666
    		user = nginx
    		group = nginx
    
    		service php-fpm start
    		chown nginx:nginx /var/run/php5-fpm.sock
    		
  6. Check PHP-FPM

    		ps -ef | grep fpm
    		root     32211     1  0 18:48 ?        00:00:00 php-fpm: master process (/etc/php-fpm.conf)
    		nginx    32212 32211  0 18:48 ?        00:00:00 php-fpm: pool www
    		nginx    32213 32211  0 18:48 ?        00:00:00 php-fpm: pool www
    		nginx    32214 32211  0 18:48 ?        00:00:00 php-fpm: pool www
    		nginx    32215 32211  0 18:48 ?        00:00:00 php-fpm: pool www
    		nginx    32216 32211  0 18:48 ?        00:00:00 php-fpm: pool www
    		
  7. Conclusion

    Well, you have done installing php-fpm, but still not complete, in the next tutorial we will connecting it with nginx virtual host, and using some php framework.


Right now I implement on Digitalocean (it has referral link) because it’s fast and easy to deploy, my favorite feature is snapshot. I usually using the smallest one ($5 / month), when it goes well in the smallest one, it will be better on the bigger one.

Advertisements

3 thoughts on “[How to]Install PHP-FPM on Linux Centos 6.5 / 6.6

  1. Hi! At step 5, you’ll have to start the service “service php-fpm start” to create the .sock file. Only then, you can chown the file 🙂

    Great instructions! Thanks for providing this!

  2. I appreciated this- was able to get nginx and php 5.6 easily. Thanks for sharing it!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s