Ubuntu 24 下编译安装 PHP 7.4.33 遇到的坑

| 选择喜欢的代码风格  

Ubuntu 24 下 openssl 3.0


由于 PHP 7.4.33 编译安装不能和 openssl 3.0 兼容,只能用 1.1.1,这里 MAKR 一下,算是记录一个坑:

wget https://www.openssl.org/source/old/1.1.1/openssl-1.1.1w.tar.gz
tar -xvf openssl-1.1.1w.tar.gz
cd openssl-1.1.1w

# 注意这里 C 是大写!
./Configure --prefix=/opt/openssl-1.1.1 --openssldir=/opt/openssl-1.1.1 -fPIC -shared linux-x86_64

make
sudo make install  # 非 root,在 make install 需要 sudo!

PKG_CONFIG_PATH


echo 'export PKG_CONFIG_PATH=/opt/openssl-1.1.1/lib/pkgconfig' >>/etc/profile
echo 'export OPENSSL_CONF=/usr/lib/ssl/openssl.cnf' >>/etc/profile
source /etc/profile

# 如果非 root,使用下面命令生效:
sudo bash -c "echo 'export OPENSSL_CONF=/usr/lib/ssl/openssl.cnf' >> /etc/profile"

# 多个 PKG_CONFIG_PATH 组合 FYI:
export PKG_CONFIG_PATH=/usr/local/libgd/2_3_2/lib/pkgconfig:/opt/openssl-1.1.1/lib/pkgconfig
sudo bash -c "echo 'export OPENSSL_CONF=/usr/lib/ssl/openssl.cnf' >> /etc/profile" # 非 root
 

CommandNotFound ⚡️ 坑否 - 其他频道扩展阅读:




发表评论