-
Looks like the steps above are roughly the same as
sudo pecl install https://pecl.php.net/get/ssh2-1.2.tgz.Regarding the segfault error, looks the same as the bug reported here: https://bugs.php.net/bug.php?id=79631. I'm able to connect, and read dir contents, but get a segfault error when trying to close the resource.
<?php $ctx = stream_context_create([ 'ssh2' => ['pubkey_file' => '/home/user/id_rsa.pub', 'privkey_file' => '/home/user/.ssh/id_rsa'] ]); $dirhandle = opendir("ssh2.sftp://user@host.example:22/path/", $ctx); var_dump(readdir($dirhandle)); // => string(1) "." closedir($dirhandle); // => "Segmentation fault"This script also returns a segfault error when using incorrect key files.
Edited by Kevin Breed -
As reported in https://bugs.php.net/bug.php?id=79631, this works:
<?php $con = ssh2_connect('host.example', 22); $auth = ssh2_auth_pubkey_file($con, 'user', '/home/user/.ssh/id_rsa.pub', '/home/user/.ssh/id_rsa'); $sftp = ssh2_sftp($con); $handle = opendir('ssh2.sftp://'.intval($sftp).'/domains/'); var_dump(closedir($handle)); // => NULL var_dump(ssh2_disconnect($sftp)); // when this step is skipped, the skript ends with "Segmentation fault" // => bool(true) var_dump(ssh2_disconnect($con)); // => bool(true)So probably composer fails because it tries to read directory contents with the stream wrapper.
Edited by Kevin Breed
Please register or sign in to comment