How to install PHP Extension php-ssh2 on Azure App Service (PHP 8.2 / Linux)?

TomDeWaal 20 Reputation points
2023-12-15T13:24:30.13+00:00

Hello,

Does anyone know how to install the PHP extension "php-ssh2" on an Azure App Service with PHP version 8.2 and Linux OS?

I tried installing the extension from a different repository, but unfortunately this does not work ([Not candidate version]).

Thank you in advance,

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,933 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. brtrach-MSFT 17,731 Reputation points Microsoft Employee Moderator
    2023-12-16T05:37:25.0333333+00:00

    @TomDeWaal We have the below blog that should provide you the necessary steps.

    https://azureossd.github.io/2019/01/29/azure-app-service-linux-adding-php-extensions/

    I am going to share some of the content of the steps here as well:

    1. Go to your KUDU console https://<sitename>.scm.azurewebsites.net
    2. Select SSH.
    3. In your SSH session, run the command highlighted in yellow.
    4. In the output above, the path for ext_dir is where your extension will be downloaded.  Note the path for later use.
    5. To install an extension, perform the following.  I’ll be installing the PHP extension “redis” in this example.
    6. You’ll notice the path to the newly installed extension (highlighted in green) is also returned after it’s installed and matches the “ext_dir” path returned from the Pear configurations.
    7. Now that the extension is installed, we’ll need to create an “ext” directory under “/home/site” and copy the extension to that directory so that the extension persists if the container is restarted.  Below are the commands to do this.

    Let us know if you have any further questions on this topic. Otherwise, please accept this as the answer if you found it helpful.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.