PHP Startup Unable to load dynamic library php_mongo.dll - php

I'm a beginner for this. I'm trying to install mongodb driver on php.
Platform: Windows 8.1 64bit.
PHP 5.5.9
Apache/2.4.7
Followed the instruction here:http://php.net/manual/en/mongo.installation.php#mongo.installation.windows
I've tried all php_mongo.dll file with VC11 and put in php/ext folder. and added extension=php_mongo.dll in php.ini file but when I tried to start apache in xampp controller I got an error.
Php Startup: Unable to load dynamic library
'C:\xampp\php\ext\php_mongo.dll' -%1 is not a valid Win32 application.
I've already check my VC compilator version inside phpinfo() and it's stated there MSVC11 with architecture: x86.
it would be nice if someone can help me.
Thanks. appreciate it.

Make sure you download the correct .DLL for your PHP installation. Good chance you're running apache x86, so download an x86 php_mongo.dll. Also if you're running PHP as an Apache module, make sure you pick the thread safe (ts) one and also pick this type of dll that matches the PHP version you're running.
The versions must match or else you will get a php startup error. Find these Mongo DLLs here.
I did this then I got an error libsasl.dll not found. I simply copied the libsasl.dll found in my PHP installation directory to the Apache installation directory (where httpd.exe is found). Then I restarted my Apache and it worked!

For anyone googling this in 2017, the PECL Package has been updated and is now found at http://pecl.php.net/package/mongodb/1.2.9/windows
and use:
extension=php_mongodb.dll
instead of:
extension=php_mongo.dll

Copy C:\xampp\php\libsasl.dll to C:\xampp\apache\bin\, restart Apache and enjoy.

If you are still having problems after doing the above, do try older version drivers instead.
That is what worked for me on for my XAMPP/ PHP 5.5 on windows 8.
Older drivers can be found here: https://s3.amazonaws.com/drivers.mongodb.org/php/index.html
New drivers can be found here: http://pecl.php.net/package/mongo/1.5.5/windows
You may also want to visit : https://serverfault.com/questions/563867/mongodb-unable-to-load-driver-on-php

This is normally because we use 64 Bit supported DLL file 64 Bit system. But the wamp/xampp architecture could be 32 Bit. We need to use based on the wamp/xampp architecture not the windows architecture. So, try to find relevant version of DLL file to the wamp/xampp architecture. The solution in the below link worked like a charm to me,
http://grokbase.com/t/gg/mongodb-user/151xpk3fkr/php-5-6-3-with-mongodb-driver-unable-to-load-dynamic-library-not-a-valid-win32-application
This link helps you to find the wamp/xampp architecture, https://stackoverflow.com/a/22454865/4874281

After doing all the steps as mentioned in previous comments xampp may not be able to load the ".dll" file. Just ensure to add the path of the ".dll" file's folder to the environment variable as a system variable path.
I was facing same issue, then after adding the path of the ".dll" file's folder to the environment variable as a system variable path, it worked. It is then able to find the file.
At the end that was the only step which was stopping xampp to load the ".dll" file, although it was present in that folder. Often people miss this step as it is no where pointed out clearly.

My PHP version is 7.2.3 x86
Go to this website and pick DLL according to php version:
https://pecl.php.net/package/mongodb/1.4.2/windows
And set this in php.ini
extension=mongodb

Related

Curl not enable wamp [duplicate]

I'm running PHP 5.2.3 on Windows 2000 Server with IIS 5. I'm trying
to get cURL working, so in my php.ini file, I have this line:
extension_dir ="F:\PHP\ext"
And later, I have:
extension=php_curl.dll
The file F:\PHP\ext\php_curl.dll exists, but when I try to run any PHP
script, I get this in the error log:
PHP Warning: PHP Startup: Unable to load dynamic library 'F:\PHP\ext
\php_curl.dll' - The specified module could not be found.
in Unknown on line 0
Problem solved!
Although the error message said The specified module could not be found, this is a little misleading -- it's not that it couldn't find php_curl.dll, but rather it couldn't find a module that php_curl.dll required. The 2 DLLs it requires are libeay32.dll and SSLeay32.dll.
So, you have to put those 2 DLLs somewhere in your PATH (e.g., C:\Windows\system32). That's all there is to it.
However, even that did not work for me initially. So I downloaded the Windows zip of the latest version of PHP, which includes all the necessary DLLs. I didn't reinstall PHP, I just copied all of the DLLs in the "ext" folder to my PHP extensions folder (as specified in the extension_dir variable in php.ini), and I copied the versions of libeay32.dll and SSLeay32.dll from the PHP download into my System32 directory.
I also did an iisreset, but I don't know if that was necessary.
libeay32.dll and ssleay32.dll have to be path-accessible for php_curl.dll to work correctly.
In Control Panel -> Search -> Advanced System Settings and use the button Environment Variables.
Under System Variables find Path add the c:/php folder (or whatever path) and restart Apache.
A tip is to use the WAMP-installer. Everything just works. It's not IIS though - so if it is important - you should ignore my advice. ;)
EDIT: I saw that you found the solution so I voted it up. +1
I keep having same problem although i did the suggestion above and many others suggested on the internet i get
Sorry, but this plugin requires libcurl to be activated on your
server.
When i try to activate my plugin.
Edited: I was using php 5.3.13 had win64 windows 7 and none of the soln was working for me.
1.I had tried to copy the libeay32.dll SSLeay32.dll in windows\system32 folder did not work
2. Edited and uncommented both php.ini files did not work
3. Activated php_curl in php extensions did not work
4. Copied and replaced several times the www.anindya.com version of php_curl.dll but seems i was downloading the wrong version of this. The version that worked for me was in Fixed curl extensions section the second file php_curl-5.3.13-VC9-x64
Hope this will help anyone else
Faced this problem when I upgraded the php in UwAmp to 7.2.*. The only solution that worked for me was to download the latest version of apache at the time (Apache/2.4.37 (Win32)) and replace the one that came with UwAmp. That also involved editing the sample httpd.conf to produce an httpd_uwamp.conf file. UwAmp needs this template to then generate the actual httpd.conf when it starts up. All other suggestions above didn't resolve it for me unfortunately. Also note that as of OpenSSL 1.1, libeay32.dll and ssleay32.dll are no longer required (see http://php.net/manual/en/curl.installation.php)
In your case just add "F:\PHP\ext" to Environment Variable "path".

cannot load php5apache2_2.dll

cannot load c:/PHP5/php5apache2_2.dll into server I am getting this error while running apache 2.2 on window XP machine
anyone have any idea what could be the problem. I can see there is no php5apache2_2.dll in c:/php5 folder.
What worked for me was obtaining php5apache2_4.dll-php-5.4-win32.zip from
apachelounge and using "php5apache2_4.dll" file from the "PHP 5.4.8" unzipped folder. I had apache 2.3.4 (32-bit) from apachelounge.com and php 5.4.9 (32-bit) from windows.php.net installed on my Win 7 (64-bit).
The dll worked despite 5.4.8 - 5.4.9 mismatch.
The corrsponding changes within "php.ini" and "httpd.conf" are to be maintained acoording to this helpful guide.
Best regards.
First you must downlaod de .dll file (php5apache2_2.dll)
then put it in your extensions directory.
Then edit your php.ini file, find de text:
;extension=php5apache2_2.dll
// and change y to
extension=php5apache2_2.dll
if the text is not present put the line yourself.
Then restart apache and it should load your extension.
PD: you can see where your extensions directory is located looking
for the text "extension_dir" in your php.ini, sometimes looks like:
extension_dir = C:\php\extensions
Hope this help you, if not please paste the error here, you can find
an error log file in apache/error/error.log or something like that.
You should download the dll file from PHP distribution package. And see three ways to set up PHP to work with Apache 2.x.
You can configure PHP as Apache handler in <[apache_home]>\conf\httpd.conf as follow:
LoadModule php5_module "c:/php/php5apache2_2.dll"
AddHandler application/x-httpd-php .php
#configure the path to php.ini
PHPIniDir 'C:\php\'
NOTE: To avoid the error while starting apache, the php ini dir path should be in single quotes with backslash. Don't forget to end it with backslash.
Here is how I got it to GO:
Created the folder C:\Apache
Downloaded and installed http-2.2.22-win32-x86-no-ssl.msi
During install, entered localhost as Network Domain and Server Name
From browser, typed in url http://localhost/ and page came up with "It Works"
(I do not know if there is a God, but took that as a good sign:)
Created the folder C:\PHP
Downloaded and installed php-5.2.17-Win32-VC6-86.msi
Created a new file in notepad with the following:
Saved it in the Apache/htdocs folder as phpinfo.php
From browser, typed in url http://127.0.0.1/phpinfo.php
It did not work (i.e. it did not run the .php program file)
Hmm, oh yeah, you have to restart Apache for it to see updates to its
own configuration file
Start, Apache, Control..
-> generated the error that it could not find C:\Apache\php5apache2_2.dll
Well, I found it in C:\PHP and I copied it to C:\Apache\
Start, Apache, Control..
-> generated an error about a problem with the PHPINIDir directive on line 495 of C:/Apache/conf/httpd.conf
Fixed that by editing this line in the above file to
PHPIniDir "C:/PHP/php.ini"
Tried to restart Apache again, run the test file in the browser.
Still, it did not work:(
Recalled seeing this before and decided to reboot computer
Restarted (or started) the Apache Server
Ran the test file again..
IT WORKED!
Note that in some of the above I may have mixed up some forward and back slashes
Good luck!
You are getting an error due to the fact that the c:/PHP5/php5apache2_2.dll is not shipped with the non-thread safe version of PHP that you probably downloaded. Two options:
Download and install the thread safe version of PHP instead and you
will get everything you need.
If the non-thread safe version is important to what you want to accomplish, download the zip bundle of the thread safe version and take only the .dll you need from there.
Which version: For Apache Server 2.2, you need to download PHP 5.4 thread safe, which is shipped with both php5apache2_2.dll and php5apache2_4.dll. Some earlier versions probably work as well. PHP 5.5 is only shipped with php5apache2_4.dll which will mismatch with your version.
Cf the download links here on the official site: http://windows.php.net/download/.
Please check that for using Apache you should download VC6 version of PHP. If you use VC9 Apache will not start. It is clearly given in the site.
http://in3.php.net/manual/en/install.windows.manual.php
For me the problem was resolved by replacing the file php5apache2_2.dll from another site, somehow the file downloaded from the php.net site was corrupt.
I had already the file php5apache2_2.dll on my wamp 2.2 and the PHP version 5.3.13 so I just copied that file into my version 5.4.35 and it worked.
I did not have to mess with the apache configuration as other people suggest.
One more thing I did was to install the Visual C++ Redistributable for Visual Studio 2008 for my x64 machine running Windows 7 Ultimate Edition. I don't think this helped since I had already the x86 version and working with my previous PHP version, but is part of the action I taken.
None of the suggestions above worked for me. I tried replacing the php5apache2_2.dll file and restarting everything, but got the same error. I ended up uninstalling Apache, MySQL, and PHP, removing the path variables, and then installing WampServer. Had everything up and running in less than 5 minutes.
By the way, I uninstalled PHP by just deleting the folder in Program Files, since it did not turn up in Add/Remove Programs. I also deleted any leftover Apache and MySQL folders after the uninstalls.
Even file exist and apache shows error that this file don't exists, install Microsoft C++ Redistributable Package. Note, that you have to install 2008 version, then 2010. Install both packages, not only 2010 version.
I've had a similar problem. I found out after following a particular Youtube tutorial that if you go and edit the httpd.conf file while Apache is running... it will mess up.
Make sure that you install Apache first... then turn it off, then install php afterward. It should then edit the httpd.conf file itself. This Youtube tutorial solved my problem. http://www.youtube.com/watch?v=UKbEzmMliNM
Hope it helps. I got MySQL installed and working too... but had to install the .Net 4 Framework.
You need to install "http-2.2.22-win32-x86-no-ssl.msi" instead.
I had the same error.
I had installed x64 version of Apache and x86 version of php.
After a lof of searching I found that this doesn't work.
So I had to install x64 (threadsafe) version of PHP.
After this Apache works fine . :)
Hope this helps!
If your php5apache2_4.dll is missing:
My problem was the php5apache2_4.dll was not included in PHP install zip. It is included only the Thread Safe version of PHP 5.4.38
http://windows.php.net/downloads/releases/php-5.4.38-Win32-VC9-x86.zip

installing PHP APC extension on windows

I want to install the APC extension for PHP. I've got to this page and I'm a little stuck.
I've downloaded a file from here, which gives me a APC-3.1.9.tgz file.
I've extracted the file. However from the page I've mentioned above, I'm given the impression I need to load a .dll file.
I'm lost and confused, what should I be doing?
OS: Windows Vista
Server: Apache
PHP: 5.3.5
You can download the compiled dll from downloads.php.net.
From http://www.php.net/manual/en/apc.installation.php
A DLL for this PECL extension is currently unavailable. See also the
building on Windows section.
In other words: no easy way on Windows
I downloaded the file from above mentioned http://downloads.php.net/pierre/. The zip contains two folders: "nts" and "ts" (probably "tread safe" and "non thread safe") with php_apc.dll file.
You must put this file in your PHP extensions folder (for exemple c:\wamp\bin\php5.4.1\ext) and edit PHP.ini file to add or uncomment the line:
extension=php_apc.dll
After restarting web service (Apache, IIS, etc.) you can check the PHP configuration with
<?php phpinfo(); ?> to see if "apc" block appeared
Here's hoping people looking for APC for Windows are still checking this post.
I just found APC 3.1.9 for Windows here:
http://dev.freshsite.pl/php-accelerators/apc.html
Confirmed working on Apache 2, PHP 5.3.8, Windows 7 (32-bit).
try this Alternative PHP Cache (APC) 3.1.9 extension
https://code.google.com/p/xampp-php-extensions/downloads/detail?name=php_apc.dll&can=2&q=

mcrypt and IIS - module does not load in PHP

I have Windows 2003 Standard, IIS 6, PHP, MySQL and amy trying to get mcrypt working so I can use phpMyAdmin.
I have uncommended php_mcrypt.dll in php.ini and this file is in my extensions folder (c:\php).
I have downloaded libmcrypt.dll to c:\php, c:\php\ext, c:\windows, c:\windows\system32. I have also found a second version of this file on the next and tried that. After each change I have restarted IIS.
Whatever I try mcrypt does not seem to be loaded when I check php_info();. But there are no errors showing.
Is there another version of php_mcrypt.dll? does anyone have a version of phpMyAdmin that does not need mcrypt? Has anyone experienced this problem / have a solution?
All help will be greatly apprecaited.
Many thanks,
Tim
I had the same problem and found that the version of libmcrypt.dll I had was corrupt and when I downloaded a version from the net it was fine. As you have already done this I doubt this helps?
We had the same issue on W2k3(x64)/IIS6/PHP5.2.17. Copying libmcrypt.dll to %WINDIR%\SysWOW64 and an IISRESET solved the problem.
Make sure your extension_dir in php.ini points to the right path (e.g. c:/php5/ext)
Try restarting windows after each change instead of IIS.
libmcrypt.dll only has to be in c:\windows\system32
To be sure mcrypt is (not) loaded, use phpinfo() to check.
I'm also having difficulty getting mcrypt to load, but above has helped me a lot in getting closer to a solution.
Try starting php from the commandline with php -m. It will show you a list of loaded modules.
I was having a weird issue with Win 2k3 Server + IIS 6 + PHP 5.2.9 + mcrypt as well. As soon as I added the mcrypt (or mhash for that matter) extension, fastcgi just timed out. When I removed those extensions from php.ini I see my phpinfo() page as expected. The really weird part was that I could see the module loaded when I run php -m from the command line.
I grabbed all of the dlls from XAMPP (in the php folder) and stuck them all in my PHP installation folder (C:\Program Files\PHP for me). After making the the change to my php.ini
extension=php_mcrypt.dll
I restarted IIS completely rather than recycling the App Pool and my phpinfo page worked as expected. I am not sure why but fastcgi wasn't able to "see" the libraries in the system32 folder, I had to put them in my php root folder.
Good luck.
In my case, my site gave the error "PHP Warning: mcrypt_decrypt()..."
I use IIS6 - Plesk - PHP 2.5
So, I updated PHP version in Plesk CP to 5.3 and then the error disappeared.
Hope this helps somebody.

PHP / cURL on Windows install: "The specified module could not be found."

I'm running PHP 5.2.3 on Windows 2000 Server with IIS 5. I'm trying
to get cURL working, so in my php.ini file, I have this line:
extension_dir ="F:\PHP\ext"
And later, I have:
extension=php_curl.dll
The file F:\PHP\ext\php_curl.dll exists, but when I try to run any PHP
script, I get this in the error log:
PHP Warning: PHP Startup: Unable to load dynamic library 'F:\PHP\ext
\php_curl.dll' - The specified module could not be found.
in Unknown on line 0
Problem solved!
Although the error message said The specified module could not be found, this is a little misleading -- it's not that it couldn't find php_curl.dll, but rather it couldn't find a module that php_curl.dll required. The 2 DLLs it requires are libeay32.dll and SSLeay32.dll.
So, you have to put those 2 DLLs somewhere in your PATH (e.g., C:\Windows\system32). That's all there is to it.
However, even that did not work for me initially. So I downloaded the Windows zip of the latest version of PHP, which includes all the necessary DLLs. I didn't reinstall PHP, I just copied all of the DLLs in the "ext" folder to my PHP extensions folder (as specified in the extension_dir variable in php.ini), and I copied the versions of libeay32.dll and SSLeay32.dll from the PHP download into my System32 directory.
I also did an iisreset, but I don't know if that was necessary.
libeay32.dll and ssleay32.dll have to be path-accessible for php_curl.dll to work correctly.
In Control Panel -> Search -> Advanced System Settings and use the button Environment Variables.
Under System Variables find Path add the c:/php folder (or whatever path) and restart Apache.
A tip is to use the WAMP-installer. Everything just works. It's not IIS though - so if it is important - you should ignore my advice. ;)
EDIT: I saw that you found the solution so I voted it up. +1
I keep having same problem although i did the suggestion above and many others suggested on the internet i get
Sorry, but this plugin requires libcurl to be activated on your
server.
When i try to activate my plugin.
Edited: I was using php 5.3.13 had win64 windows 7 and none of the soln was working for me.
1.I had tried to copy the libeay32.dll SSLeay32.dll in windows\system32 folder did not work
2. Edited and uncommented both php.ini files did not work
3. Activated php_curl in php extensions did not work
4. Copied and replaced several times the www.anindya.com version of php_curl.dll but seems i was downloading the wrong version of this. The version that worked for me was in Fixed curl extensions section the second file php_curl-5.3.13-VC9-x64
Hope this will help anyone else
Faced this problem when I upgraded the php in UwAmp to 7.2.*. The only solution that worked for me was to download the latest version of apache at the time (Apache/2.4.37 (Win32)) and replace the one that came with UwAmp. That also involved editing the sample httpd.conf to produce an httpd_uwamp.conf file. UwAmp needs this template to then generate the actual httpd.conf when it starts up. All other suggestions above didn't resolve it for me unfortunately. Also note that as of OpenSSL 1.1, libeay32.dll and ssleay32.dll are no longer required (see http://php.net/manual/en/curl.installation.php)
In your case just add "F:\PHP\ext" to Environment Variable "path".

Categories