Issue
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,
Solution
Check the below steps to install the SSH2
extension in Azure Linux App Service
.
Open the KUDU
Console:
https://YourApp.scm.azurewebsites.net/webssh/host
My PHP Version:
- Run the below command to install the SSH2 version.
apt-get update
apt-get install -y libssh2-1-dev
- Run
pear config-show
command to see the paths of the directories.
Run
pecl install https://pecl.php.net/get/ssh2-1.4.tgz
command to install the ssh2 zip file.You can see the downloaded
ssh2
file in/tmp/pear/download
directoryNext run the below commands
cd /tmp/pear/download/
tar -xzf ssh2-1.4.tgz
cd ssh2-1.4
phpize
./configure
make
make install
Now you can see modules folder is created in
/tmp/pear/download/ssh2-1.4
directory.modules folder contains the
ssh2.so
file.
- Now we need to move this file from download to extension folder
/usr/local/lib/php/extensions/no-debug-non-zts-20220829
folder
mv /tmp/pear/download/ssh2-1.4/modules/ssh2.so /usr/local/lib/php/extensions/no-debug-non-zts-20220829
- Run the
php -m
to check the extensions.
Answered By - Harshitha Answer Checked By - Marilyn (WPSolving Volunteer)