Install ssh2 php centos 7

We have already discussed about how to install and configure SSH2 extension in XAMPP in Linux System, same process will configure in your PHP.

Step 1 : Before start, we need to update and install the necessary packages for  build/install ssh2 extension

#  yum update

#  yum install  make gcc  libssh2  php-devel php-pearlibssh2-devel

Step 2 : Install ssh2 extension using pecl command for  auto detect and download once hit enter,

#  pecl install -f ssh2


downloading ssh2-0.12.tgz ...
Starting to download ssh2-0.12.tgz (26,223 bytes)
.........done: 26,223 bytes
6 source files, building
running: phpize
Configuring for:
PHP Api Version:         20100412
Zend Module Api No:      20100525
Zend Extension Api No:   220100525
libssh2 prefix? [autodetect] :
...
.....
Build process completed successfully
Installing '/usr/lib64/php/modules/ssh2.so'
install ok: channel://pecl.php.net/ssh2-0.12
configuration option "php_ini" is not set to php.ini location
You should add "extension=ssh2.so" to php.ini

Step 3 : Once the package has been installed in your system, we need to configure the extension to PHP (php.ini  or ssh2.ini)

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

or

# echo "extension=ssh2.so"  > /etc/php.ini

Step 4 : Finally restart your web server

# service restart httpd.service

Now, check the module whether is configure with PHP,

# php -m | grep ssh2

ssh2

Also can  check in your phpinfo();

Install ssh2 php centos 7

I am not able to install ssh2 in centos.

I using apache2 and PHP 7.3

I using below command and giving me error as below

yum install gcc php-devel libssh2 libssh2-devel php-pear make
pecl install -f ssh2

but it's showing me below error

No package php-devel available.
No package php-pear available.

please tell me what I missing.

asked Dec 19, 2019 at 6:15

Install ssh2 php centos 7

1

In CentOS 7, what about enabling EPEL and then yum install php-pecl-ssh2

EDIT: Looks like CentOS 7 includes PHP 5 by default. The ssh2 page (https://pecl.php.net/package/ssh2) says:

ssh2 1.0 and above is PHP 7 only. To install a version that is PHP 5 compatible you can run 'pecl install ssh2-0.13'

answered Dec 21, 2019 at 7:24

1

In this tutorial we learn how to install php-pecl-ssh2 on CentOS 7. php-pecl-ssh2 is Bindings for the libssh2 library

Introduction

In this tutorial we learn how to install php-pecl-ssh2 on CentOS 7.

What is php-pecl-ssh2

Bindings to the functions of libssh2 which implements the SSH2 protocol. libssh2 is available from http

We can use yum or dnf to install php-pecl-ssh2 on CentOS 7. In this tutorial we discuss both methods but you only need to choose one of method to install php-pecl-ssh2.

Install php-pecl-ssh2 on CentOS 7 Using yum

Update yum database with yum using the following command.

After updating yum database, We can install php-pecl-ssh2 using yum by running the following command:

sudo yum -y install php-pecl-ssh2

Install php-pecl-ssh2 on CentOS 7 Using dnf

If you don’t have dnf installed you can install dnf first. Update yum database with dnf using the following command.

After updating yum database, We can install php-pecl-ssh2 using dnf by running the following command:

sudo dnf -y install php-pecl-ssh2

How To Uninstall php-pecl-ssh2 on CentOS 7

To uninstall only the php-pecl-ssh2 package we can use the following command:

sudo dnf remove php-pecl-ssh2

php-pecl-ssh2 Package Contents on CentOS 7

/etc/php.d/ssh2.ini
/usr/lib64/php/modules/ssh2.so
/usr/share/doc/php-pecl-ssh2-0.12
/usr/share/doc/php-pecl-ssh2-0.12/LICENSE
/usr/share/doc/php-pecl-ssh2-0.12/README
/var/lib/pear/pkgxml/php-pecl-ssh2.xml

References

  • php-pecl-ssh2 website

Summary

In this tutorial we learn how to install php-pecl-ssh2 on CentOS 7 using yum and dnf.