在Ubuntu22.04中使用Phpbrew安装php7.4和php7.1

444 阅读1分钟

phpbrew 是一个构建、安装多版本 PHP 到用户根目录的工具 在Ubuntu22.04中安装php7.4 以及php7.1会出现openssl相关的问题,解决方式如下

# 找个地方下载openssl
wget https://www.openssl.org/source/openssl-1.1.1i.tar.gz
tar -zxvf openssl-1.1.1i.tar.gz
cd openssl-1.1.1i
# 我安装在家目录的library中
./Configure --prefix=$HOME/library/openssl-1.1.1i -fPIC -shared linux-x86_64
make -j 8
make instal

# 安装php7.4
export PKG_CONFIG_PATH=$HOME/library/openssl-1.1.1i/lib/pkgconfig
phpbrew --debug install 7.4.33 +default

# 这里安装curl到家目录下的library中
wget http://curl.haxx.se/download/curl-7.58.0.tar.bz2 
tar -xvjf curl-7.58.0.tar.bz2
cd curl-7.58.0
./configure --with-ssl=$HOME/library/openssl-1.1.1i/ssl --prefix=$HOME/library/curl-7.58.0
make -j 8
make instal
# 安装php7.1
phpbrew install 7.1.33 +default -- --with-curl=$HOME/library/curl-7.58.0 --with-openssl --with-openssl-dir=$HOME/library/openssl-1.1.1i

参考:

gitee镜像

ompiling-php74-with-the-openssl-extension-error-in-ubuntu-2204

1267#issuecomment-1156774731