SA-MP Forums

Go Back   SA-MP Forums > SA-MP Server > Server Support
New Account Community Today's Posts Search

Reply
 
Thread Tools Display Modes
Old 24/03/2011, 08:28 PM   #1
VOXrr
Big Clucker
 
VOXrr's Avatar
 
Join Date: Dec 2010
Location: /var/Manchester/UK/
Posts: 193
Reputation: 42
Default [TUTORIAL] How to install PHP-SSH2

Having trouble installing the PHP-SSH2 extension on your server? Read on.
Forum Moderators: Apologies if this has been placed in the wrong section. It seemed like a more logical place to put it.

__________________________________________
  • Please note, this is assuming your server is running a Debian based flavour of linux. Debian and Ubuntu should work fine.
  • If you're using an RPM based distro, e.g. CentOS, Fedora. Proceed at your own risk, however, it shoud be fine to replace 'aptitude' with 'yum'.
  • In addition, this also assumes that you're already up and running using PHP5. If not, substitute PHP5 with PHP4.
__________________________________________


Try this first


On recent Debian releases, there's no real need to build packages any more, in most cases, you can just install the required packages.
So, with that in mind, try running this command
Code:
aptitude install libssh2-1-dev libssh2-php
Then try and see if PHP recognises that the SSH2 extension has been installed
Code:
php -m |grep ssh2
If the server returns 'ssh2' and "Build process completed successfully", then the extension has been installed correctly. You can now start developing PHP-SSH2 code or.. eh.. install one of the many SA:MP control panels with ease.

If not, you'll need to do some manual work. Keep reading on.

__________________________________________

Building SSH2.so

Firstly, you'll need to get your server ready to build the required packages.
Code:
aptitude install php5-dev php5-cli php-pear build-essential openssl-dev zlib1g-dev
Once that's done, you'll want to build libssh2 by running these commands.

Code:
cd /usr/src
wget http://www.libssh2.org/download/libssh2-0.14.tar.gz
tar -zxvf libssh2-0.14.tar.gz
cd libssh2-0.14/
./configure
make all install

__________________________________________

Making libssh2 and PHP a bit more friendly

Now all the required files are there, you'll want to link libssh2 with PHP
You can do this easily by using this PECL module

Code:
pecl install -f ssh2
Now you'll want to edit your php.ini to load the new module.

I personally use LighTTPD with the FastCGI extension, so therefore my php.ini file is located in /etc/php5/cgi/php.ini
However, those using Apache should find it in /etc/php5/apache2 somewhere.

Using your favourite text editor, add this line to the end of your php.ini file.

Code:
extension=ssh2.so
Then restart your web server, using one of these commands - Whichever is appropriate

Code:
/etc/init.d/apache2 restart
/etc/init.d/lighttpd restart
/etc/init.d/nginx restart

__________________________________________

Testing

You can then test if PHP has loaded the extension by making a phpinfo file.

This is done by making a blank text file, pasting this code into it;
Code:
<?php phpinfo(); ?>
Saving this as a .php file, then upload it and view it via a web browser.

Press CTRL+F. If you can find 'ssh2', then the extension has been loaded

__________________________________________

Finished!

Congratulations, you've installed the SSH2 extension successfully. Go give yourself a cookie!

If this has helped you, please feel free to leave a comment!
VOXrr is offline   Reply With Quote
Old 24/03/2011, 09:04 PM   #2
Westie
Gangsta
 
Westie's Avatar
 
Join Date: Jul 2009
Posts: 863
Reputation: 63
Default Re: [TUTORIAL] How to install PHP-SSH2

Err... people shouldn't really be running PHP4. It's about a decade out of date already!
Westie is offline   Reply With Quote
Old 24/03/2011, 09:38 PM   #3
Mike Garber
Banned
 
Join Date: Feb 2008
Location: Sweden
Posts: 1,549
Reputation: 6
Default Re: [TUTORIAL] How to install PHP-SSH2

Quote:
Originally Posted by Westie View Post
Err... people shouldn't really be running PHP4. It's about a decade out of date already!
What are you talking about? SSH2 mostly used with PHP5..
Mike Garber is offline   Reply With Quote
Old 07/07/2011, 02:24 PM   #4
Rock_Ro
Huge Clucker
 
Join Date: Mar 2011
Location: Los Santos
Posts: 270
Reputation: 2
Default Re: [TUTORIAL] How to install PHP-SSH2

I need to install this on webhost to run antctrl panel...

( http://serverctrl.hi2.ro )
Rock_Ro is offline   Reply With Quote
Old 22/01/2012, 11:20 PM   #5
John Rockie
Huge Clucker
 
Join Date: Dec 2009
Posts: 330
Reputation: 20
Default Re: [TUTORIAL] How to install PHP-SSH2

Anyone willing to install this on my VPS? I am willing to give $2 dollars via paypal.
John Rockie is offline   Reply With Quote
Old 01/10/2012, 11:00 PM   #6
Modder112
Little Clucker
 
Join Date: Oct 2010
Posts: 2
Reputation: 0
Default AW: [TUTORIAL] How to install PHP-SSH2

I use Confixx an i have a error after the install

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, [no address given] and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.
Apache/2.2.22 (Ubuntu) Server at codeascript.de Port 80
Modder112 is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[tutorial] How to change your Peds Texture (My first tutorial) toXioneer Screenshots and Videos 3 03/12/2010 11:13 PM
I can't install SAMP, I need Someone will install it for me benlevi Client Support 3 31/05/2009 01:47 PM
CANT INSTALL sa-mp-0.2X-u1_2-install 1hit2kill Client Support 1 20/04/2009 12:02 PM


All times are GMT. The time now is 04:04 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.