Monday, July 25, 2016

Install ssh2 library (libssh2-php) Setups

Installing the SSH2 PHP extension on CentOS is actually pretty simple. Although it isn’t available as a straight yum install, it boils down to a few short steps.
Firstly, we’re going to install the dependencies:
Code: Select all
yum install gcc php-devel php-pear libssh2 libssh2-devel

These will allow us to build the SSH2 extension using pecl.
Code: Select all
pecl install -f ssh2

After running that command, it should stop at a line like:
Code: Select all
..
 ........done: 22,740 bytes
 5 source files, building
 running: phpize Configuring for:
PHP Api Version: 20041225
Zend Module Api No: 20060613
Zend Extension Api No: 220060519 l
ibssh2 prefix? [autodetect] :


All you have to do is hit Enter and it should detect the proper path. Once the install is completed, you just have to tell PHP to load the extension when it boots.
Code: Select all
touch /etc/php.d/ssh2.ini
echo extension=ssh2.so > /etc/php.d/ssh2.ini


You should add "extension=ssh2.so" to php.ini

Now restart your webserver and test to see if the changes took effect.
Code: Select all
/etc/init.d/httpd restart


php -m | grep ssh2

No comments:

Post a Comment