LNMP项目部署(2)-编译安装PHP

LNMP项目实战:
L:Linux(centos 7.6) http://mirrors.cqu.edu.cn/CentOS/7.6.1810/isos/x86_64/
N:Nginx(1.12.2) https://nginx.org/en/download.html
M:MySQL(5.6.43) https://dev.mysql.com/downloads/mysql/5.6.html#downloads
P:PHP(7.2.15) http://php.net/downloads.php
Worldpress(5.0.3):https://cn.wordpress.org/download/

部署规划:
192.168.39.7:Nginx php-fpm 运行web服务
192.168.39.10:NFS存储服务器,存储上传的图片
192.168.39.101:运行MySQL数据库

LNMP项目部署(2)-编译安装PHP_第1张图片

一、部署PHP:

1、编译安装php 7.2.15
安装依赖包

yum -y install wget vim pcre pcre-devel openssl openssl-devel libicu-devel gcc gcc-c++ autoconf  libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel  glibc glibc-devel glib2 glib2-devel ncurses ncurses-devel curl curl-devel krb5-devel libidn libidn-devel openldap openldap-devel nss_ldap jemalloc-devel cmake boost-devel bison automake libevent libevent-devel gd gd- devel libtool* libmcrypt libmcrypt-devel mcrypt mhash libxslt libxslt-devel readline readline-devel gmp gmp-devel libcurl libcurl-devel openjpeg-devel
[root@Centos7 src]# pwd /usr/local/src 
[root@Centos7 src]# tar xf php-7.2.15.tar.gz 
[root@Centos7 src]#cd php-7.2.15
[root@Centos7 php-7.2.15]# ./configure --prefix=/apps/php --enable-fpm --with-fpm-user=www --with-fpm-group=www --with-pear --with-curl --with-png-dir --with-freetype-dir -- with-iconv --with-mhash --with-zlib --with-xmlrpc --with-xsl --with-openssl -- with-mysqli --with-pdo-mysql --disable-debug --enable-zip --enable-sockets --enable- soap --enable-inline-optimization --enable-xml --enable-ftp --enable-exif --enable- wddx --enable-bcmath --enable-calendar --enable-shmop --enable-dba --enable-sysvsem - -enable-sysvshm --enable-sysvmsg 
[root@Centos7 php-7.2.15]#  make -j 2 [
[root@Centos7 php-7.2.15]# # make install

2、准备PHP配置文件:

#生成配置文件
[root@Centos7 php-7.2.15]# cd /apps/php/etc/php-fpm.d/
[root@Centos7 php-fpm.d]# cp www.conf.default www.conf
[root@Centos7 php-fpm.d]# cp /usr/local/src/php-7.2.15/php.ini-production
/apps/php/etc/php.ini
[root@Centos7 php-fpm.d]# useradd www -s /sbin/nologin -u 1001
[root@Centos7 php-fpm.d]# grep -v ";" www.conf | grep -v "^$"
[www]
user = www
group = www
listen = 127.0.0.1:9000
listen.allowed_clients = 127.0.0.1
pm = dynamic
pm.max_children = 50
pm.start_servers = 30
pm.min_spare_servers = 30
pm.max_spare_servers = 35
pm.status_path = /pm_status
ping.path = /ping
ping.response = pong
access.log = log/$pool.access.log
slowlog = log/$pool.log.slow
[root@Centos7 etc]# mkdir /apps/php/log/ #日志文件路径
[root@Centos7 etc]# cd /apps/php/etc/
[root@Centos7etc]# cp php-fpm.conf.default php-fpm.conf

3、启动并验证php-fpm:

[root@Centos7 etc]#/app/php/sbin/php-fpm -t
[11-Apr-2020 00:38:17] NOTICE: configuration file /app/php/etc/php-fpm.conf test is successful

[root@Centos7 etc]#/app/php/sbin/php-fpm -c /app/php/etc/php.ini 
[root@Centos7 etc]#ss -ntl  #9000端口
State       Recv-Q Send-Q             Local Address:Port                            Peer Address:Port              

LISTEN      0      128                    127.0.0.1:631                                        *:*                  
LISTEN      0      100                    127.0.0.1:25                                         *:*                  
LISTEN      0      128                            *:42973                                      *:*                  
LISTEN      0      5                      127.0.0.1:25151                                      *:*                  
LISTEN      0      128                    127.0.0.1:9000                                       *:*                  
LISTEN      0      128                            *:111                                        *:*                  
LISTEN      0      5                  192.168.122.1:53                                         *:*                  
LISTEN      0      128                            *:22                                         *:*                  
LISTEN      0      128                        [::1]:631                                     [::]:*                  
LISTEN      0      100                        [::1]:25                                      [::]:*                  
LISTEN      0      128                         [::]:60588                                   [::]:*                  
LISTEN      0      128                         [::]:111                                     [::]:*                  
LISTEN      0      128                         [::]:22                                      [::]:*  

你可能感兴趣的:(计算机,nginx,mysql,linux,php)