PHP startup: Unable to load dynamic library php_ssh2 - php

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.

Related

How can I install PHP extension libsodium in Wampserver?

I am trying to install the Libsodium PHP extension using PECL, but I have no idea how to get the dll files needed. I want to use it with Wampserver on Windows 7 (64-bit).
Can any one help me?
Here is How I did it.
Download the libsodium from here > For PHP 7.0, For PHP 5.6 And For PHP 5.5 (All x64). #One Important Note, Please download appropriate x86-32 bit or x64-64 bit of this extension matching of your environment from here
Extract the Downloaded file and copy libsodium.dll to wamp->bin->php->php5(x).x.xx Folder
Copy php_libsodium.dll From the extracted File to wamp->bin->php->php5(x).x.xx ->ext
Now Click on the WAMP System tray icon.
Go to PHP-> PHP Settings and Click on the enable dl from the menu of the WampManager from the system tray
Now Add bellow line to php.ini from PHP -> php.ini from the menu of Wampmanager, save and close it
extension=php_libsodium.dll
Now Restart Apache or click Restart All Services from the menu of WampManager
You should now get your php_libsodium in the extensions of the php Up and Running.
:)
**I didn't notice that, this question is 4 months old. I hope You have solved this.
use command prompt :
pecl install libsodium
and go to wamp folder find php.ini in php folder :
append this line: to ini file
extension=libsodium.so
You might be able to achieve this result by running php5enmod libsodium, depending on which webserver you use. Make sure you restart your webserver after installing PECL libsodium
here is good references:
https://paragonie.com/book/pecl-libsodium/read/00-intro.md#installing-libsodium
You can download the dll files you need here: http://windows.php.net/downloads/pecl/releases/libsodium/1.0.2/
Select the version that corresponds with your PHP version, compiler and architecture. (this can be checked using phpinfo(); on your machine)
Copy php_libsodium.dll to "ext" directory (C:\PHP\ext)
Copy libsodium.dll to root of PHP directory (C:\PHP)
Add extension=php_libsodium.dll to php.ini
restart apache
This worked on a standalone version of PHP running on Windows 7, I see no reason why this shouldn't work on WAMP or XAMP.
Wamp 3.2.0 64-bit
Even though in the past apparently more steps were required (see my comment from 2018), today I installed Wamp 3.2.0 64-bit, and when I got an error about libsodium not working, I was able to easily fix it by:
Wamp tray icon > PHP > PHP Extensions > ensure "sodium" is checked
(Wamp will automatically refresh)
I was pleasantly surprised that is worked!
You can also use https://github.com/paragonie/sodium_compat. You can simply use :
composer require paragonie/sodium_compat

Unable to install php_imagick.dll on wamp

I tried various tutorials online as well steps given on SO answers but nothing worked.
I am using windows 64 bit and m using wamp 2.4 ver and php 5.4.12
I have tried various combinations of Imagemagik and php_imagick.dll but nothing worked
Please help, its very important for to run it
I am getting the following error
I know we can open php.ini directly from wamp icon shown in tray but in my case it was not opening. So i was manually opening it from C:\wamp\bin\php\php5.4.12
But then i realized that we have to make changes in three files to make it work.
That are:
C:\wamp\bin\php\php5.4.12\php.ini
C:\wamp\bin\php\php5.4.12\phpForApache.ini
C:\wamp\bin\apache\apache2.4.9\bin\php.ini
Then I followed the steps given by fsasvari in following link
Download ImageMagick: ImageMagick-6.7.7-5-Q16-windows-dll from here (other versions did not work for me)
Install in C:\imagemagick, on last step check "Add application directory to your system path"
Download Imagick DLL: PHP5.5.x version from http://www.peewit.fr/imagick/ (I have 5.5+ version installed on my localhost
Copy php_imagick.dll to C:\wamp\bin\php\ext
Download PHP 5.5 Thread Safe (TS) x86 version from http://pecl.php.net/package/imagick/3.1.2/windows
Copy CORE_RL_* files to C:\wamp\bin\apache\bin\
Edit php.ini file in C:\wamp\bin\apache\bin\php.ini, add extension=php_imagick.dll line in extensions section
Copy all files from C:\imagemagick\modules\coders and C:\imagemagick\modules\filters to C:\imagemagick to load ImageMagick supported formats
Go to Control Panel -> System -> Advanced Settings -> Environment Variables -> New System Variable -> MAGICK_HOME = C:\imagemagick
Restart Wamp server and check phpinfo() for imagick plugin
If last step does not work, restart Windows
Answer by fsasvari

How to downgrade Wampserver PHP?

I see everywhere for downgrade php on wampserver I just have to do left click wamp> php>version> get more>
And dowload the version I want.
But when I do it I arrive on this page and I don't see any link for download an other php version. I only can download a file php5.2.4.isson this page
So fine I dowload it on php.net and I unzip the archive in my folder "C:\wamp\bin\php\php5.2.4"
Next I copy the files wampserver.conf, php.ini and phpForApache.ini from my folder "C:\wamp\bin\php\php5.5.12" to the folder "C:\wamp\bin\php\php5.2.4"
And to finish I change in the file php.ini and phpForApache.ini the path :
extension_dir = "C:\wamp\bin\php\php5.2.4"
When I restart wamp I have the 2 versions of php the one I use actualy (5.5.12) and the one I want to instal (5.2.4) but when I choose the 5.2.4 my wamp icon became orange and stay like this I don't understand why.
To manually install any version of PHP into WAMP you can follow the following steps...
Download the binaries from php.net
Extract all files into a new folder: C:/wamp/php/php5.4.13 (or whatever the version number is)
Copy the wampserver.conf file from another PHP folder in wamp to the new folder.
Rename php.ini-development file to phpForApache.ini
Restart WampServer by exiting out of Wamp and restarting it)
Note: If you are adding php version 5.6, you need to copy php5apache2_4.dll from another php folder in wamp as well otherwise the wamp server wont start.
Visit Wampserver Activities and download the desired PHP version then run the package to install.
Start the wamp server and try again to left-click wamp> PHP> version > select version
I think best and easiest solution is download older version WAMP ,when installing WAMP you can choose what version of php(default they choose latest version, so attention for that,) do you need, that is work for me. for me need to install to php 7.00 so i tried this wamp 3.2 link here
these are the php versions

MongoDb PHP driver installation issue on wamp

I have php of version 5.5.12 and wamp version 2.4.9 and PHP Extension Build as API20121212,TS,VC11 . I am using this dll 'php_mongo-1.5.5-5.5-vc11.dll' (renamed to php_mongo) but still when i restart my all services mongo db is not displaying on phpinfo().Any pointer where m i going wrong ?
first of all you have to download the latest mongo dll files from
https://s3.amazonaws.com/drivers.mongodb.org/php/index.html
unzip the downloaded file and you will see a bunch of files like this:
now it is time to decide which dll file you have to use.
open your phpinfo() and search for word compiler. you will see sth like this:
so now according to my compiler version (MSVC11) I have to choose file with vc11 word inside their name. according to my PHP version which is 5.5.12 I have to choose file with word 5.5 inside their name.
now search for word thread safety in your phpinfo
and if it was enabled, it means that you have to choose file that doesn't have word nts inside their name but if your thread safety was disabled then you need to choose file with word nts inside their name.
now according to your installation architecture you may choose files with x86_64 inside their name.
after choosing the appropriate dll file, rename it to php_mongo.dll and copy paste it to your php extensions directory which is mostly located at
C:\wamp\bin\php\php5.5.12\ext
now open your php.ini file and add this at the end of it.
extension=php_mongo.dll
according to http://php.net/manual/en/mongo.installation.php
for installing mongo on windows, you have to also include libsasl.dll in your system PATH.
libsasl.dll file is mostly located at
C:\wamp\bin\php\php5.5.12
add this path to your system PATH.
reboot your wamp, refresh your phpinfo page and you should see sth like this:
which means that you have installed mongo correctly. :)
I have never used MONGO, but I was interested to see if there where problems using it with WAMPServer so I did a quick install to prove it shoud work, and it does.
Here is a list of what I did, I hope it helps you work out what you may have done wrong.
First you have to download the Mongo Database manager itself and install it.
Download from https://www.mongodb.org/downloads
Updated Aug 2019:
Download from here now
So you can place the software yourself I would download the ZIP and NOT the .MSI this way you dont get your system messed with by the .msi developer and what they think should be done to your system and you are in complete control.
Download the 32bit or 64 bit version to match your OS and WampServer(32/64) version you are running.
Now the Install is just a case of extracting the files from the zip and placing them somewhere on your system. I suggest :-
Copy the bin folder from the extract to c:\wamp\bin\mongo\mongox.y.z ( x.y.z to match the version of mongo you downloaded).
Create a data folder under that folder, so c:\wamp\bin\mongo\mongox.y.z\data
Create a data folder for your first database under that folder, so \wamp\bin\mongo\mongox.y.z\data\db
Create a config file for mongo in c:\wamp\bin\mongo\mongox.y.z\mongod.cfg and add as a minimum these parameter :-
NOTE: these are just params that will get it running, NOT A DEFINITIVE SET OF PARAMETERS!
systemLog:
destination: file
path: "c:/wamp/logs/mongod.log"
logAppend: true
timeStampFormat: iso8601-local
net:
bindIp: 127.0.0.1
port: 27017
storage:
dbPath: "c:/wamp/bin/mongo/mongo2.6.6/data"
directoryPerDB: true
Now if you want to have mongodb running as a service create a command file like so in the C:\wamp\bin\mongo\mongox.y.z folder :-
Filename = install_service.cmd
mongod.exe --config "c:\wamp\bin\mongo\mongo2.6.6\mongod.cfg" --install --serviceName wampmongodb --serviceDisplayName wampmongodb
sc config wampmongodb start= demand
The space between start= and demand is required, not a typo
For completeness also create an uninstall file :-
Filename = uninstall_service.cmd
mongod.exe --remove --serviceName wampmongodb
Now create 2 command files to start and stop your mongodb instance
Filename = start_mongo.cmd
net start wampmongodb
Filename = stop_mongo.cmd
net stop wampmongodb
Now start a command window using (Run as Administrator) and use these command files to install and start your MONGODB Server
CD \wamp\bin\mongo\mongox.y.z
#Install MONGO as a service
install_service
#Start the service
start_mongo
Now check the c:\wamp\logs folder and make sure there are no errors reported in the mongod.log file
While still in the command window, check that mongo is running by trying a few simple commands
Use the instructions here http://docs.mongodb.org/manual/tutorial/getting-started/ to prove that it is all working.
NOW ADD THE PHP Extension
Download from 'http://pecl.php.net/package/mongo'
Select the version you want and click the Windows icon with the word DLL beside it, in the 'Downloads' column.
This will take you to the download page for that version of the MONGO PHP extension.
You should now select the download link that matches the version of the MONGO extension you want, and the matching (x86) for 32bit WAMPServer installs or (x64) for 64bit WAMPServer installs.
You must click the 'DLL' link otherwise you will get a unix/linux source code.
Remember you must match the 32 or 64 bit to the version of WAMPServer you downloaded
So if you are running Windows 64bit but installed WAMPServer 32bit you need the 32bit version of the MONGO extension.
Also remember that you need the Thread Safe version (TS) to run with WAMPServer's Apache configuration.
Extract the zip file, and copy php_mongo.dll to your PHP folder eg C:\wamp\bin\php\phpx.y.z\ext
Edit your php.ini file to add the new extension.
To use Mongo with your web server (Apache) use the wampmanager menus to edit php.ini i.e.
wampmanager -> PHP -> php.ini
and add this line after all the other extension lines
extension=php_mongo.dll
To use mongo with scripts run from the command line (PHP CLI) edit C:\wamp\bin\php\phpx.y.z\php.ini and add the extension line again in there.
Start Wampmanager. Or Restart the Apache service.
This should refresh WAMPServers config and pick up the new PHP extension, if not do this when wampmanager is running:-
wampmanager -> Apache -> Service -> Restart Service
Run localhost by :-
wampmanager -> localhost
and then click on the phpinfo() link on the homepage.
You should now see a section entitled 'mongo' with some configuration options listed. If you do the PHP MONGO extension is active.
IMPORTANT
If you are running Windows Server 2008 R2 or Windows 7 you may have to install this HotFix to resolve an issue with Memory Mapped Files.
Request it from here http://support.microsoft.com/kb/2731284/en-us. You have to ask for it, and then they send you an email telling you where it can be downloaded from.
The link they gave me was http://hotfixv4.microsoft.com/Windows 7/Windows Server2008 R2 SP1/sp2/Fix405791/7600/free/451412_intl_i386_zip.exe
However I did not need to install it to get to the stage where MONGO was installed and running simple tests from the command line AND through Apache and PHP.
If you still facing the problem follow bellow two rules:
Make sure you downloaded drivers from
http://pecl.php.net/package/mongo
Try version 1.5.1 drivers (When I
am writing this the latest driver version is 1.6.8 but 1.6.8 to 1.5.5 nothing is worked for me)
Have you entered the .dll in your php.ini file (properly)?
http://docs.mongodb.org/ecosystem/drivers/php/
Scott
Updates for PHP 7 version.
As per documentation we have to download mongodb-1.2. You can download it from here based on your PHP version.

PHP Install SSH2 on Windows machine

I am trying to install this on a Windows+Apache machine.
Documentation says that SSH2 requires the OpenSSL and libssh2 libraries.
I have added this lines in my php.ini file:
extension=php_openssl.dll
extension=php_ssh2.dll
and restarted Apache but it still not working (Fatal error: Call to undefined function ssh2_connect()).
Can anyone explain me how to install this service?
Here's how I did it:
Downloaded Win32 SSH2 PECL extension from this location
(choose the appropriate version);
Extracted the archive's content and:
placed php_ssh2.dll and php_ssh2.pdb files in the ext folder (e.g. C:\php\ext);
copied libssh2.dll file to C:\Windows\system32 and (if you got Win64) C:\Windows\SysWOW64 folder(s);
Run the following command to register the DLL:
C:\> regsvr32 libssh2.dll
Restarted Apache.
Final note
If you got PHP x64, you have to lookup for the x64 version of the SSH2 library / DLLs.
This site offers some Win64 compiled libraries for PHP, try here first.
Hope this helps.
If anyone is having trouble installing SSH2, here's how I did it:
1) Download SSH2 PECL library from PHP.net [choose the appropriate version].
2) Copy libssh2.dll to System32 [x86] or SysWOW64 [x64] folder.
3) Copy php_ssh2.dll and php_ssh2.pdb to php/ext folder.
4) Remove ';' from the ;extension=php_ssh2.dll line in php.ini. If this line is not on your php.ini, add it.
5) Restart Apache.
Place php_ssh2.dll in ext folder
Place libssh2.dll in php folder
Restart IIS
that work for me
PHP 5.4.25 NTS + Windows Server 2012
If you are running xamp 3.2.1 and PHP 5.6.8, this could be helpful for you.
Do what alex b said, and download the package that corresponds dependindg your php version (and bits) from this page (link)
I've downloaded and replaced in C:\xampp\php\ext and it worked!
Hope this helps, regards.
libssh2 (deps): http://windows.php.net/downloads/php-sdk/deps/
php_ssh2 (ext): http://windows.php.net/downloads/pecl/releases/ssh2/0.12/
Versions prior to 5.5 has already the libssh2.dll (from the second link)
I have wamp with PHP 5.6.25/7.0.10 – MySQL 5.7.14 installed and I cm currently working on PHP 7.0. I had the same error. I checked using phpinfo() if both librarires OpenSSL and libssh2 was working(you can google how to check it). After I could see they was working, I have downloaded php_ssh2.dll at http://pecl.php.net/package/ssh2/1.0/windows (can also be found http://windows.php.net/downloads/pecl/releases/ssh2/ ) for the 7.0 version, put it to php\ext folder. Than I included it in php.ini file using extension=php_ssh2.dll.
Then it appeared at phpinfo(). And it worked. Hope it helps.
Fix that worked for me. Am running xampp v. 3.2.1 apache 2.2 facing the same issue tried placing the dll files at different c: location but failed finally this helped.
1.) Download the version specific dll files from http://pecl.php.net/package/ssh2/0.12/windows and extract the files
Note that even though you are in 64 bit version of windows download the 32 version of THREAD SAFE ssh i.e. Thread Safe (TS) x86 as per your version of php
2.) Add/replace the libssh2.dll at C:\xampp\php (standard installation)
3.) Add/replace the php_ssh2.dll & php_ssh2.pdb within the C:\xampp\php\ext (standard installation)
4.) restart the apache server
Worked Like a charm
CHEERS
First of all, your question reveals two misconceptions:
The Requirements section actually says this:
The » OpenSSL and » libssh2 libraries are required. Ensure that the
development libraries are installed, where a typical package name
might be openssl-dev.
It isn't talking about PHP extensions, it's talking about third-party libraries that have nothing to do with PHP.
extension=php_ssh2.dll requires that you actually have a file called php_ssh2.dll in your PHP's ext directory and you probably don't have it, mainly because it isn't bundled with PHP.
If we check the Installation chapter we can read that SSH2 is a PECL extension. There're a few links with instructions but I can make a summary of the important info:
You need a php_ssh2.dll file that matches your PHP installation.
Neither the PHP team nor the PECL team distribute such file.
Installing PECL extensions on Windows is hard. You need to download the C source code, grab a C compiler and make the file yourself, or find someone who already did it for you.
Said that, unless you Google for php_ssh2.dll and find something relevant, you're probably out of luck.

Categories