[TUTORIAL] How to install PHP-SSH2 -
VOXrr - 24.03.2011
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
Код:
aptitude install libssh2-1-dev libssh2-php
Then try and see if PHP recognises that the SSH2 extension has been installed
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.
Код:
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.
__________________________________________
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
Код:
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.
Then restart your web server, using one of these commands - Whichever is appropriate
Код:
/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;
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!
Re: [TUTORIAL] How to install PHP-SSH2 -
Westie - 24.03.2011
Err... people shouldn't really be running PHP4. It's about a decade out of date already!
Re: [TUTORIAL] How to install PHP-SSH2 -
Mike Garber - 24.03.2011
Quote:
Originally Posted by Westie
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..
Re: [TUTORIAL] How to install PHP-SSH2 -
Rock_Ro - 07.07.2011
I need to install this on webhost to run antctrl panel...
(
http://serverctrl.hi2.ro )
Re: [TUTORIAL] How to install PHP-SSH2 -
John Rockie - 22.01.2012
Anyone willing to install this on my VPS? I am willing to give $2 dollars via paypal.
AW: [TUTORIAL] How to install PHP-SSH2 -
Modder112 - 01.10.2012
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