码迷,mamicode.com
首页 > Web开发 > 详细

LNMP源码编译安装之PHP-5.5.32

时间:2018-04-23 00:17:03      阅读:263      评论:0      收藏:0      [点我收藏+]

标签:linux   LNMP   nginx   php   

一.FastCGI
技术分享图片
快速通用网关接口(socket),为HTTP服务器与其他机器上的程序服务通信交流工具常规web程序都支持。

LNMP运行过程和解析原理
技术分享图片
原理白话
用户访问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再给用户

确定nginx与数据库是启动的

[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

检查php所需的;lib库

[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

更新bash源
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
更新epel源
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo

yum安装lib库及哈希程序

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

要一步一检查

./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

技术分享图片

[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

技术分享图片

[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

LNMP源码编译安装之PHP-5.5.32

标签:linux   LNMP   nginx   php   

原文地址:http://blog.51cto.com/jungiewolf/2106626

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!