24.03.2011, 19:28
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.
__________________________________________
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
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.
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
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
__________________________________________
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!
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
Код:
php -m |grep ssh2
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
Код:
cd /usr/src wget http://www.libssh2.org/download/libssh2-...5738023tar -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
Код:
pecl install -f ssh2
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.
Код:
extension=ssh2.so
Код:
/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;
Код:
<?php phpinfo(); ?>
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!