CentOS 6.4 – Install SSH2 extension for PHP

Install the necessary packages before you can build/install ssh2 extension

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

Install the extension, (hit enter for autodetect when it prompts you)

pecl install -f ssh2

Once the install is completed, you just have to tell PHP to load the extension when it boots.

touch /etc/php.d/ssh2.ini
echo extension=ssh2.so > /etc/php.d/ssh2.ini

Restart your webserver and test to see if the changes took effect.

service httpd restart

You can check it installed with the following command

php -m | grep ssh2



I am a Senior System Administrator that work daily with Virtualization,Xenserver, Linux, IT automation, Ansible,Windows, Active Directory, Exchange and a lot more. Here you will find tips and trix from early junior, middle junior and senior to unique information of the topics I mentioned earlier. If you need help with something do not hesitate to contact me I will gladly help.

Tagged with: , ,