我正在尝试在PHP 7.2.5
操作系统上编译RedHat。我已经在我自己的OpenSSL 1.1.0h
目录中自己编译了/home/user/openssl-1.1
。以下是我编译OpenSSL
的代码行
TARGET_DIR=/home/usr/openssl-1.1
# ...
./config no-shared --prefix=${TARGET_DIR} --openssldir=${TARGET_DIR}/conf
make INSTALL_PREFIX=${TARGET_DIR}
make install
现在,我希望将PHP 7.2.5
与已编译的OpenSSL版本一起编译。我用这些台词来做:
PHP_PREFIX=/home/user/php-7.2
export OPENSSL_INCLUDE_DIR=/home/user/openssl-1.1/include/openssl
# ...
./buildconf --force
./configure --prefix="$PHP_PREFIX" \
--enable-sockets \
--enable-embed \
--enable-com-dotnet \
--enable-ctype \
--with-curl \
--enable-mbstring=static \
--with-gd \
--enable-soap \
--enable-pdo=static \
--with-mp \
--with-curl=static \
--with-openssl=static \
--with-openssl-dir="/home/user/openssl-1.1"
但在某种程度上,我得到了这样的错误信息:
configure: error: Cannot find OpenSSL's <evp.h>
此文件evp.h
存在于/home/user/openssl-1.1/include/openssl
目录中。
有人知道如何解决这个问题吗?
发布于 2018-05-01 12:48:55
我为这个问题找到了一个解决方案:一个必须将两个参数--with-openssl
和--with-libdir
更改为如下所示:
./buildconf --force
./configure --prefix="$PHP_PREFIX" \
# ...
--with-openssl=/home/user/openssl-1.1 \
--with-libdir=lib64
如我所知,这里不需要其他环境变量。
发布于 2020-12-12 19:11:44
我用PHP7.2和7.4进行了测试
如果您在非标准前缀中安装了软件,请考虑调整PKG_CONFIG_PATH环境变量,将其指向OpenSSL的pkgconfig目录。
操作步骤:
wget https://www.openssl.org/source/openssl-1.1.1i.tar.gz
tar xzf /root/tmp/openssl/openssl-1.1.1i.tar.gz
cd openssl-1.1.1i
./Configure --prefix=/opt/openssl-1.1.1i/bin -fPIC -shared linux-x86_64
make -j 8
make install
export PKG_CONFIG_PATH=/opt/openssl-1.1.1i/bin/lib/pkgconfig
tar xzf php-7.4.13.tar.gz
cd php-7.4.13
./configure --prefix=/opt/php-7.4.13 --with-curl --enable-exif \
--with-mhash --enable-mbstring --with-mysqli --enable-mysqlnd \
--with-zlib --with-bz2 --enable-fpm --with-pear -enable-gd\
--with-apxs2=/opt/httpd-2.4.46/bin/apxs - --with-webp \
--with-jpeg --with-xpm --with-freetype --enable-intl \
--disable-ipv6 --with-pgsql --without-sqlite3 --without-pdo-sqlite \
--disable-cgi --enable-soap --without-imap --without-imap-ssl \
--with-openssl=/opt/openssl-1.1.1i/bin \
--with-openssl-dir=/opt/openssl-1.1.1i/bin
make -j 8
make install
/opt/php-7.4.13/bin/php -i | grep -i openssl
OpenSSL support => enabled
OpenSSL Library Version => OpenSSL 1.1.1i 8 Dec 2020
OpenSSL Header Version => OpenSSL 1.1.1i 8 Dec 2020
Openssl default config => /opt/openssl-1.1.1i/bin/ssl/openssl.cnf
https://stackoverflow.com/questions/50052339
复制