How Install Nginx, PHP 5.4 and PHP-FPM on CentOS

This is fast way how to install nginx, php 5.4 and other dependencies. Use this script on your own risk.


if ! [ $(id -u) = 0 ]; then
   echo "Please login via root!"
   exit 1


yum install  update

#Remi Dependency on CentOS 6 and Red Hat (RHEL) 6
rpm -Uvh
rpm -Uvh

#CentOS 6.4/6.3/6.2/6.1/6/5.9 Nginx repository
cat <<EOF >/etc/yum.repos.d/nginx.repo
name=nginx repo
#Install Nginx, PHP 5.4 and PHP-FPM
yum --enablerepo=remi,remi-test install nginx php-fpm php-common
#Install PHP 5.4 modules
yum --enablerepo=remi install php-pecl-apc php-cli php-pear php-pdo php-mysql php-pecl-memcache php-pecl-memcached php-gd php-mbstring php-mcrypt php-xml -y -y
#Start Nginx HTTP server and PHP-FPM
service nginx start
service php-fpm start
#Autostart Nginx and PHP-FPM on boot
chkconfig nginx on
chkconfig php-fpm on
#Install mysql
yum install mysql mysql-server -y
service mysqld start
chkconfig mysqld on


Leave a Reply

Your email address will not be published. Required fields are marked *