Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
PHP5.6 and NGINX: Install PHP56-FPM, Nginx & MySQL on EC2 with Amazon Linux AMI
# Install linux update, followed by GCC and Make
sudo yum -y update
sudo yum install -y gcc make
# Install Nginx and php56-FPM
sudo yum install -y nginx php56-fpm
# Install php56 extensions
sudo yum install -y php56-devel php-mysql php56-pdo php56-pear php56-mbstring php56-cli php56-odbc php56-imap php56-gd php56-xml php56-soap
#Install php mysql for pdo
sudo yum install php56-mysqlnd
# Install php56-APC
sudo yum install -y php56-pecl-apc
sudo yum install -y pcre-devel
# Install MySQL
sudo yum -y install mysql-server mysql
# Nginx Configuration
sudo nano /etc/nginx/conf.d/default.conf
# php56-FPM Configuration
sudo nano /etc/php-fpm.d/www.conf
# Autostart Nginx, php56-FPM and MySQL
sudo chkconfig nginx on
sudo chkconfig mysqld on
sudo chkconfig php-fpm on
server{
location / {
root /var/www/html;
index index.php index.html index.htm;
}
location ~ \.php$ {
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/html$fastcgi_script_name;
include fastcgi_params;
}
}
[...]
user = nginx
group = nginx
;listen = 127.0.0.1:9000
listen = /var/run/php-fpm/php-fpm.sock
;listen.owner = nobody
listen.owner = nginx
;listen.group = nobody
listen.group = nginx
;listen.mode = 0666
listen.mode = 0664
[...]
@punchi

This comment has been minimized.

Copy link

punchi commented Nov 17, 2015

thanks for the instructions =) some questions, why install "gcc", "make" and "pcre-devel" ? if you already have php56-mysqlnd, you need php-mysql too?

@santoshachari

This comment has been minimized.

Copy link
Owner Author

santoshachari commented Dec 12, 2015

@punchi, Just a fork of this version https://gist.github.com/sumardi/5559803.
Had to fix to work for 5.6. You could be right of not needing it.

@Modelizer

This comment has been minimized.

Copy link

Modelizer commented May 22, 2016

It seems that sudo nano /etc/nginx/conf.d/default.conf should be change to sudo nano /etc/nginx/nginx.conf or else might be some nginx version conflict.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.