I want to make a SSH connection to a remote server using php.
Im using php 5.3 on Linux/CEntOS.
What I have done so far :
$connection = ssh2_connect('192.168.1.22', 22);
ssh2_auth_password($connection, '_username', '_password');
$stream = ssh2_exec($connection, 'ls -l');
But I'm getting this error :
Fatal error: Call to undefined function ssh2_connect()
So, my questions are :
Are ssh2_* functions not installed by default in php?
Do I need an extension or library for using these functions?
How can I solve this problem ?
You can configure your server (Ubuntu):
sudo apt-get install libssh2-php
sudo service apache2 restart
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With