I am trying to install php_ssh2 extension on wamp.
I do the following things:
- copy libssh2.dll to C:\Windows\SysWOW64
- register the dll file: Regsvr32 libssh2.dll
- copy php_ssh2.dll to C:\wamp\bin\php\php5.5.12\ext
- add extension line in php.ini
i got the message:
Hope if someone will know to help !
Thanks in advance
libssh2 is a PITA. I'd just use phpseclib's libssh2-compatibility-layer:
https://github.com/phpseclib/libssh2-compatibility-layer
Example:
<?php
include('phpseclib.php');
$ssh = ssh2_connect('www.domain.tld');
echo ssh2_fingerprint($ssh);
Basically, it just uses phpseclib to emulate all of the ssh2_* functions.
The libssh2.dll does not need all that doing to it.
As a simple rule of thumb when using WAMPServer, nothing needs to be placed into the C:\windows\....
folders. If you do you destroy the ability to switch versions of Apache/PHP/MySQL at the click of a link which is afterall one of the primary reason to use WAMPServer over other similiar products.
How To Install the SSH2 PHP Extension to WAMPServer.
DOWNLOAD the SSH2 extension from here
- click on the word 'DLL' next to the windows icon to get to the windows builds.
For WAMPServer you will need the TS ( Thread Safe ) versions
Download the Thread Safe version that matches your WAMPServer i.e. 32bit/64bit and the major version of PHP you want to install it into i.e. PHP5.4 or PHP5.5 etc.
If you are running 32bit WAMPServer even on a 64bit Windows you should be using the 32bit (x86) version of ssh2!
Using wampmanager, stop all services
wampmanager -> Stop all Services
Extract these 2 files from the zip (rememeber the SSH2 files are specific to a version of PHP, so make sure you use the correct zip file).
copy libssh2.dll to \wamp\bin\php\phpx.y.z\
copy php_ssh2.dll to \wamp\bin\php\phpx.y.z\ext
Edit php.ini ( using the wampmanager menus )
wampmanager -> PHP -> php.ini
Locate the section containing the extension parameters and add this line
extension=php_ssh2.dll
IF you are using WAMPServer 2.5.15 or later you can skip this next step as it has already been incorporated into the WAMPServer refresh process.
IF you are using WAMPServer 2.5 or older versions :
Edit \wamp\scripts\config.inc.php
Find this section of the file,
$phpDllToCopy = array (
And add this line into the array, it can go anywhere in that list
$phpDllToCopy = array (
'libssh2.dll',
Start all the services again
wampmanager -> Start all Services
Look at
wampmanager -> PHP -> PHP Extensions
You should see php_ssh2 in the list with a tick beside it.
Now you need to get WAMPManager to rebuild the SYMLINKS into the \apachex.y.z\bin folder. So using the wampamanager menus DO:
wampmanager -> Apache -> Version -> 2.4.9
( click on the version number, it may or may not be 2.4.9 )
This should take a few second and then you are ready to test that ssh2 is loaded.
Now launch localhost
wampmanager -> localhost
On the homepage you should see ssh2
in the list of Loaded Services
Click the phpinfo()
link on the WAMPServer homepage and you should see the following information proving that SSH2 has been loaded
Now if you want to use SSH2 from PHP used at the command line ( PHP CLI ) then you need to do one more thing.
Edit \wamp\bin\php\php{version}\php.ini
Locate the section containing the extension parameters and add this line
extension=php_ssh2.dll
You are done.