I have uploaded my local code on new server. Server is Centos 7 with PHP 5.6.31 and PHP 5.5.28.
I have installed ssh2 connect library on both of my php versions. I am trying to connect to other server using below code,
if (!function_exists("ssh2_connect"))
die('Function ssh2_connect not found, you cannot use ssh2 here');
if (!$connection = ssh2_connect($schema['conn']['host'], $schema['conn']['port']))
die('Unable to connect');
if (!ssh2_auth_password($schema['conn']['connection'], $schema['conn']['username'], $schema['conn']['password']))
die('Unable to authenticate.');
if (!$stream = ssh2_sftp($schema['conn']['connection']))
die('Unable to create a stream.');
if (!$dir = opendir('ssh2.sftp://'.intval($stream).$remoteDirPath))
die('Could not open the directory');
My code is working fine till
if (!$stream = ssh2_sftp($schema['conn']['connection']))
die('Unable to create a stream.');
After that i am getting "Could not open the directory" error. This code is working fine in my local.
Can anyone help me for the issue? Please let me know if any further information is needed.