#
!/bin
/bash
#auto Source Code install PHP
#by author toyix
#
2020年
7月
2日
14:08:02
echo
"安装vim wget lrzsz"
yum install
-y wget lrzsz vim
echo
"安装阿里base及epel源"
wget
-O
/etc
/yum
.repos
.d
/CentOS
-Base
.repo https
://mirrors
.aliyun
.com
/repo
/Centos
-7.repo
wget
-O
/etc
/yum
.repos
.d
/epel
.repo http
://mirrors
.aliyun
.com
/repo
/epel
-7.repo
echo
"清缓存"
yum clean all
yum makecache
echo
"安装软件环境支持"
yum install
-y libjpeg libpng
-devel freetype freetype
-devel libxslt libxslt
-devel libXpm
-devel sqlite
-devel bzip2 bzip2
-devel libjpeg libjpeg
-devel libpng libpng
-devel oniguruma oniguruma
-devel libcurl libcurl
-devel postgresql
-devel openssl openssl
-devel libzip libxml2 libxml2
-devel pcre2 pcre
-devel pcre gcc gcc
-c
++
echo
"软件下载"
cd
/usr
/src
wget
-c https
://www
.php
.net
/distributions
/php
-7.4.6.tar
.gz
echo
"创建nginx用户"
useradd
-s
/sbin
/nologin
-r nginx
-M
echo
"解压、编译、安装"
tar
-zxvf php
-7.4.6.tar
.gz
cd php
-7.4.6
./configure \
--prefix
=/usr
/local
/php7 \
--enable
-fpm \
--with
-fpm
-user
=nginx \
--with
-fpm
-group
=nginx \
--enable
-debug \
--enable
-gd \
--with
-jpeg \
--with
-pgsql \
--enable
-inline-optimization \
--with
-bz2 \
--with
-zlib
-dir \
--with
-freetype \
--enable
-mbstring \
--enable
-soap \
--with
-openssl \
--enable
-calendar \
--with
-curl \
--enable
-ftp \
--with
-gettext \
--with
-xmlrpc \
--with
-xsl \
--enable
-opcache \
--with
-iconv \
--with
-pdo
-mysql
=mysqlnd \
--with
-mysqli
=mysqlnd \
--with
-kerberos \
--with
-pdo
-sqlite \
--with
-pear \
--enable
-shmop \
--enable
-xml \
--with
-zlib \
--enable
-sockets \
--enable
-sysvsem \
--enable
-pcntl \
--enable
-mbregex \
--enable
-exif \
--enable
-bcmath \
--with
-mhash \
--with
-zlib
-dir \
--with
-pcre
-jit \
--with
-config
-file
-path
=/usr
/local
/php7
/etc
make
-j4
&& make install
-j4
echo
"主配置文件"
cp php
.ini
-development
/usr
/local
/php7
/etc
/php
.ini
echo
"次配置文件"
cp
/usr
/local
/php7
/etc
/php
-fpm
.conf
.default /usr
/local
/php7
/etc
/php
-fpm
.conf
echo
"修改Php-fpm配置文件中的include默认文件名"
cp
/usr
/local
/php7
/etc
/php
-fpm
.d
/www
.conf
.default /usr
/local
/php7
/etc
/php
-fpm
.d
/default.conf
echo
"配置启动文件php-fpm及软链接"
cp
/usr
/src
/php
-7.4.6/sapi
/fpm
/init
.d
.php
-fpm
/etc
/init
.d
/php
-fpm
chmod
+x
/etc
/init
.d
/php
-fpm
ln
-s
/etc
/init
.d
/php
-fpm
/usr
/sbin
/php
-fpm
echo
"启动php-fpm"
php
-fpm start
ps
-ef
|grep php
-fpm
netstat
-tnlp
执行结果
You may want to add
: /usr
/local
/php7
/lib
/php to your php
.ini include_path
Installing phpdbg binary
: /usr
/local
/php7
/bin
/
Installing PHP FPM defconfig
: /usr
/local
/php7
/etc
/
Installing PHP CLI man page
: /usr
/local
/php7
/php
/man
/man1
/
Installing PHP CGI binary
: /usr
/local
/php7
/bin
/
Installing PHP FPM man page
: /usr
/local
/php7
/php
/man
/man8
/
Installing phpdbg man page
: /usr
/local
/php7
/php
/man
/man1
/
Installing PHP FPM status page
: /usr
/local
/php7
/php
/php
/fpm
/
/usr
/src
/php
-7.4.6/build
/shtool install
-c ext
/phar
/phar
.phar
/usr
/local
/php7
/bin
ln
-s
-f phar
.phar
/usr
/local
/php7
/bin
/phar
Installing PHP CGI man page
: /usr
/local
/php7
/php
/man
/man1
/
Installing header files
: /usr
/local
/php7
/include
/php
/
主配置文件
次配置文件
修改Php
-fpm配置文件中的include默认文件名
配置启动文件php
-fpm及软链接
启动php
-fpm
Starting php
-fpm done
root
64276 1 0 14:46 ? 00:00:00 php
-fpm
: master process
(/usr
/local
/php7
/etc
/php
-fpm
.conf
)
nginx
64277 64276 0 14:46 ? 00:00:00 php
-fpm
: pool www
nginx
64278 64276 0 14:46 ? 00:00:00 php
-fpm
: pool www
root
64280 2099 0 14:46 pts
/0 00:00:00 grep php
-fpm
Active Internet connections
(only servers
)
Proto Recv
-Q Send
-Q Local Address Foreign Address State PID
/Program name
tcp
0 0 127.0.0.1:25 0.0.0.0:* LISTEN
1768/master
tcp
0 0 127.0.0.1:9000 0.0.0.0:* LISTEN
64276/php
-fpm
: mast
tcp
0 0 0.0.0.0:22 0.0.0.0:* LISTEN
1552/sshd
tcp6
0 0 ::1:25 :::* LISTEN
1768/master
tcp6
0 0 :::22 :::* LISTEN
1552/sshd
[root@localhost
~]#
-------------end