lnmp---php的源码安装与配置

编译、安装
[root@server1 ~]# ls
  php-5.6.35.tar.bz2
[root@server1 ~]# tar jxf php-5.6.35.tar.bz2 (安装包解压)
[root@server1 ~]# cd php-5.6.35
[root@server1 php-5.6.35]# ./configure --prefix=/usr/local/lnmp/php --with-config-file-path=/usr/local/lnmp/php/etc --with-openssl 
--with-snmp --with-gd --with-zlib --with-curl --with-libxml-dir
--with-png-dir --with-jpeg-dir --with-freetype-dir --with-gmp 
--with-gettext --with-pear --enable-mysqlnd --with-mysql=mysqlnd
--with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd 
--enable-inline-optimization --enable-soap --enable-ftp
--enable-sockets --enable-mbstring --enable-fpm
--with-fpm-user=nginx --with-fpm-group=nginx
--with-mcrypt --with-mhash

在编译的过程中会不断提示我们需要安装其他软件来支持。我们一一安装。

[root@server1 php-5.6.35]# yum install libxml2-devel -y
[root@server1 php-5.6.35]# yum install openssl-devel -y
[root@server1 php-5.6.35]# yum install libcurl-devel -y
[root@server1 php-5.6.35]# yum whatprovides */jpeglib.h(查看合适的软件)
[root@server1 php-5.6.35]# yum install libjpeg-turbo-devel-1.2.1-1.el6.x86_64 -y
[root@server1 php-5.6.35]# yum whatprovides */png.h
[root@server1 php-5.6.35]# yum install libpng-devel-1.2.49-1.el6_2.x86_64
[root@server1 php-5.6.35]# yum install -y freetype-devel
[root@server1 php-5.6.35]# yum whatprovides */png.h
[root@server1 php-5.6.35]# yum whatprovides */gmp.h
[root@server1 php-5.6.35]# yum install gmp-devel-4.3.1-7.el6_2.2.x86_64
[root@server1 ~]#  ls
         libmcrypt-devel-2.5.8-9.el6.x86_64.rpm   	libmcrypt-2.5.8-9.el6.x86_64.rpm 
[root@server1 ~]# yum install libmcrypt-* -y
[root@server1 php-5.6.35]# yum install -y net-snmp-devel
[root@server1 php-5.6.35]# ./configure --prefix=/usr/local/lnmp/php --with-config-file-path=/usr/local/lnmp/php/etc --with-openssl 
--with-snmp --with-gd --with-zlib --with-curl --with-libxml-dir
--with-png-dir --with-jpeg-dir --with-freetype-dir --with-gmp 
--with-gettext --with-pear --enable-mysqlnd --with-mysql=mysqlnd
--with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd 
--enable-inline-optimization --enable-soap --enable-ftp
--enable-sockets --enable-mbstring --enable-fpm
--with-fpm-user=nginx --with-fpm-group=nginx
--with-mcrypt --with-mhash
(再次编译,无报错成功)
[root@server1 php-5.6.35]# make && make install
配置
[root@server1 php-5.6.35]# cd /usr/local/lnmp/
[root@server1 lnmp]# cd php/
[root@server1 php]# cd etc/
[root@server1 etc]# ls
pear.conf  php-fpm.conf.default
[root@server1 etc]# cp php-fpm.conf.default php-fpm.conf
[root@server1 etc]# vim php-fpm.conf(编辑配置文件)
	25 pid = run/php-fpm.pid
[root@server1 ~]# cd php-5.6.35
[root@server1 php-5.6.35]# cp php.ini-production /usr/local/lnmp/php/etc/php.ini
[root@server1 php-5.6.35]# cd /usr/local/lnmp/php/etc/
[root@server1 etc]# ls
pear.conf  php-fpm.conf  php-fpm.conf.default  php.ini
[root@server1 etc]# vim php.ini 
	936 date.timezone =Asia/Shanghai(修改时区)
[root@server1 etc]# cd 
[root@server1 ~]# find * -name init.d.php-fpm(查找此文件所在)
php-5.6.35/sapi/fpm/init.d.php-fpm
[root@server1 ~]# cd php-5.6.35/sapi/fpm/
[root@server1 fpm]# cp init.d.php-fpm  /etc/init.d/php-fpm
[root@server1 fpm]# chmod +x /etc/init.d/php-fpm (添加执行权限)
[root@server1 fpm]# /etc/init.d/php-fpm start
	Starting php-fpm [20-Feb-2019 15:24:42] ERROR: [pool www] cannot get uid for user 'nginx'(报错,没有nginx用户)
[root@server1 fpm]# useradd nginx(创建所需用户)
开启服务成功

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/weixin_43328213/article/details/87798155