LNMP source code compilation and installation of PHP-5.5.32

1. FastCGI
LNMP source code compilation and installation of PHP-5.5.32
fast universal gateway interface (socket), which is supported by regular web programs for HTTP server and program service communication tools on other machines.

LNMP operation process and analysis principle
LNMP source code compilation and installation of PHP-5.5.32
principle vernacular
用户访问NginxWeb服务器-Ngixn负责解析静态数据(jpg,gif,css,js,avi,html)也接受动态数据(.php)动态数据通过FastCGI接口后抛(fastcgi_pass监听 http://x.x.x.x:9000)给PHP服务器(php-fpm多个进程监听9000端口)[进程配置文件php-fpm.conf设置进程数量]监听到请求就会调用wrapper程序,wrapper会再启多个线程调用PHP解析器(引擎)进行解析,如要连数据库则向后数据库(dbip,root.pass.port3306)进行请求.数据库再将数据通过FastCGI将数据发给Nginx服务器后,Nginx再给用户

Make sure nginx and database are started

[root@web01 ~]# netstat -tunlp|egrep "3306|80"
tcp        0      0 0.0.0.0:3306                0.0.0.0:*                   LISTEN      1657/mysqld         
tcp        0      0 0.0.0.0:80

Check the required php;lib library

[root@web01 ~]# rpm -qa zlib-devel libxml2-devel libjpeg-devel libjpeg-turbo-devel libiconv-devel freetype-devel libpng-devel gd-devel libcurl-devel 
libjpeg-turbo-devel-1.2.1-3.el6_5.x86_64
libpng-devel-1.2.49-2.el6_7.x86_64
freetype-devel-2.3.11-17.el6.x86_64
gd-devel-2.0.35-11.el6.x86_64
libcurl-devel-7.19.7-53.el6_9.x86_64
zlib-devel-1.2.3-29.el6.x86_64
libxml2-devel-2.7.6-21.el6_8.1.x86_64

Update bash source
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
update epel source
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo
yum install lib library and hash program

yum install -y zlib-devel libxml2-devel libjpeg-devel libjpeg-turbo-devel libiconv-devel freetype-devel libpng-devel gd-devel libcurl-devel libxslt-devel libmcrypt-devel
###########
yum install -y mcrypt mhash

cd /home/oldboy/tools/
wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
tar zxf libiconv-1.14.tar.gz
cd libiconv-1.14
./configure --prefix=/usr/local/libiconv


Centos7 下需要先操作如下

cd srclib/
sed -i -e '/gets is a security/d' ./stdio.in.h
|
make &&make install

*再次确认基础库和扩展库程序是否安装齐全*

[root@web01 tools]# rpm -qa zlib-devel libxml2-devel libjpeg-devel libjpeg-turbo-devel libiconv-devel freetype-devel libpng-devel gd-devel libcurl-devel libxslt-devel libmcrypt-devel mcrypt mhash
libxslt-devel-1.1.26-2.el6_3.1.x86_64
mhash-0.9.9.9-3.el6.x86_64
libjpeg-turbo-devel-1.2.1-3.el6_5.x86_64
libmcrypt-devel-2.5.8-9.el6.x86_64
libpng-devel-1.2.49-2.el6_7.x86_64
freetype-devel-2.3.11-17.el6.x86_64
gd-devel-2.0.35-11.el6.x86_64
libcurl-devel-7.19.7-53.el6_9.x86_64
zlib-devel-1.2.3-29.el6.x86_64
libxml2-devel-2.7.6-21.el6_8.1.x86_64
mcrypt-2.6.8-10.el6.x86_64

*要一步一检查*

* php安装*
http://mirrors.sohu.com/php/
* php安装参数*

./configure \
--prefix=/application/php5.5.32 --with-mysql=/application/mysql/ --with-pdo-mysql=mysqlnd --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 --with-openssl --with-mhash --enable-gd-native-ttf --enable-pcntl --enable-sockets --with-xmlrpc --enable-soap --enable-short-tags --enable-static --with-xsl --with-fpm-user=www --with-fpm-group=www --enable-ftp --enable-opcache=no

![](http://i2.51cto.com/images/blog/201804/22/cd54b3b62d9191d08991ceaeb9bf92c6.jpg?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)

[root@web01 php-5.5.32]# ln -s /application/mysql/lib/libmysqlclient.so.18 /usr/lib64/
[root@web01 php-5.5.32]# touch ext/phar/phar.phar

*编译*
`[root@web01 php-5.5.32]#make && make install`

![](http://i2.51cto.com/images/blog/201804/22/a0db43b042c12157eba086bd0fe0610b.jpg?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)

`[root@web01 php-5.5.32]# ln -s /application/php5.5.32/ /application/php`
*设置php-fpm主配置文件*

[root@web01 php-5.5.32]# cp php.ini-production /application/php/lib/php.ini
[root@web01 php5.5.32]# cd /application/php/etc/
[root@web01 etc]# cp php-fpm.conf.default php-fpm.conf

[root@web01 ~]# /application/php/sbin/php-fpm
[root@web01 ~]# lsof -i :9000
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
php-fpm 30476 root 7u IPv4 155336 0t0 TCP localhost:cslistener (LISTEN)
php-fpm 30477 www 0u IPv4 155336 0t0 TCP localhost:cslistener (LISTEN)
php-fpm 30478 www 0u IPv4 155336 0t0 TCP localhost:cslistener (LISTEN)
[root@web01 ~]# netstat -tunlp|grep "php-fpm"
tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN 30476/php-fpm

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324768154&siteId=291194637