SSH2 extension for PHP on CentOS 6

Before we can build and install ssh2 extension, we’ll need a few packages

yum install gcc php-devel php-pear libssh2 libssh2-devel make

Install the extension via pecl

pecl install -f ssh2

On CentOS, PHP will not load extension automatically. To “fix” this, create ssh2.ini file inside /etc/php.d/ and add

extension=ssh2.so

inside.

Restart apache (service httpd restart) and test PHP with

php -m | grep ssh2

As response, you should get ssh2.

Leave a Reply

Your email address will not be published. Required fields are marked *