#下载编译安装
yum remove libzip
wget https://libzip.org/download/libzip-1.3.2.tar.gz
tar zxvf libzip-1.3.2.tar.gz
cd libzip-1.3.2
./configure
make && make install
#下载
cd /usr/local
wget http://cn.php.net/distributions/php-7.3.7.tar.gz
#解压
tar zxvf php-7.3.7.tar.gz
#安装依赖包
yum -y install libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel MySQL pcre-devel openssl openssl-devel curl-devel libxslt-devel
#cd进入目录
cd php-7.3.7
#php报错configure: error: off_t undefined; check your library configuration 解决办法
echo '/usr/local/lib64
/usr/local/lib
/usr/lib
/usr/lib64'>>/etc/ld.so.conf&&ldconfig -v
#检查编译安装
./configure --prefix=/usr/local/php --with-curl --with-freetype-dir --with-gd --with-gettext --with-iconv-dir --with-kerberos --with-libdir=lib64 --with-libxml-dir --with-mysqli --with-openssl --with-pcre-regex --with-pdo-mysql --with-pdo-sqlite --with-pear --with-png-dir --with-xmlrpc --with-xsl --with-zlib --enable-fpm --enable-bcmath --enable-libxml --enable-inline-optimization --enable-mbregex --enable-mbstring --enable-opcache --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sysvsem --enable-xml --enable-zip --with-jpeg-dir
make && make install
#复制
cp php.ini-production /usr/local/php/lib/php.ini
vim /usr/local/php/lib/php.ini
display_errors = On
:wq!
#设置启动
cp ./sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
chmod +x /etc/init.d/php-fpm
#加入服务
chkconfig --add php-fpm
#开机自启
chkconfig php-fpm on
#查看服务列表
chkconfig --list
#设置配置
cd /usr/local/php/etc
cp php-fpm.conf.default php-fpm.conf
#修改user和group的用户为当前用户(也可以不改,默认会添加nobody这个用户和用户组)
vim php-fpm.conf
#去掉前面的分号
pid = run/php-fpm.pid
cd php-fpm.d
cp www.conf.default www.conf
vim www.conf //不用修改
编辑/etc/profile文件
加入
PATH=$PATH:/usr/local/php/bin
php -v
关闭
pkill php-fpm
查看进程
ps -ef|grep php
#php-fpm启动命令
/etc/init.d/php-fpm start
#php-fpm停止命令
/etc/init.d/php-fpm stop
#php-fpm重启命令
/etc/init.d/php-fpm restart
//不配置全局变量启动
/usr/local/php/bin/php think worker:server
/usr/local/php/bin/php think queue:listen