Is it somehow possible to use a user’s SSH client configuration when dealing with SSH2 streams in PHP? On most systems this is stored in ~/.ssh/config.
In my case I have several aliases configured in my SSH config. But, when I try to use those aliases in my PHP code they do not work.
Example ~/.ssh/config
Host foo
HostName my.server
Port 22
User sander
IdentityFile ~/.ssh/id_rsa
Example PHP code that fails, but that I’d like to get working:
<?php
$text = file_get_contents('ssh2.sftp://foo/bar.txt');
If you check the source codes for the ssh2 wrapper at http://pecl.php.net/package/ssh2 it seems they don not support aliases at all.
Post into their mailing list, the alias support could be probably easily added.