1. Install all dependent packages for PHP
[email protected] ~]# Yum install zlib-devel libxml2-devel libjpeg-devel freetype-devel libpng-devel gd-devel libc Url-devel Libxslt-devel openssl-devel-y
Check if the installation is successful
[email protected] ~]# rpm-qa zlib-devel libxml2-devel libjpeg-turbo-devel freetype-devel libpng-devel gd-devel Lib Curl-devel Libxslt-devel Openssl-devel
Installing the Libiconv library that Yum cannot install
[
email protected] tools]# wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz[email Protected] tools]# tar zxf libiconv-1.14.tar.gz[[email protected] tools]# CD Libiconv-1.14[[email protected] Libiconv-1. 14]#./configure--prefix=/usr/local/libiconv[[email protected] libiconv-1.14]# make && make install
Add Ali's Epel.repo source (support library that Yum source cannot install) Libmcrypt-devel mhash mhash-devel mcrypt wget-o/etc/yum.repos.d/epel.repo/http Mirrors.aliyun.com/repo/epel-6.repo
Yum-y Install Libmcrypt libmcrypt-devel mhash mhash-devel mcrypt
2. Compile and install PHP (
php-5.5.32.tar.gz)
[
email protected] tools]# RZ [[email protected] tools]# rz-y[[email protected] tools]# tar XF php-5.5.32.tar.gz [[ Email protected] tools]# CD php-5.5.32
3. The compile parameters are installed when playing MySQL:
[Email protected] php-5.3.32]#/configure \--prefix=/application/php5.5.32 \
--with-mysql=/application/mysql/\
--with-iconv-dir=/usr/local/libiconv \
--with-freetype-dir \
--with-jpeg-dir \
--with-png-dir \
--with-zlib \
--WITH-LIBXML-DIR=/USR \
--enable-xml \
--disable-rpath \
--enable-bcmath \
--ENABLE-SHMOP \
--enable-sysvsem \
--enable-inline-optimization \
--with-curl \
--enable-mbregex \
--ENABLE-FPM \
--enable-mbstring \
--with-mcrypt \
--WITH-GD \
--ENABLE-GD-NATIVE-TTF \
--WITH-OPENSSL \
--with-mhash \
--ENABLE-PCNTL \
--enable-sockets \
--WITH-XMLRPC \
--enable-zip \
--ENABLE-SOAP \
--enable-short-tags \
--enable-static \
--with-xsl \
--with-fpm-user=apache \
--with-fpm-group=apache \--enable-opcache=no
--enable-ftp
4. Compiling the PHP software process
[email protected] php-5.5.32]# ln-s/application/mysql/lib/libmysqlclient.so.18/usr/lib64/[[email protected] php-5.5.32]# touch Ext/phar/phar.phar[[email protected] php-5.5.32]# make #出现Bulit comple Te.
5. Install the PHP build file to the system
[email protected] php-5.5.32]# make install #Installing PDO headers:
6. Configure the PHP engine configuration file php.ini
[email protected] php-5.5.32]# ln-s/application/php5.5.32/application/php[[email protected] php-5.5.32]# Ll/app lication/phplrwxrwxrwx 1 root root 18:32/application/php-/application/php5.5.32[[email protected] php-5.5 .32]# ls php.ini*php.ini-development php.ini-production #分别用于测试环境和生产环境 [[email protected] php-5.5.32]# CP Php.ini-production/application/php/lib/php.ini[[email protected] php-5.5.32]# ls-l/application/php/lib/ php.ini-rw-r--r--1 root root 69266 18:33/application/php/lib/php.ini
7. Configure the PHP service (fastcgi mode) configuration file php-fpm.conf
[email protected] php-5.5.32]# cd/application/php/etc/[[email protected] etc]# lspear.conf php-fpm.conf.default[ [email protected] etc]# cp php-fpm.conf.default php-fpm.conf #php-fpm.conf subsequent optimizations
8. Start the PHP service
(fastcgi mode)
[[email protected] etc]#/application/php/sbin/php-fpm [[email protected] etc]# ps-ef|grep Php-fpmroot 13440 1 0 18:39? 00:00:00 php-fpm:master process (/application/php5.5.32/etc/php-fpm.conf) Nginx 13441 13440 0 18:39? 00:00:00 php-fpm:pool www nginx 13442 13 0 18:39? 00:00:00 php-fpm:pool www root 13451 &N bsp;1724 0 18:40 pts/1 00:00:00 grep php-fpm[[email protected] etc]# lsof-i:9000command PI D user FD TYPE DEVICE size/off NODE namephp-fpm 13440 root 7u ipv4 184892 &NB Sp 0t0 tcp Localhost:cslistener (LISTEN) php-fpm 13441 nginx 0u ipv4 184892 &NBSP ; 0t0 tcp Localhost:cslistener (LISTEN) php-fpm 13442 nginx 0u ipv4 184892 0t0 tcp Localhost:cslistener (LISTEN)
PHP---Compile and install PHP