php8编译安装

编译安装php-fpm

安装前准备工作
centos下执行

yum -y install gcc automake autoconf libtool make

yum -y install gcc gcc-c++ glibc

yum -y install libmcrypt-devel mhash-devel libxslt-devel \
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 ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel \
krb5 krb5-devel libidn libidn-devel openssl openssl-devel

下载

wget https://www.php.net/distributions/php-8.0.9.tar.gz

解压:

tar -zxvf php-8.0.9.tar.gz

配置与安装


./configure --prefix=/usr/local/php/php-8.0.9 --with-config-file-path=/usr/local/php/php-8.0.9/etc 
--with-curl --with-freetype --enable-gd --with-jpeg  --with-gettext --with-kerberos --with-libdir=lib64 --with-libxml 
--with-mysqli --with-openssl --with-pdo-mysql  --with-pdo-sqlite --with-pear --enable-sockets --with-mhash --with-ldap-sasl 
--with-xsl --with-zlib --with-zip -with-bz2 --with-iconv  --enable-fpm --enable-pdo  --enable-bcmath  --enable-mbregex 
--enable-mbstring --enable-opcache --enable-pcntl  --enable-shmop --enable-soap --enable-sockets --enable-sysvsem 
--enable-xml --enable-sysvsem --enable-cli --enable-opcache --enable-intl --enable-calendar --enable-static --enable-mysqlnd

配置成功后的提示

+--------------------------------------------------------------------+
| License:                                                           |
| This software is subject to the PHP License, available in this     |
| distribution in the file LICENSE. By continuing this installation  |
| process, you are bound by the terms of this license agreement.     |
| If you do not agree with the terms of this license, you must abort |
| the installation process at this point.                            |
+--------------------------------------------------------------------+
 
Thank you for using PHP.

然后安装

make && make install

以上完成了php安装,下面对php-fpm运行用户设置

[root@VM-0-14-centos php-8.0.9]# cd /usr/local/php/php-8.0.9
[root@VM-0-14-centos php-8.0.9]# cp etc/php-fpm.conf.default etc/php-fpm.conf
[root@VM-0-14-centos php-8.0.9]# vi etc/php-fpm.conf

修改

user = www
group = www
groupadd www
useradd -g www www

生成php.ini配置文件:

[root@VM-0-14-centos php-8.0.9]#  cp php.ini-production /usr/local/php/php-8.0.9/etc/php.ini

生成www.conf配置文件

[root@VM-0-14-centos php-8.0.9]#  cd /usr/local/php/php-8.0.9/etc/php-fpm.d/
[root@VM-0-14-centos php-fpm.d]#  cp www.conf.default www.conf

生成php-fpm的配置文件

[root@VM-0-14-centos php-fpm.d]# cd /usr/local/soft/php8/etc/
[root@VM-0-14-centos etc]# cp php-fpm.conf.default php-fpm.conf

生成php-fpm启动文件

[root@VM-0-14-centos ~]# mkdir /usr/local/php/php-8.0.9/daemon
[root@VM-0-14-centos ~]# cp /usr/local/php/php-8.0.9/sapi/fpm/init.d.php-fpm /usr/local/php/php-8.0.9/daemon/php-fpm
[root@VM-0-14-centos ~]# chmod 740 /usr/local/php/php-8.0.9/daemon/php-fpm

启动php-fpm

[root@VM-0-14-centos ~]# /usr/local/php/php-8.0.9/daemon/php-fpm start
Starting php-fpm  done
php安装可能出现的错误

1.php configure时出错
configure: error: XML configuration could not be found

apt-get install libxml2 libxml2-dev  (ubuntu下)
yum -y install libxml2 libxml2-devel(centos下)

如果遇到其它具体问题可参考下列链接:
nginx和php-fpm安装
https://www.cnblogs.com/architectforest/p/14048487.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值