安装包 和 依赖包 请自行网上查找 或者 联系文章作者 ## 一,oniguruma是什么?      oniguruma是一个处理正则表达式的库,我们之所以需要安装它,是因为在安装php7.4的过程中,mbstring的正则表达式处理功能对这个包有依赖性,所以我们要先安装这个库。 开源源码地址:https://github.com/kkos/oniguruma ## **一.安装PHP8依赖包** ``` yum -y install autoconf freetype gd libpng libpng-devel libjpeg libxml2 libxml2-devel zlib curl curl-devel net-snmp-devel libjpeg-devel php-ldap openldap-devel openldap-clients freetype-devel gmp-devel libzip libzip-devel sqlite-devel ``` ## **二.编译PHP8依赖包oniguruma** 1.解压 ``` tar -zxvf oniguruma-6.9.4.tar.gz ``` 2.切换目录 ``` cd oniguruma-6.9.4/ ``` 3.生成configure ``` ./autogen.sh ``` 4.生成编译配置文件 ``` ./configure --prefix=/usr ``` 5.编译并安装 ``` make && make install ``` ## **三.编译PHP8主包** 1.解压 ``` tar xzf php-8.0.0.tar.gz ``` 2.切换目录 ``` cd php-8.0.0/ ``` 3.生成编译配置文件 ``` ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-fpm --with-fpm-user=nginx --with-fpm-group=nginx --enable-mysqlnd --with-mysqli --with-pdo-mysql --enable-opcache --with-pcre-jit --enable-gd --with-jpeg --with-freetype --with-gettext --with-curl --with-openssl --enable-sockets --enable-mbstring --enable-xml --with-zip --with-zlib --with-snmp --with-mhash --enable-ftp --enable-bcmath --enable-soap --enable-shmop --enable-sysvsem --enable-pcntl --with-gmp ``` 4.编译并安装 ``` make && make install ``` ## **四.php8环境配置** 1.配置文件 ``` cp /usr/local/src/php-7.2.6/php.ini-development /usr/local/php/etc/php.ini ``` 2.配置文件语法检测 ``` /usr/local/php/sbin/php-fpm -t ``` 3.服务管理 1)启动 ``` /usr/local/php/sbin/php-fpm ``` 2)关闭 ``` pkill php-fpm ``` 3)重载 ``` pkill -USR2 php-fpm ``` 4.开机启动 ``` vi /etc/rc.local /usr/local/php/sbin/php-fpm ``` 5.nginx与php结合 #bbs.linux.com虚拟主机 ``` server{ listen 80; server_name bbs.linux.com; access_log logs/bbs.access.log main; location / { root html/bbs; index index.php index.html index.htm; } location ~ \.php(.*)$ { fastcgi_index index.php; fastcgi_pass 127.0.0.1:9000; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; #nginx支持tp fastcgi_param PATH_INFO $1; include fastcgi_params; } } ``` 查看更多 请跳转 https://learnku.com/articles/54738