Being involved in web development process one has often got to realize actions/commands for which he has not been granted enough rights or the user whose server has launched and executed Drupal, is lacking access to some directories. libssh2 library seems to render the way out of this situation as it helps provide access to the resources (shell) of the remote server using an encrypted connection.
Shell is a command interpreter in the operating system.
In order to use shell commands in php, it's necessary to know the port, host, user name and password detais. For server connection set up the ssh2_connect function is being used and for user authorization the ssh2_auth_password is.
$port = 2002; $server = 'example.com'; $login = '[email protected]'; $pass = '12345'; if (!function_exists("ssh2_connect")) { exit("ssh2_connect disable"); } if(!($con = ssh2_connect($server, $port))){ //переменный $con в случае успешного соединения //присваивается ссылка идентификатора SSH з’соединения, //необходимое позже для вызова функции ssh2_auth_password, //при неудачном соединении присваеваится значение FALSE. exit("could not connect to {$server} with port {$port}"); } if(!ssh2_auth_password($con, $login, $pass)) { exit("login/password is incorrect"); }