How to install LibSSH2 on a CentOS 5 system
Libssh2 is a C library implementing the SSH2 protocol for PHP. Here’s how to get it installed on a CentOS system running PHP 5.1.6.
First step is to install some dependencies.
yum install automake php-devel libtool openssl-devel gcc++ gcc
Next, let’s download the latest release of libssh2 (1.2.2 at time of writing), unpack and install
# cd /tmp # wget http://www.libssh2.org/download/libssh2-1.2.2.tar.gz # tar -zxf libssh2-1.2.2.tar.gz # cd libssh2-1.2.2 # ./configure # make all install # cd .. # rm -rf libssh2-1.2.2
Now we need to install the PHP bindings.
# cd /usr/lib/php (for x64 systems use /usr/lib64/php) # wget http://pecl.php.net/get/ssh2-0.11.0.tgz # tar -zxf ssh2-0.11.0.tgz # cd ssh2-0.11.0 # phpize && ./configure –with-ssh2 && make # cd modules # mv ssh2.so /usr/lib/php/modules/ssh2.so # cd /usr/lib/php # rm -rf ssh2-0.11.0 # rm -f ssh2-0.11.0.tgz
Update the PHP ini file and add the ssh2.so extension like this.
# vi /etc/php.ini extension_dir = “/usr/lib/php/modules” extension = ssh2.so
Now restart apache and everything should be installed. You can test it my looking at the out put of # php -m that will list all of the installed modules.
2 Responses to “How to install LibSSH2 on a CentOS 5 system”
2-18-2010
Really helpful! Thx Kevin!
3-11-2010
Much appreciated
Leave a Reply