Recently in learning Nginx, read a lot of posts finally installed successfully.
Experience, first do not use Yum installation, after installation can not find the installation directory where Ah, and then installation failure will be very inconvenient.
Finally chose to compile the installation itself.
Read a lot of posts are not, and finally found a reliable ah, good detail. Post Address http://www.cnblogs.com/zxpo/p/3798983.html
PHP-FPM hit patch
Cd/usr/local/src
GZIP-CD php-5.2.8-fpm-0.5.10.diff.gz | Patch-d PHP-5.2.8-P1
The following is the pasted post content;
1. Download PHP Source Package
http://www.php.net/downloads.php
2. Install PHP
TAR-XVF php-5.5.13.tar.bz2
CD php-5.5.13
./configure--prefix=/usr/local/php--with-config-file-path=/etc--enable-inline-optimization--disable-debug-- Disable-rpath--enable-shared--enable-opcache--enable-fpm--with-fpm-user=www--with-fpm-group=www--with-mysql= Mysqlnd--with-mysqli=mysqlnd--with-pdo-mysql=mysqlnd--with-gettext--enable-mbstring--with-iconv--with-mcrypt-- With-mhash--with-openssl--enable-bcmath--enable-soap--with-libxml-dir--enable-pcntl--enable-shmop-- Enable-sysvmsg--enable-sysvsem--enable-sysvshm--enable-sockets--with-curl--with-zlib--enable-zip--with-bz2-- With-readline--without-sqlite3--without-pdo-sqlite--with-pear
Error occurred: Congigure error:xml2-config not found.
Workaround:
Execute command: sudo yum install Libxml2-devel
To see if it was successful: Find/-name "Xml2-config"
Error occurred: Congigure error:cannot find OpenSSL ' s <evp.h>
Workaround:
Yum Install OpenSSL Openssl-devel
Ln-s/usr/lib64/libssl.so/usr/lib/
Error occurred: Configure:error:Please Reinstall the BZIP2 distribution
Workaround: Yum Install bzip2 Bzip2-devel
Error occurred: Configure:error:Please Reinstall the Libcurl distribution-easy.h should be in <curl-dir>/include/curl/
Workaround: Yum-y Install Curl-devel
Configure:error:mcrypt.h not found. Please reinstall Libmcrypt.
sudo yum install libmcrypt libmcrypt-devel mcrypt Mhash
Configure:error:Please Reinstall Readline-i Cannot find readline.h
sudo yum install Readline-devel
Make
Make install
Adding PHP commands to environment variables
Vim/etc/profile
Join at the end
Path= $PATH:/usr/local/php/bin
Export PATH
To make the change take effect immediately execution
. /etc/profile or Source/etc/profile
View environment variables
Echo $PATH
View PHP Version
Php-v
PHP 5.5.13 (CLI) (Built:jun 20 2014 11:11:26)
Copyright (c) 1997-2014 the PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
Configure PHP-FPM
Cd/usr/local/php/etc
CP Php-fpm.conf.default php-fpm.conf
Start PHP-FPM
sudo/usr/local/php/sbin/php-fpm
Modify Nginx configuration file (/etc/nginx/conf.d/default.conf)
Location/{
root Web directory;
Index index.html index.htm index.php;
}
Location ~ \.php$ {
root HTML;
Fastcgi_pass 127.0.0.1:9000;
Fastcgi_index index.php;
Fastcgi_param script_filename Web root directory $fastcgi_script_name;
Include Fastcgi_params;
}
Re-start Nginx
/etc/init.d/nginx restart
Create a index.php under the Web root directory
<?php echo phpinfo ();?>
Enter http://ip/index.php in the browser to see the success.
Note: Modify the Web root directory according to your own configuration, as my/usr/share/nginx/html.
If the startup PHP-FPM error occurs: Can not get uid for WWW, modify php-fpm.conf user to Nginx Group for Nginx
Nginx Install PHP and PHP-FPM