1. Download the php5.5.34 version of PHP
Extract
2. Create PHP-FPM Users
useradd-s/sbin/nologin php-fpm
3. CD php5.5.34
Perform:
4. Compile: "Reference to Amin Linux configuration Options"
./configure \--prefix=/usr/local/php \--with-config-file-path=/usr/local/php/etc \--enable-fpm \--with-fpm-user= PHP-FPM \--with-fpm-group=php-fpm \--with-mysql=/usr/local/mysql \--with-mysql-sock=/tmp/mysql.sock \-- With-libxml-dir \--with-gd \--with-jpeg-dir \--with-png-dir \--with-freetype-dir \--with-iconv-dir \--with-zlib-dir \ --with-mcrypt \--enable-soap \--enable-gd-native-ttf \--enable-ftp \--enable-mbstring \--enable-exif \-- Enable-zend-multibyte \--disable-ipv6 \--with-pear \--with-curl \--with-openssl
2. After compiling/installing
1) Copy the configuration file
CP Php.ini-production/usr/local/php/etc/php.ini
2) Copy script:
CP SAPI/FPM/INIT.D.PHP-FPM/ETC/INIT.D/PHP-FPM can be edited by just a startup shell script
3) Modify Permissions PHP-FPM
Grant it the right to execute:
chmod 755/etc/init.d/php-fpm
Chkconfig--add PHP-FPM
Chkconfig PHP-FPM on
4) Start, service php-fpm start
Note Configuration file: php-fpm.conf
5) Before you start, you can also check the correctness of the configuration file:
/usr/local/php/sbin/php-fpm-t
6) Start
Process down, think MySQL installation is a bit similar.
Errors and Solutions:
1.configure:error:no acceptable C compiler found in $PATH
See ' Config.log ' for more details
Yum install-y gcc
2.
Configure:error:xml2-config not found. Please check your LIBXML2 installation.
Yum install-y libxml2.x86_64 libxml2-devel.x86_64
3.configure:error:cannot Find OpenSSL ' s
Yum install-y openssl.x86_64 openssl-devel.x86_64
4.
Error:please Reinstall the Libcurl distribution-
Easy.h should is in
/include/curl/
Yum install-y curl.x86_64 libcurl-devel.x86_64
5.checking whether to enable jis-mapped Japanese font support in GD ... No
If Configure fails try--with-vpx-dir=
Yum install libjpeg.x86_64 libpng.x86_64 freetype.x86_64 libjpeg-devel.x86_64 libpng-devel.x86_64 freetype-devel.x86_ 64-y
Test results:
6.
Configure:error:jpeglib.h not found.
This rub error, not install Libjpeg and Libjpeg-devel
Should be:
Yum install-y libjpeg-turbo.x86_64 libjpeg-turbo-devel.x86_64
7.
Mcrypt.h not found. Please reinstall Libmcrypt.
If you find that the Yum source does not have this installation package, you will need to expand the Yum Source:
Yum Install-y Epel-release.noarch
Then find the file
Yum install-y libmcrypt.x86_64 libmcrypt-devel.x86_64
8.
Error:cannot find MySQL header files Under/usr/local/mysql.
Note that the MySQL client library isn't bundled anymore!
9. Error when starting:
[ROOT@IP5 php-5.5.34]# Service php-fpm start
Starting PHP-FPM [27-apr-2016 17:24:21] error:failed to open configuration file '/usr/local/php/etc/php-fpm.conf ': No suc h file or directory (2)
[27-apr-2016 17:24:21] error:failed to load configuration file '/usr/local/php/etc/php-fpm.conf '
[27-apr-2016 17:24:21] ERROR:FPM initialization failed
Failed
Description is a configuration file that does not start php-fpm, then we only need to rename it in its installation path: Php-fpm.conf.defult: php-fpm.conf
10. When starting PHP-fpm, it appears:
When you start php-fpm, this tip doesn't know why?
[root@daiqing php-5.5.31]# Service php-fpm start
Starting PHP-FPM [14-jan-2016 06:16:59] ERROR: [Pool www] cannot get uid for user ' php-fpm '
[14-jan-2016 06:16:59] ERROR:FPM initialization failed
Failed
Cause analysis I:
Create user not successful, useradd-s/sbin/nologin php-fpm
11. Compile the time I, the parameter appears:
--enable-zend-multibyte:
The compilation parameter no longer exists.
12. View the compilation parameters for PHP:
/usr/local/php/bin/php-i |head