Easy task if you have an apache server, but what about nginx + php-fpm?
Spent like 40 minutes to figure this out with 20+ tabs opened in Chrome… I have pure nginx + php-fpm install on CentOS, but most tutorials is about how to install ssh2 extension for php, not php-fpm. So the right answer is:
1 |
sudo yum install php-pecl-ssh2 |
Hope that helps.
Honestly, I think you’d be better off with phpseclib, a pure PHP SSH2 implementation. eg.
http://phpseclib.sourceforge.net/ssh/intro.html
It has a number of advantages over php-pecl-ssh2 as discussed here:
http://phpseclib.sourceforge.net/ssh/compare.html
Agree, but what if you already have a project which working with ssh2 and you don’t have a time/resource/will to rewrite it? This post is for those cases.
I’m curious a bit, what is the purpose to use ssh from php. Can’t imagine useful scenario for this feature
To fetch files from sftp for example.