一、安装openssl
官网:https://www.openssl.org/source/
安装路径:
cd /usr/wubin
mkdir -p php8.0/openssl3.0
mkdir -p php8.0/php
解压:
tar zxvf openssl-3.0.2.tar.gz
cd openssl-3.0.2
./config --prefix=/usr/wubin/php8.0/openssl3.0 shared zlib-dynamic
编译:
make;
安装:
make install;
验证:
openssl version
显示版本,即安装成功;
二、安装php
官网:https://www.php.net/downloads.php
安装路径:
cd /usr/wubin/php8.0
解压:
tar zxvf php-8.0.18.tar.gz
cd php-8.0.18
安装依赖包:
sudo apt-get install pkg-config
sudo apt install libxml2-dev
sudo apt-get install libsqlite3-dev
编译:
./configure --prefix=/usr/wubin/php8.0/php --with-config-file-path=/usr/wubin/php8.0/php/php/etc --enable-debug --enable-fpm --with-fpm-user=root --with-fpm-group=root
--with-iconv-dir --with-freetype-dir=/usr/wubin/php8.0/php/freetype --with-mcrypt --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-inline-optimization --with-curl --enable-mbregex --enable-mbstring --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --with-xmlrpc --enable-zip --enable-soap --with-gettext --enable-opcache --with-xsl
编译:
make
安装
make install
验证:
cd /usr/wubin/php8.0/php/bin
./php -v
如图所示,显示版本,即安装成功
解压文件中,配置PHP相关文件并拷贝到安装目录
① 配置php.ini,这是php的配置文件
cp php.ini-development /usr/wubin/php8.0/php/lib/php.ini
② 进入安装目录,配置启动脚本
cd /usr/wubin/php8.0/php/etc
cp php-fpm.conf.default php-fpm.conf
③ 进入解压目录,拷贝启动脚本到指定目录
cd /usr/wubin/php-8.0.18/sapi/fpm
cp php-fpm.service /usr/lib/systemd/system/
启动:
systemctl daemon-reload
systemctl start php-fpm
systemctl enable php-fpm
systemctl status php-fpm
查看进程:
ps -ef|grep php-fpm
默认端口是9000;