简体   繁体   English

无法在 Ubuntu 22.04LTS 上编译 PHP 7.4.30

[英]Cannot compile PHP 7.4.30 on Ubuntu 22.04LTS

I have an issue trying to manually compile PHP 7.4.x on Ubuntu Server 22.04LTS.我在尝试在 Ubuntu Server 22.04LTS 上手动编译 PHP 7.4.x 时遇到问题。

There seems to be a compatibility problem between PHP 7.4 and OpenSSL 3.0 as the php compilation fails with various OSSL_DEPRECATEDIN_3_0 errors. PHP 7.4 和 OpenSSL 3.0 之间似乎存在兼容性问题,因为 php 编译失败并出现各种OSSL_DEPRECATEDIN_3_0错误。

If PHP7.4 has no OpenSSl 3 support is it still possible to compile it manually on 22.04LTS?如果 PHP7.4 没有 OpenSSl 3 支持,是否仍然可以在 22.04LTS 上手动编译它?

It compiles successfully on 18.04LTS.它在 18.04LTS 上成功编译。

In short: you can't!简而言之:你不能! You need to compile OpenSSL 1.1 from source.您需要从源代码编译 OpenSSL 1.1。

If I may suggest an alternative!如果我可以建议一个替代方案! check out docker查看 码头工人

I have being trying to do the same to install PHP 7.4.30;我一直在尝试安装 PHP 7.4.30; the problem is caused by Ubuntu's 22.04 usage of libssl3, libssl1.1 (the one we need) was present until impish (21.10)问题是由 Ubuntu 22.04 使用 libssl3 引起的,libssl1.1(我们需要的)一直存在,直到 impish(21.10)

ubuntu 包 libssl1.1

In a response at serverfault.com its mentioned that:serverfault.com的回复中,它提到:

You can use --with-openssl or --with-openssl-dir to solve this problem indicating where your custom openssl build is, for example if you downloaded and built it from source in /opt/openssl you could add the following to your build options您可以使用--with-openssl--with-openssl-dir来解决此问题,指示您的自定义 openssl 构建在哪里,例如,如果您从/opt/openssl中的源代码下载并构建它,您可以将以下内容添加到您的构建选项

--with-openssl-dir=/opt/openssl

Digging through some old SO answers I found this example:挖掘一些旧的 SO 答案,我发现了这个例子:

phpbrew install 7.1 +default +openssl=shared -- --with-openssl-dir=/openssl/openssl

After checking the official phpbrew wiki I found the following steps to compile and install OpenSSL 1.1 from source in Ubuntu 22.04:检查官方 phpbrew wiki 后,我发现以下步骤可以在 Ubuntu 22.04 中从源代码编译和安装 OpenSSL 1.1:

cd $HOME
wget https://www.openssl.org/source/openssl-1.1.1i.tar.gz
tar xzf $HOME/openssl/openssl-1.1.1i.tar.gz
cd openssl-1.1.1i
./Configure --prefix=$HOME/openssl-1.1.1i/bin -fPIC -shared linux-x86_64
make -j 8 
make install

Is worth to mention that for me:对我来说值得一提的是:

  1. OpenSSL 1.1.1i works for php 7.4.29 OpenSSL 1.1.1i 适用于 php 7.4.29
export PKG_CONFIG_PATH=$HOME/openssl-1.1.1i/bin/lib/pkgconfig && \
phpbrew install 7.4.29 +default
  1. OpenSSL 1.1.1p works for php 7.4.30 OpenSSL 1.1.1p 适用于 php 7.4.30
export PKG_CONFIG_PATH=$HOME/openssl-1.1.1i/bin/lib/pkgconfig && \
phpbrew install 7.4.30 +default

For anyone using an Ubuntu 22.04 Docker image here is the build for OpenSSL 1.1.1p and the php compilation options:对于使用 Ubuntu 22.04 Docker 映像的任何人,这里是 OpenSSL 1.1.1p 的构建和 php 编译选项:

ENV OPENSSL_VERSION openssl-1.1.1p
RUN set -xe \
    && curl -fSL "https://www.openssl.org/source/$OPENSSL_VERSION.tar.gz" -o "$OPENSSL_VERSION.tar.gz" \
    && ls -al \
    && tar xzf $OPENSSL_VERSION.tar.gz \
    && cd $OPENSSL_VERSION \
    && ./Configure --prefix=/opt/$OPENSSL_VERSION/bin -fPIC -shared linux-x86_64 \
    && make -j 8  \
    && make install \
    && export PKG_CONFIG_PATH=/opt/$OPENSSL_VERSION/bin/lib/pkgconfig

Add the following to the php compilation configure options将以下内容添加到 php 编译配置选项中

--with-openssl \
PKG_CONFIG_PATH=/opt/$OPENSSL_VERSION/bin/lib/pkgconfig \

PHP 7.4.30 (cli) (built: Jun 28 2022 15:51:41) ( NTS ) Copyright (c) The PHP Group Zend Engine v3.4.0, Copyright (c) Zend Technologies with Zend OPcache v7.4.30, Copyright (c), by Zend Technologies PHP 7.4.30 (cli) (built: Jun 28 2022 15:51:41) (NTS) 版权所有 (c) The PHP Group Zend Engine v3.4.0, 版权所有 (c) Zend Technologies with Zend OPcache v7.4.30, 版权所有 ( c),由 Zend Technologies 提供

 openssl
 
 OpenSSL support => enabled OpenSSL
 Library Version => OpenSSL 1.1.1p 21 Jun 2022
 OpenSSL Header Version => OpenSSL 1.1.1p  21 Jun 2022
 Openssl default config => /opt/openssl-1.1.1p/bin/ssl/openssl.cnf

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在Ubuntu 22.04上用OpenSSL 1.1.1正确编译PHP 7.4.33 - How to compile PHP 7.4.33 correctly with OpenSSL 1.1.1 on Ubuntu 22.04 libssl.so.1.1:无法打开共享 object 文件:没有这样的文件或目录 - libssl.so.1.1: cannot open shared object file: No such file or directory 在 ubuntu 22.04 上安装 ruby 的正确方法是什么 - What is the correct way to install ruby on ubuntu 22.04 Qt 缺少 OpenSSL 3.x 对 Ubuntu 22.04 的支持 - Qt missing OpenSSL 3.x support on Ubuntu 22.04 在Ubuntu 16.0.4 LTS上安装libcurl4-openssl-dev时出现问题 - Problems installing libcurl4-openssl-dev on Ubuntu 16.0.4 LTS 将OpenSSL从0.9.8升级到1.0.2 / Ubuntu 8.04 LTS - Upgrading openssl from 0.9.8 to 1.0.2 / Ubuntu 8.04 LTS 无法在Ubuntu 16.04中下载php_openssl.dll - Cannot download php_openssl.dll in ubuntu 16.04 Shopify + Ubuntu 12.04LTS +法拉第问题=可以使用旧的OpenSSL吗? - Shopify + Ubuntu 12.04LTS + Faraday issue = OK to use older OpenSSL? 使用 Ubuntu 20.04 LTS 中的 R download.file(“https://..”) 时出现“SSL 连接错误” - 'SSL connect error' when using R download.file(“https://..”) from Ubuntu 20.04 LTS Ubuntu 22.04 中的 Pyenv:错误:未编译 Python ssl 扩展。 缺少 OpenSSL 库? - Pyenv in Ubuntu 22.04: ERROR: The Python ssl extension was not compiled. Missing the OpenSSL lib?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM