I. Pre-installation Preparation
cd/usr/local/src/
Yum-y Install libmcrypt-devel mhash-devel libxslt-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-deve L LIBXML2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses Ncurses-devel Curl C Url-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel OpenSSL openssl-devel
Two. Install PHP
Download PHP
wget http://cn2.php.net/distributions/php-5.4.38.tar.gz
TAR-ZXVF php-5.4.38.tar.gz
CD php-5.4.38
./configure--prefix=/usr/local/php--enable-fpm--with-mcrypt--enable-mbstring--disable-pdo--with-curl-- Disable-debug--disable-rpath--enable-inline-optimization--with-bz2--with-zlib--enable-sockets--enable-sysvsem- -enable-sysvshm--enable-pcntl--enable-mbregex--with-mhash--enable-zip--with-pcre-regex--with-mysql-- With-mysqli--WITH-GD--with-jpeg-dir
An error occurred at this time: configure:error:mcrypt.h not found. Please reinstall Libmcrypt.
Workaround:
Rpm-ivh "http://www.lishiming.net/data/attachment/forum/month_1211/epel-release-6-7.noarch.rpm"
Yum Install-y libmcrypt-devel
Again
./configure--prefix=/usr/local/php--enable-fpm--with-mcrypt--enable-mbstring--disable-pdo--with-curl-- Disable-debug--disable-rpath--enable-inline-optimization--with-bz2--with-zlib--enable-sockets--enable-sysvsem- -enable-sysvshm--enable-pcntl--enable-mbregex--with-mhash--enable-zip--with-pcre-regex--with-mysql-- With-mysqli--WITH-GD--with-jpeg-dir
Make all Install
cd/usr/local/php
CP Etc/php-fpm.conf.default etc/php-fpm.conf
Vi/usr/local/php/etc/php-fpm.conf
Save after modification:
user = www-php
Group = www-php
Add user
Groupadd www-php
Useradd-g www-php www-php
Compiling Nginx
In the server segment, add:
# Pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
Location ~ \.php$ {
root HTML;
Fastcgi_pass 127.0.0.1:9000;
Fastcgi_index index.php;
Fastcgi_param script_filename $document _root$fastcgi_script_name;
Include Fastcgi_params;
}
Create a PHP test file
vi/usr/local/nginx/html/index.php
Add the following content:
<?php
Echo Phpinfo ();
?>
~
Start Nginx:
/usr/local/nginx/nginx
Start PHP
/usr/local/php/sbin/php-fpm
Test:
Links 192.168.66.176/index.php where 192.168.66.176 is an IP address
The test results show that the PHP version and other information are OK
centos6.5 nginx+php+mysql php5.4 Installation