Install phpseclib packages Net_SSH2 and Net_SFTP on PPC64LE with CentOS 7

Updated on May 14, 2020

I was deploying a web application on PPC64LE architecture with CentOS 7. As the machine wasn’t set up with web hosting packages, I need to set that up first before deploying the application. Unfortunately, the yum repository consisted of quite old packages for this architecture, and installing the latest package through RPM’s is a nightmare as the packages would have a hell lot of dependencies. So I decided to compile PHP & its dependant modules from source. Now the web hosting environment is ready and all I need to do is install few dependant packages for the application to work. I will be discussing how to Install phpseclib packages such as Net_SSH2 and Net_SFTP on PPC64LE architecture running CentOS 7.

I had used the package called Net_SSH2 and Net_SFTP from phpseclib in my application and it worked fine on my development environment. Installing phpseclib packages on x86 architecture was super simple (because yum does everything).  Since there were no latest binaries for PPC64LE, I used PEAR. PEAR is short for “PHP Extension and Application Repository“. It is a repository of reusable PHP codes.

Here is how I installed Net_SSH2 and Net_SFTP PHP packages using PEAR.

How to install phpseclib packages NET_SSH2 and Net_SFTP

Step 1: Make sure pear package manager is installed

If you have installed PHP from source, then you would have installed PEAR package manager unless one has used the ./configure option --without-pear.

If you had to install PHP using yum repository, then install PHP-pear from a corresponding version of your PHP

#yum install php-pear
#pear version
PEAR Version: 1.10.11
PHP Version: 7.2.30
Zend Engine Version: 3.2.0
Running on: Linux terra-node-01 4.18.0-80.7.2.el7.ppc64le #1 SMP Thu Sep 12 15:45:05 UTC 2019 ppc64le

Step 2: Register a channel to be used with the PEAR installer.

#pear channel-discover phpseclib.sourceforge.net
Channel "phpseclib.sourceforge.net" is already initialized

Step 3: List available packages

#pear remote-list -c phpseclib
Channel phpseclib Available packages:
=====================================
Package          Version
Crypt_AES        1.0.18
Crypt_Base       1.0.18
Crypt_Blowfish   1.0.18
Crypt_DES        1.0.18
Crypt_Hash       1.0.18
Crypt_RC4        1.0.18
Crypt_RSA        1.0.18
Crypt_Random     1.0.18
Crypt_Rijndael   1.0.18
Crypt_TripleDES  1.0.18
Crypt_Twofish    1.0.18
File_ANSI        1.0.18
File_ASN1        1.0.18
File_X509        1.0.18
Math_BigInteger  1.0.18
Net_SCP          1.0.18
Net_SFTP         1.0.18
Net_SSH1         1.0.18
Net_SSH2         1.0.18
System_SSH_Agent 1.0.18

As you can see the packages Net_SFTP and Net_SSH2 are available.

Step 4: Install Net_SFTP and Net_SSH2

It will install the latest version available.

#pear install phpseclib/Net_SFTP
phpseclib/Net_SFTP is already installed and is the same as the released version 1.0.18
#pear install phpseclib/Net_SSH2
phpseclib/Net_SSH2 is already installed and is the same as the released version 1.0.18

Once the packages are installed, restart the httpd service

Final Step: Restart the HTTPD service

#systemctl restart httpd

Was this article helpful?

Related Articles

Comments Leave a Comment

Leave a Comment