yum 安装依赖包
代码语言:javascript复制yum install -y 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 bzip2 bzip2-devel ncurses curl curl-devel openssl-devel gdbm-devel db4-devel libXpm-devel libX11-devel gd-devel gmp-devel readline-devel libxslt-devel expat-devel xmlrpc-c xmlrpc-c-devel libwebp-devel libwebp libjpeg-turbo-devel libedit-devel
autoconf
代码语言:javascript复制cd
wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz
tar xvf autoconf-2.69.tar.gz
cd autoconf-2.69
./configure --prefix=/usr
make && sudo make install
automake
代码语言:javascript复制cd
wget http://ftp.gnu.org/gnu/automake/automake-1.14.tar.gz
tar xvf automake-1.14.tar.gz
cd automake-1.14
./configure --prefix=/usr
make && sudo make install
bison
代码语言:javascript复制cd
wget http://ftp.gnu.org/gnu/bison/bison-2.5.1.tar.gz
tar xvf bison-2.5.1.tar.gz
cd bison-2.5.1
./configure --prefix=/usr
make && sudo make install
zlib 版本 不能过低
代码语言:javascript复制yum remove libzip -y
cd
wget http://rpms.remirepo.net/enterprise/6/remi/x86_64//libzip-last-1.1.3-1.el6.remi.x86_64.rpm
rpm -Uvh libzip-last-1.1.3-1.el6.remi.x86_64.rpm
wget http://rpms.remirepo.net/enterprise/6/remi/x86_64//libzip-last-devel-1.1.3-1.el6.remi.x86_64.rpm
rpm -Uvh libzip-last-devel-1.1.3-1.el6.remi.x86_64.rpm
下载 php 7.3.9 源码包
代码语言:javascript复制cd
wget https://www.php.net/distributions/php-7.3.9.tar.gz
tar -xvf php-7.3.9.tar.gz
cd php-7.3.9
生成 configure
代码语言:javascript复制./buildconf --force
configure
代码语言:javascript复制./configure --prefix=/usr/local/php7.3.9 --with-config-file-scan-dir=/usr/local/php7.3.9/etc --enable-fpm --enable-calendar --enable-ctype --enable-dom --enable-exif --enable-fileinfo --enable-filter --enable-hash --enable-json --enable-libxml --enable-mbstring --enable-opcache --enable-pcntl --enable-phar --enable-pdo --enable-posix --enable-session --enable-simplexml --enable-soap --enable-tokenizer --enable-xml --enable-xmlreader --enable-xmlwriter --enable-zip --enable-gd-native-ttf --with-mcrypt --with-bz2 --with-curl --with-freetype-dir --with-gd --with-iconv --with-jpeg-dir --with-openssl --with-mysql=mysqlnd --with-pdo-mysql=mysqlnd --with-png-dir --with-readline --with-zlib
编译安装
代码语言:javascript复制make && make install
复制配置文件
代码语言:javascript复制cp ~/php-7.3.9/php.ini-development /usr/local/php7.3.9/etc/php.ini
cp /usr/local/php7.3.9/etc/php-fpm.conf.default /usr/local/php7.3.9/etc/php-fpm.conf
cp /usr/local/php7.3.9/etc/php-fpm.d/www.conf.default /usr/local/php7.3.9/etc/php-fpm.d/www.conf
启动、关闭、重启
php 5.3.3 以后不再支持 sbin/php-fpm (start|stop|reload),需要使用信号控制。
master进程可以理解以下信号: INT, TERM 立刻终止 QUIT 平滑终止 USR1 重新打开日志文件 USR2 平滑重载所有worker进程并重新载入配置和二进制模块
在 php-fpm.conf 文件,打开 pid 注释行(去除前面的 ;)
代码语言:javascript复制vi /usr/local/php7.3.9/etc/php-fpm.conf
pid = run/php-fpm.pid
php-fpm 启动:
代码语言:javascript复制/usr/local/php7.3.9/sbin/php-fpm
php-fpm 关闭:
代码语言:javascript复制kill -INT `cat /usr/local/php7.3.9/var/run/php-fpm.pid`
php-fpm 重启:
代码语言:javascript复制kill -USR2 `cat /usr/local/php7.3.9/var/run/php-fpm.pid`