使用openssl配置php-8.1



我想构建支持openssl3的php8.1。首先,我编译并安装了openssl3

./config -fPIC shared --prefix=/opt/openssl
make test
make install
ln -s /opt/openssl/lib64/libssl.so.3 /usr/lib64/libssl.so.3
ln -s /opt/openssl/lib64/libcrypto.so.3 /usr/lib64/libcrypto.so.3
sudo mv /bin/openssl /bin/openssl.backup
ln -s /opt/openssl/bin/openssl /usr/bin/
openssl version
OpenSSL 3.0.5 5 Jul 2022 (Library: OpenSSL 3.0.5 5 Jul 2022)

接下来我尝试配置php-8.1

./configure --with-config-file-path=/etc/php 
--sysconfdir=/etc/php.d 
--enable-mysqlnd 
--with-pdo-mysql 
--with-pdo-mysql=mysqlnd 
--with-pdo-pgsql=/usr/bin/pg_config 
--enable-bcmath 
--enable-fpm 
--with-fpm-user=root 
--with-fpm-group=root 
--enable-mbstring 
--enable-phpdbg 
--enable-shmop 
--enable-sockets 
--enable-sysvmsg 
--enable-sysvsem 
--enable-sysvshm 
--with-zlib 
--with-curl 
--with-pear 
--with-openssl=/opt/openssl 
--with-openssl-dir=/opt/openssl 
--enable-pcntl 
--enable-gd 
--with-jpeg 
--with-mysqli 
--with-readline 
--with-freetype 
--with-ldap

我得到一个错误:


检查openssl>=1.0.2…否configure:error:未满足包要求(openssl>=1.0.2(:

未找到包"openssl">

如果您以非标准前缀安装的软件。

或者,您可以设置环境变量OPENSSL_CFLAGS和OPENSSL_LIBS,以避免调用pkg config。有关更多详细信息,请参阅pkg配置手册页。


我做错了什么?

良好的配置

./configure  OPENSSL_CFLAGS=-I/opt/openssl/include/ OPENSSL_LIBS="-L/opt/openssl/lib64/ -lssl -lcrypto" 
PKG_CONFIG_PATH=/usr/local/lib/pkgconfig 
--with-config-file-path=/etc/php 
--sysconfdir=/etc/php.d 
--enable-mysqlnd 
--with-pdo-mysql 
--with-pdo-mysql=mysqlnd 
--with-pdo-pgsql=/usr/bin/pg_config 
--enable-bcmath 
--enable-fpm 
--with-fpm-user=root 
--with-fpm-group=root 
--enable-mbstring 
--enable-phpdbg 
--enable-shmop 
--enable-sockets 
--enable-sysvmsg 
--enable-sysvsem 
--enable-sysvshm 
--with-zlib 
--with-curl=/opt/curl 
--with-pear 
--with-openssl=/opt/openssl/bin 
--enable-pcntl 
--enable-gd 
--with-jpeg 
--with-mysqli 
--with-readline 
--with-freetype 

最新更新