Friday, February 27, 2015

Add a php package in linux

PHP package in linux
Case: read streams from host server using ssh2 protocol, since ftp not available.
Hints: ssh2 is newer protocol implemented, after there were some deficiencies with plain text protocol such ftp.
What first thing to do?
Check job server capabilities in handling ssh2... and found the server has none.
Since our LAN is restricted to connect internet, I ended up using local terminal to download just everything needed to get right then upload using sftp to web server.
It were:
libssh2 from libssh2.org
SSH2 lib from pecl.php.net (use v0.11.3 or above, the downer has bug in checking EOF)

Since it is a job to add new package/modules to already dead exists php in server (5.1.3 version, yes i know it's an old bag but still works), it shoud be fairly simple for someone who acquinted to linux terminal.
But alas, I am not that one, so reading here and there drawn me to a conclusion. Get everything, upload to job server and work out there.
What step required?
1. build server lib module
- tar xzf libssh..tar.gz
- ./configure --enable-ssh2
- make
- make install
2. build ssh2 pecl for php
- tar xfz ssh2..tar.gz
- phpize
- ./configure --enable-ssh2
- make
- make install

Now we have placed ssh2 module to its proper seats.
Next step is restart web server to reload php extensions: /etc/init.d/httpd restart
and check wheneverything is correctly setup.