A CodeIgniter sFTP Library - Allows communication to a sFTP server via the CodeIgniter framework.
Many thanks to;
Ian Grice
- PHP 5+
- CodeIgniter for 2.x
- ssh2 extension for PHP (which in turn needs libssh2)
Have a look at application/controllers/sftp_test.php
for an example of how to connect
to a remote sFTP server, as well as a few demo commands you can run.
Here's an updated guide to installing this extension on OSX 10.9 (Mavericks).
I'm using the default OSX PHP install (5.4.24) that comes pre-installed. This guide also assumes you're using Homebrew as a package manager, and have wget installed.
This is very similar to the process on this gist.
- Install libssh2;
brew install libssh2
- Install ssh2;
wget http://pecl.php.net/get/ssh2-0.11.3.tgz
tar -zxvf ssh2-0.11.3.tgz
cd ssh2-0.11.3
phpize
./configure
make
- Copy your newly compiled extension (ssh2.so) into your PHP extensions directory.
sudo cp modules/ssh2.so /usr/lib/php/extensions/no-debug-non-zts-20100525
- Add the extension to the php.ini. Just add the following text to the php.ini file;
extension=ssh2.so
- Restart apache and run php info to see if the extension has been loaded;
php -i | grep ssh2
You should be good to go from here!
The main thing is that libssh2, ssh2 and php are all the same architecture (32 or 64bit).