Install SSH module for PHP shared » History » Version 4
Neil Voss, 08/14/2012 01:37 PM
1 | 1 | Amber Herold | h1. Install SSH module for PHP |
---|---|---|---|
2 | |||
3 | This installation occurs on the web server. |
||
4 | |||
5 | h2. The ssh2 extension for php |
||
6 | |||
7 | First, install the following prerequisites: |
||
8 | |||
9 | |_.Name:|_.Download site:|_.CentOS yum package name|_.Fedora yum package name|_.SuSE rpm name| |
||
10 | |php devel |http://www.php.net |php-devel |php-devel| | |
||
11 | |libssh2 devel |http://www.libssh2.org |libssh2-devel (found in epel repo)|libssh2-devel| | |
||
12 | |SSH PECL extension |http://www.php.net/manual/en/ssh2.installation.php |- |php-pecl-ssh2 | | |
||
13 | |||
14 | bq. For newer systems the extension is available through the repository, e.g., on Fedora 12 type "@sudo yum install php-pecl-ssh2@" |
||
15 | |||
16 | 4 | Neil Voss | h2. CentOS 6: Install the ssh2 extension |
17 | |||
18 | <pre> |
||
19 | sudo yum install php-pecl-ssh2 |
||
20 | </pre> |
||
21 | |||
22 | h2. CentOS 5: Download and compile the ssh2 extension |
||
23 | 1 | Amber Herold | |
24 | 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. |
||
25 | |||
26 | # Go the website http://pecl.php.net/package/ssh2 |
||
27 | # Download the latest version of ssh2:<pre> |
||
28 | 2 | Amber Herold | wget http://pecl.php.net/get/ssh2-0.11.3.tgz</pre> |
29 | 1 | Amber Herold | # Extract the tar ball<pre> |
30 | 2 | Amber Herold | tar zxvf ssh2-0.11.3.tgz</pre> |
31 | 1 | Amber Herold | # Go into the directory<pre> |
32 | 2 | Amber Herold | cd ssh2-0.11.3</pre> |
33 | 1 | Amber Herold | # Run phpize and standard make process<pre> |
34 | phpize |
||
35 | ./configure |
||
36 | make</pre> |
||
37 | # Install the module:<pre> |
||
38 | sudo make install</pre> |
||
39 | # Add a ssh2.ini to your php ini folder:<pre> |
||
40 | sudo touch /etc/php.d/ssh2.ini |
||
41 | sudo chmod 666 /etc/php.d/ssh2.ini |
||
42 | echo "; Enable ssh2 extension module" > /etc/php.d/ssh2.ini |
||
43 | echo "extension=ssh2.so" >> /etc/php.d/ssh2.ini |
||
44 | sudo chmod 444 /etc/php.d/ssh2.ini |
||
45 | cat /etc/php.d/ssh2.ini |
||
46 | </pre> |
||
47 | # Restart httpd:<pre> |
||
48 | sudo /sbin/service httpd restart</pre> |
||
49 | |||
50 | h2. Test if the module is working: |
||
51 | |||
52 | # 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 |
||
53 | # search for the ssh2 module, you should see this section: |
||
54 | |||
55 | 3 | Amber Herold | !http://emg.nysbc.org/attachments/220/ssh2box.png! |
56 | 1 | Amber Herold | |
57 | h2. Still having problems? |
||
58 | |||
59 | # 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) |