PHP - Moved: Ssh2
This topic has been moved to Other Libraries and Frameworks.
http://www.phpfreaks.com/forums/index.php?topic=359227.0 Similar TutorialsI have this problem where I make an ssh2 connection in this class, use it several times, and then it breaks, as in, further calls that use that resource fail. What happens is I make several ssh2_scp_recv() calls, then I call: Code: [Select] $stream = ssh2_exec(EX_SFTP::$connection, "date --utc -r conf/au.conf '+%Y-%m-%d %H:%M:%S'; echo __COMMAND_FINISHED__");That succeeds, then $stream is read, and the command is determined to be finished when "__COMMAND_FINISHED__" is parsed. (The only thing done w/$stream is that it is passed to fread() and strlen(). It isn't closed, or anything) Now the next thing I do is call ssh2_scp_send(), which results in an exception whose message is "ssh2_scp_send(): Failure creating remote file". The reason I think the connection somehow wore out is that a boorish solution I tried was to reconnect to the server every time I use EX_SFTP::$connection. So only using fresh connections is an answer, but I can do better than that. Unfortunately, I don't know of any reliable way to test the health of a connection. I've got a little php script here at work that used to log into a SSH server and grab some log files and show them in a web browser. Simple stuff. Recently we've changed the login on the servers to use our VPN tokens instead of a password that I pick for my account. We can use authorized keys which works fine for me in putty and I'm trying to set that up because I keep getting prompted for user and password the "old" way.
I'm using ssh2_auth_pubkey_file and been reading the manual about it but I can't seem to get it to work
I make my connection as follows
$connection = ssh2_connect($serverHost, 22, array('hostkey'=>'ssh-rsa'));Then setup the auth_pubkey. There is no passphrase or anything I use with putty so i left that part out $result = ssh2_auth_pubkey_file($connection, 'username','/path/to/id_rsa.pub','/path/to/id_rsa');the information in my id_rsa.pub file matches what's in authorized_keys on the server in my username/.ssh dir I'm not 100% what else to check for? Anyone have any tips Thanks I am trying to use SSH2 functions in PHP and I read the documentation for each LIBSSH2, OpenSSL and PECL SSH2 and I can't figure out how to install any of them on the Windows Server X64 box. Does anyone know how to do this? http://www.php.net/manual/en/ssh2.requirements.php http://pecl.php.net/package/ssh2 http://www.openssl.org/ http://www.libssh2.org/ Thanks, sanchez This topic has been moved to PHP Installation & Configuration. http://www.phpfreaks.com/forums/index.php?topic=319595.0 This topic has been moved to PHP Freelancing. http://www.phpfreaks.com/forums/index.php?topic=345722.0 This topic has been moved to PHP Freelancing. http://www.phpfreaks.com/forums/index.php?topic=331097.0 This topic has been moved to HTML Help. http://www.phpfreaks.com/forums/index.php?topic=333865.0 This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=317014.0 This topic has been moved to PHP Freelancing. http://www.phpfreaks.com/forums/index.php?topic=352281.0 This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=328845.0 This topic has been moved to PHP Applications. http://www.phpfreaks.com/forums/index.php?topic=342987.0 This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=309960.0 This topic has been moved to mod_rewrite. http://www.phpfreaks.com/forums/index.php?topic=353027.0 This topic has been moved to PHP Applications. http://www.phpfreaks.com/forums/index.php?topic=343318.0 This topic has been moved to PHP Freelancing. http://www.phpfreaks.com/forums/index.php?topic=349322.0 This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=342919.0 This topic has been moved to Other Libraries and Frameworks. http://www.phpfreaks.com/forums/index.php?topic=327250.0 This topic has been moved to mod_rewrite. http://www.phpfreaks.com/forums/index.php?topic=356314.0 This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=318465.0 This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=305825.0 |