如何在 Azure 应用服务(PHP 8.2 / Linux)上安装 PHP 扩展 php-ssh2?

问题描述 投票:0回答:1

有谁知道如何在使用 PHP 版本 8.2 和 Linux 操作系统的 Azure 应用服务上安装 PHP 扩展“php-ssh2”?

我尝试从不同的存储库安装扩展,但不幸的是这不起作用([不是候选版本])。

提前谢谢您,

php linux azure-web-app-service debian
1个回答
0
投票

检查以下步骤以在

SSH2
中安装
Azure Linux App Service
扩展。

打开

KUDU
控制台:

https://YourApp.scm.azurewebsites.net/webssh/host

enter image description here

我的PHP版本:

enter image description here

  • 运行以下命令安装SSH2版本。
apt-get update
apt-get install -y libssh2-1-dev

enter image description here

  • 运行
    pear config-show
    命令查看目录的路径。

enter image description here

  • 运行

    pecl install https://pecl.php.net/get/ssh2-1.4.tgz
    命令安装 ssh2 zip 文件。

  • 您可以在

    ssh2
    目录中看到下载的
    /tmp/pear/download
    文件

  • 接下来运行以下命令

cd  /tmp/pear/download/
tar -xzf ssh2-1.4.tgz
cd ssh2-1.4
phpize
./configure

enter image description here

  • 现在您可以看到在

    /tmp/pear/download/ssh2-1.4
    目录中创建了modules文件夹。

  • modules 文件夹包含

    ssh2.so
    文件。

enter image description here

  • 现在我们需要将此文件从下载移动到扩展文件夹
     /usr/local/lib/php/extensions/no-debug-non-zts-20220829
    文件夹
mv /tmp/pear/download/ssh2-1.4/modules/ssh2.so /usr/local/lib/php/extensions/no-debug-non-zts-20220829

enter image description here

  • 运行
    php -m
    检查扩展。

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.