Project

General

Profile

Install SSH module for PHP shared » History » Revision 3

Revision 2 (Amber Herold, 05/07/2012 11:22 AM) → Revision 3/8 (Amber Herold, 05/07/2012 11:32 AM)

h1. Install SSH module for PHP 

 This installation occurs on the web server. 

 h2. The ssh2 extension for php 

 First, install the following prerequisites: 

 |_.Name:|_.Download site:|_.CentOS yum package name|_.Fedora yum package name|_.SuSE rpm name| 
 |php devel |http://www.php.net |php-devel |php-devel| | 
 |libssh2 devel |http://www.libssh2.org |libssh2-devel (found in epel repo)|libssh2-devel| | 
 |SSH PECL extension |http://www.php.net/manual/en/ssh2.installation.php |- |php-pecl-ssh2 | | 

 bq. For newer systems the extension is available through the repository, e.g., on Fedora 12 type "@sudo yum install php-pecl-ssh2@" 

 h2. Download and compile the ssh2 extension 

 bq. This setup is almost identical to the [[Install the MRC PHP Extension]]. See http://www.php.net/manual/en/ssh2.installation.php for more information. 

 # Go the website http://pecl.php.net/package/ssh2 
 # Download the latest version of ssh2:<pre> 
 wget http://pecl.php.net/get/ssh2-0.11.3.tgz</pre> 
 # Extract the tar ball<pre> 
 tar zxvf ssh2-0.11.3.tgz</pre> 
 # Go into the directory<pre> 
 cd ssh2-0.11.3</pre> 
 # Run phpize and standard make process<pre> 
 phpize 
 ./configure 
 make</pre> 
 # Install the module:<pre> 
 sudo make install</pre> 
 # Add a ssh2.ini to your php ini folder:<pre> 
 sudo touch /etc/php.d/ssh2.ini 
 sudo chmod 666 /etc/php.d/ssh2.ini 
 echo "; Enable ssh2 extension module" > /etc/php.d/ssh2.ini 
 echo "extension=ssh2.so" >> /etc/php.d/ssh2.ini 
 sudo chmod 444 /etc/php.d/ssh2.ini 
 cat /etc/php.d/ssh2.ini 
 </pre> 
 # Restart httpd:<pre> 
 sudo /sbin/service httpd restart</pre> 

 h2. Test if the module is working: 

 # go to the info.php that was created earlier in the [[Install the MRC PHP Extension]], http://localhost/info.php or http://HOST.INSTITUTE.EDU/info.php 
 # search for the ssh2 module, you should see this section: 

 !http://emg.nysbc.org/attachments/220/ssh2box.png! !ssh2box.png! 

 h2. Still having problems? 

 # on one machine restarting httpd was not enough, I had to restart the entire system to get it working (even though it shows up under info.php)