Install and configure libssh2 and ssh2 PECL module with AMP on OpenSolaris
Detailed information on libssh2 and SSH2 PECL module is available on
libssh2 – http://www.libssh2.org/wiki/index.php/Main_Page
SSH2 PECL Module – http://pecl.php.net/package/ssh2
Installing AMP on OpenSolaris is quite easy. below are the
steps [1-4]
for AMP stack installation.
[ Step:1 ]
-bash-3.2# pkg refresh
-bash-3.2#
[ Step:2
]
-bash-3.2# pkg install amp
DOWNLOAD
PKGS
FILES XFER (MB)
Completed
13/13 1633/1633 331.59/331.59
PHASE
ACTIONS
Update
Phase
2/2
Install
Phase
2111/2111
-bash-3.2#
[ Step:3 ]
-bash-3.2# /usr/sbin/svccfg import
/var/svc/manifest/network/http-apache22.xml
-bash-3.2# /usr/sbin/svcadm enable http:apache22
-bash-3.2#
[ Step:4 ]
-bash-3.2# /usr/sbin/svccfg import
/var/svc/manifest/application/database/mysql.xml
-bash-3.2# /usr/sbin/svcadm enable mysql:version_50
-bash-3.2#
before we begin
downloading libssh2 from sourceforge. We need to have
gcc compiler installed to compile and build libssh2 library.
[ Step:5 ]
-bash-3.2# pkg install gcc-dev
DOWNLOAD
PKGS
FILES XFER (MB)
Completed
18/18 2797/2797 105.65/105.65
PHASE
ACTIONS
Install
Phase
3545/3545
[ Step:6 ]
Download and extract libssh2 distribution.
-bash-3.2# cd /usr/src
-bash-3.2# wget
http://voxel.dl.sourceforge.net/sourceforge/libssh2/libssh2-0.18.tar.gz
-bash-3.2# gunzip libssh2-0.18.tar.gz
-bash-3.2# tar xvf libssh2-0.18.tar
[ Step:7 ]
build and install libssh2
-bash-3.2# cd libssh2-0.18
-bash-3.2# ./configure
-bash-3.2# make all install
Next we need to link
libssh2 and PHP with the SSH2 PECL module.
[ Step:8 ]
-bash-3.2# cd /usr/src
-bash-3.2# wget http://pecl.php.net/get/ssh2-0.10.tgz
-bash-3.2# gunzip ssh2-0.10.tgz
-bash-3.2# tar xvf ssh2-0.10.tar
-bash-3.2# cd ssh2-0.10
[ Step:9 ]
edit ssh2.c and change
following if condition
#if LIBSSH2_APINO < 200412301450
to
#if LIBSSH2_VERSION_NUM < 0×001000
Save the file and execute phpize to prepare the build environment for
the ssh2 PHP extension.
[ Step:10 ]
-bash-3.2# pwd
/usr/src/ssh2-0.10
-bash-3.2# /usr/php5/bin/phpize
Configuring for:
PHP Api
Version:
20041225
Zend Module Api No:
20060613
Zend Extension Api No: 220060519
[ Step:11 ]
-bash-3.2# pwd
/usr/src/ssh2-0.10
-bash-3.2# ./configure –with-ssh2
–with-php-config=/usr/php5/bin/php-config
-bash-3.2# make
-bash-3.2# make install
Installing shared extensions:
/usr/php5/5.2.4/modules/
[ Step:12 ]
ssh2.so module is now installed. We can modify the php.ini
file and make sure the module gets loaded by php.
-bash-3.2# vi /etc/php5/5.2.4/php.ini
add
extension=ssh2.so
under Dynamic Extensions section
restart the apache to and load the SSH2 php extension.
-bash-3.2# svcadm restart svc:/network/http:apache22








