I am trying to install mongo in php 5.6.0 using MAMP 3.0.
I have correctly downloaded the mongo library and added it to my php.ini.
extension=php_mongo-1.5.7-5.6-vc11.dll
When I run php from the command line, I receive the following (mongo works):
C:\MAMP\bin\php\php5.6.0>php -c ..\..\..\conf\php5.6.0\php.ini -i | findstr /R /C:"mongo"
mongo
mongo.allow_empty_keys => 0 => 0
mongo.chunk_size => 261120 => 261120
mongo.cmd => $ => $
mongo.default_host => localhost => localhost
mongo.default_port => 27017 => 27017
mongo.is_master_interval => 15 => 15
mongo.long_as_object => 0 => 0
mongo.native_long => 0 => 0
mongo.ping_interval => 5 => 5
However, when I start MAMP with errors_on, I receive the following:
PHP startup: Unable to load dynamic library
'C:\MAMP\bin\php\php5.6.0\ext\php_mongo-1.5.7-5.6-vc11.dll' - %1 is not a valid Win32 application.
What am I doing wrong?
Under Windows you have to use the thread safe version. Otherwise the module can't be loaded. You should have a look at the PHP-Version in your case 5.6 of that module and an ts in the filename for your extension.
But i think your problem is that you use a 64bit version. In your package is a file called:
php_mongo-1.5.7-5.6-vc11-x86_64.dll that should work.
https://s3.amazonaws.com/drivers.mongodb.org/php/index.html
I finally resolved this by down-revving php and the mongo driver until I could find one that played well together. I'm using php 5.5.12 with mongo driver php_mongo-1.4.5-5.5-vc11.dll.
I don't think this has anything to do with MAMP per se, it's more about getting apache to play with php and mongo.
After struggling a lot with this problem I finally found how to do it:
find on your enviroment the REAL php.ini location used by the system. To do this create a page with phpinfo() and read it on browser, there you find the location of php.ini configuration, in my enviroment was under C:\Windows
open in admin mode the php.ini file and edit it adding, if not exist, the mongo info about extension: i.e. : extension=php_mongodb.dll ensure you type it right (underscore, "mongodb", etc...); than save all.
in the same file look for the extension_dir, the extension directory used by the current php installation. In my enviroment it was C:\MAMP\bin\php\php7.3.19\ext. Now go there and this is the folder where you have to copy past the RIGHT dll
go here https://pecl.php.net/package/mongodb and find the RIGHT version for your enviroment that means you have to know if you are running on x86 or x64 (look on System Info) and if your config usese Thread Safe or not (run on cmd php -i|findstr "Thread"). In my config it was x64 and TS.....NOW this is THE POINT: under that link you will find a lot of versions i.e. 1.12.0 or 1.7.1 and so on, you have to open the sublink and on bottom of page look if the opened one is compatible with your php version (i.e.: 7.3) BUT you have to do anyway some tries with those dll version, in my case I found that the 1.8.0 was compatible with PHP 7.3 I copied it in the ext folder of point 3) BUT nothing worked, so I needed to find a minor version ALWAYS compatible with my PHP 7.3. So for php 7.3 there were at least 3 dll version (1.8, 1.7, 1.6 and so on...) I had success with dll 1.6....SO MAMP needs to find the right one for your system...as soon as I placed the right files in the ext directory and restarted Apache via MAMP interface, the phpinfo spit out the notice that mongo was recognized!!!
So the trick is just try the right dll for PHP version until it match!
Related
I need to install Imagic extension on my Apache - PHP 7.0 server. I followed very nice guide located here: https://herbmiller.me/2016/06/16/installing-imagick-php-7/. Based on "php -i" out:
PHP Version => 7.0.13
Compiler => MSVC14 (Visual C++ 2015)
Architecture => x86
Thread Safety => enabled
extension_dir => D:\Program Files (x86)\PHP7\ext => D:\Program Files (x86)\PHP7\ext
I downloaded file
php_imagick-3.4.3rc4-7.0-ts-vc14-x86.zip
from http://windows.php.net/downloads/pecl/releases/imagick/3.4.3rc4/. I coppied all DLL files to D:\Program Files (x86)\PHP7\ext and I added
extension=php_imagick.dll
to my PHP.INI. When I restarted my Apache, Imagic extension was not loaded and Event viewer showed 2 same errors:
The description for Event ID 4 from source PHP-7.0.13 cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.
If the event originated on another computer, the display information had to be saved with the event.
The following information was included with the event:
php[11628]
PHP Warning: PHP Startup: Unable to load dynamic library 'D:\Program Files (x86)\PHP7\ext\php_imagick.dll' - The specified module could not be found.
("d:\Program Files (x86)\Apache24\bin\httpd.exe" -k runservice)
Please, could anybody tell me, what I am doing wrong?
This is the only tutorial that worked our for me:
https://tektriks.com/a-step-by-step-guide-on-how-to-install-imagemagick-in-windows/
I am using PHP version 7.1.9 with WampServer64 under Windows 7.
Follow the steps from the given tutorial:
https://herbmiller.me/2016/06/16/installing-imagick-php-7/
The file I downloaded was ImageMagick-6.9.3-7-vc14-x64.zip
http://windows.php.net/downloads/pecl/deps
Install ImageMagick to a directory of your choice
Extract the whole of the bin directory from the ImageMagick zip file to a directory of your choice. I chose C:\ImageMagick-6.9.3-7
Then set system environment variables and reboot.
Follow the instructions on https://mlocati.github.io/articles/php-windows-imagick.html
Essentially:
downloading and unpacking two ZIP files
copy some files into the PHP installation
change php.ini
restart the web server
This step worked perfectly for me.
First of all, download from below link.
-Install the ImageMagick PHP extension in Windows
Extract from php_imagick-….zip to the ext directory the
php_imagick.dll file of your PHP installation
Extract from ImageMagick-….zip to the root PHP directory (where
php.exe resides) the DLL files that start with (and there are a TON):
CORE_RL_
IM_MOD_RL_
Add this line to your php.ini file
extension=imagick
And then to run a simple test (should output a 1):
php -r "print(class_exists('imagick'));"
References:
https://github.com/Imagick/imagick/issues/224#issuecomment-367532736
I have followed instructions down to the letter, but WAMP is not loading php_mongo.dll.
I have downloaded the latest version of WAMP and the MongoDB PHP driver, made sure I am using the correct versions and have also tried a few different versions, added lines to the php.ini file, but to no avail.
Currently I have:
Wamp Server version 2.5, just did a clean install.
MongoDB driver version 1.5.4-5.5 (thread safe) vc11 build for x86 (running 32 bit Windows).
Renamed the file 'php_mongo.dll' and put it in the standard extension directory (C:\wamp\bin\php\php5.5.12\ext).
Added the line extension=php_mongo.dll to the php.ini file and checked it stays there after saving and closing the file.
Ensured that it appears in the list of extensions and is ticked on the Wamp control panel.
But I can't get it to show by using phpinfo(), so I assume that means it cannot start. Every tutorial says to 'make sure you're using version x or stable release y'. I have tried about 15 different combinations and this is the closest I have got.
Can anyone help?
UPDATE:
Got rid of WAMP as I wanted finer control. I've got Apache 2.2 and PHP 5.4.12 working great, but Mongo is still not playing ball. I've checked the server logs and it's giving me this line:
PHP Warning: PHP Startup: Unable to load dynamic library 'C:\php\ext\php_mongo.dll' - The specified module could not be found.\r\n in Unknown on line 0
When I used a different version of the driver I got an error saying it wasn't a valid win32 program, but now it's saying that (even though that file DOES exist).
I have a Drupal site running on fresh MAMP PRO 3.0.3 install with the PHP version 5.3.28 on OS X Mavericks 10.9.2.
I installed memcache with pecl install memcache and added the extension=memcache.so line in php.iniunder the extensions section, but still Drupal shows multiple You must enable the PECL memcached or memcache extension to use memcache.inc. errors on top of the page.
phpinfo() on the Drupal root directory tells me that the configuration file loaded is at:
/Library/Application Support/appsolute/MAMP PRO/conf/php5.3.28.ini
and the extension dir is:
/Applications/MAMP/bin/php/php5.3.28/lib/php/extensions/no-debug-non-zts-20090626/
$ cat "/Library/Application Support/appsolute/MAMP PRO/conf/php5.3.28.ini" | grep memcache
extension=memcache.so
$ ls /Applications/MAMP/bin/php/php5.3.28/lib/php/extensions/no-debug-non-zts-20090626/ | grep memcache
-rwxrwxr-x 1 user admin 65K Mar 28 14:00 memcache.so*
What am I doing wrong or is this problem related to MAMP PRO 3? I've installed the memcached binaries with homebrew and the process is running.
I'm also using the Individual PHP versions for every host setting in MAMP.
When starting Apache, there is an error in the logs:
PHP Warning: PHP Startup: Unable to load dynamic library '/Applications/MAMP/bin/php/php5.3.28/lib/php/extensions/no-debug-non-zts-20090626/memcache.so' - dlopen(/Applications/MAMP/bin/php/php5.3.28/lib/php/extensions/no-debug-non-zts-20090626/memcache.so, 9): Symbol not found: _zend_new_interned_string
Referenced from: /Applications/MAMP/bin/php/php5.3.28/lib/php/extensions/no-debug-non-zts-20090626/memcache.so
Expected in: flat namespace
in /Applications/MAMP/bin/php/php5.3.28/lib/php/extensions/no-debug-non-zts-20090626/memcache.so in Unknown on line 0
What does this mean.
Thanks for your help!
I did not get the memcache extension provided by pecl to work at all. I even installed PHP 5.3.14 but encountered the same problem. Then I cloned the php-memcached-mamp repository from github and used the memcached extension from there and it worked ok.
Add intl extension to your configuration.
I just found this problem and another post that helped me fix it. macports installed php-config53 (not php-config) and I had a vagrant php-config from an old php 5.4 install. Removed /usr/bin/php-config and symlinked php=config53 -> php-config, re-rean pecl install memcache-beta and it worked.
I am borrowing the similar thread that wasn't helpfull for me:
php_memcache.dll for PHP 5.3
I setup a server using the latest version of easyPHP for Windows. With it came PHP 5.4. I'm now looking for a memcache.dll file that worked for me before and I get this error
"PHP Startup: memcache: Unable t initialize module.
Module compiled with module API=20090626
PHP compiled with module api=20100525
These options need to match"
Any links to a PHP 5.4 memcache.dll file would be greatly appreciated.
In the mentioned thread they adressed version for 5.3 and pierre, but there I find only an older version of the dll
I found this link and it worked for me:
php_memcache-3.0.8-5.4-ts-vc9-x86.zip
Or you can browse a list of the latest releases here and find an applicable version:
http://windows.php.net/downloads/pecl/releases/memcache/
I found out this:
http://windows.php.net/downloads/pecl/snaps/memcache/3.0.6/
Try the following if the above fails:
https://www.dropbox.com/sh/sjkuotlz2sl1kpc/v7-QZeFxHR
The link is dead try
http://windows.php.net/downloads/pecl/releases/memcache/
You'll find the latest memcache dll release in there. What you need to know before downloading:
-The OS version (32 or 64 bit)
-The PHP Compiler version
-Thread Safe support
The PHP Compiler version and thread safe support can be easily checked using the phpinfo() function
Thanks Kevin Horst, tested and working on my Win7 box !
The solution : just download the statically compiled version hosted on Amazon AWS, and extract.
Here is some output from php -i :
phpinfo()
PHP Version => 5.4.0
System => Windows NT xxxx 6.1 build 7601 (Windows 7 Ultimate Edition Service Pack 1) i586
Build Date => Mar 7 2012 14:17:27
Compiler => MSVC9 (Visual C++ 2008)
Architecture => x86
Configure Command => cscript /nologo configure.js "--enable-cli" "--enable-memcache=shared"
Server API => Command Line Interface
Virtual Directory Support => enabled
Configuration File (php.ini) Path => C:\Windows
Loaded Configuration File => C:\Users\xxxx\Downloads\UniServer\usr\local\php\php.ini
Scan this dir for additional .ini files => (none)
Additional .ini files parsed => (none)
PHP API => 20100412
PHP Extension => 20100525
Zend Extension => 220100525
Zend Extension Build => API220100525,TS,VC9
PHP Extension Build => API20100525,TS,VC9
memcache
memcache support => enabled
Active persistent connections => 0
Version => 2.2.5
Revision => $Revision: 319585 $
Any pecl modules that have officially been compiled for windows you find under http://windows.php.net/downloads/pecl/releases/
You need to know what php version you are running ie: 5.3,5.4,5.5 and so on
You need to know if your php version is 32 or 64 ie x86, x64
You need to know if the php version was compiled as thread safe or not ie:ts,nts
All the information you can get from a file with the following content
<?php phpinfo()
and view it from the webserver
or from the command line sending the output to a file with:
php -i > phpinfo.txt
NOTE: from the command line you get the data for php-cli witch most likely was compiled with the same configuration
And note that there is Memcache and Memcached but from the php website only memcache is available
There don't seem to be any concise tutorials/walk throughs for installing ImageMagick on WAMP for use with PHP.
I've tried dozens of combinations of their binary releases with different php extension dll files. I can get imagemagick working fine from the command line, and I can get it to show as ticked in the WAMP extensions, but can't actually use it.
Has anyone come across a good guide for installing this ball ache piece of software?
I've followed http://www.knowledge-transfers.com/it/installing-imagemagick-on-windows-setup-imagick-on-php with no luck...
Update: this is what happens when I follow the steps in PHP farmer's answer on windows7. My php.ini is setup as follows:
extension_dir = "c:/wamp/bin/php/php5.3.0/ext/"
extension=php_imagick.dll
I reboot and get these two errors in this order
and here is the dll file where it should be:
I know this is old post but I spend my all day to make it work, so here are the steps that helped me:
Download ImageMagick Binary Release - http://www.imagemagick.org/script/download.php
Install in C:\imagemagick, on last step check "Add application directory to your system path"
Download Imagick DLL: PHP5.6.x version from http://www.peewit.fr/imagick/ (I have 5.6+ version installed on my localhost
Copy php_imagick.dll to C:\wamp\bin\php\ext
Download PHP 5.6 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
I have improved fsasvari answer to cater general scenarios and versions. All credits to him.
Install Imagick in WAMP
Open your phpinfo() page
Check the below
PHP version (mine : 5.5.12)
Compiler (mine : MSVC11 (Visual C++ 2012) )
Architecture : (mine : x64)
Thread Safety : enabled
Loaded Configuration File (mine : C:\wamp\bin\apache\apache2.4.9\bin\php.ini)
extension_dir : (mine : c:/wamp/bin/php/php5.5.12/ext/)
Apache Bin (Not in phpinfo() page) : C:\wamp\bin\apache\apache2.4.9\bin\
Get the latest release match to your architecture from here (for me it was ImageMagick-x86_64-pc-windows.exe).
Copy all files from C:\imagemagick\modules\coders and C:\imagemagick\modules\filters to C:\imagemagick to load ImageMagick supported formats
Install in C:\imagemagick, on last step check "Add application directory to your system path"
Download the PECL matching to your architecture
http://pecl.php.net/package/imagick/3.1.2/windows
(for me : 5.5 Thread Safe (TS) x64)
Extract it and copy all the CORE_RL_* files to apache bin folder (mine : C:\wamp\bin\apache\apache2.4.9\bin)
Copy php_imagick.* files to extension dir (mine : c:/wamp/bin/php/php5.5.12/ext/)
Edit php.ini file (mine : C:\wamp\bin\apache\apache2.4.9\bin\php.ini)
add extension=php_imagick.dll line in extensions section
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 (Specially if you have previously installed imagemagick in different folder/version)
For WAMPSERVER 3.1.9 64bit, PHP Version: 7.3.5
I had a lot of trouble with this as well and some things I did wrong was that I doubted ImageMagick would load on my new php version. But you have to believe it will work and don't try with older php versions :)
So this was my approach, remember to follow it with your own settings and versions/folders.
Before you start, make sure you running the php version you want to run. If you installed Wampserver 3, you may click the wamp icon and go to php version and activate the one you want to run.
1
Get latest ImageMagick version for your system here: http://ftp.icm.edu.pl/packages/ImageMagick/binaries/
(I got the ImageMagick-x86_64-pc-windows.exe in the bottom)
2
Install ImageMagick in C:/imagemagick (I put it in lower cases),
You will be asked for some stuff during install, just make sure the path thingy is ticked.
You should also tick the convert thingy if it allows you.
Then after install you can run CMD and type convert -version to see if imagick is installed.
3
Run <?php phpinfo(); ?> And find out these settings:
PHP Version: 7.3.5
System: Windows
Compiler: MSVC15 (Visual C++ 2017) ([VC15])
Architecture: x64 (or maybe you have x86)
Thread Safety: enabled ([TS] else [NTS])
You probably have other settings, but you need to remember yours to download the proper php_imagick.dll
4
Get the php_imagick.dll you want for your php version from here: http://pecl.php.net/package/imagick
I got mine from here: http://pecl.php.net/package/imagick/3.4.4/windows for php 7.3
Remember your info from the phpinfo(), it has to match, else it won't work.
5
After you unzip it, copy the php_imagick.dll and paste it in C:/wamp64/bin/php/php7.3.5/ext/
Then copy all the other .dll files from that folder into C:/wamp64/bin/apache/apache2.4.39/bin/
Yes it's dirty but you will get it working like this.
6
Add extension=php_imagick.dll in C:/wamp64/bin/php/php7.3.5/phpForApache.ini
I added it after the other extensions in the file.
7
Restart all Wamp services.
If you been messing around earlier with installs, you might have to restart the computer due to some weird cache stuff.
8
Check phpinfo() again if imagick shows up and try something like $im = new Imagick();
9
Click the Wamp icon -> php -> extensions, php_imagick should be listed.
Good luck! :)
PHP 5.4 php_imagick.dll is here: http://www.peewit.fr/imagick/ .
I read somewhere that 64bit php doesnt work with php_imagick. That might be the case when you get this error in apache_error.log
PHP Warning: PHP Startup: Unable to load dynamic library 'c:/wamp/bin/php/php5.4.3/ext/php_imagick.dll' -
%1 is not a valid Win32 application.\r\n in Unknown on line 0
As mentioned above, it was also necessary to add this into httpd.conf (also, i read you cant have spaces/dashes/dots):
SetEnv MAGICK_HOME C:/imagemagick"
If you dont, you might get this error:
"PHP Warning: PHP Startup: Unable to load dynamic library 'c:/wamp/bin/php/php5.4.3/ext/php_imagick.dll' -
The specified procedure could not be found. in Unknown on line 0"
In the end, this article might partially help: http://www.elxsy.com/2009/07/installing-imagemagick-on-windows-and-using-with-php-imagick/
This was a headache for me as well, but unfortunately I installed this quite awhile ago. The instructions from that link you posted seem accurate. Have you ran phpinfo(); to see if it is installed in the Apache Environment? It should be listed as MAGICK_HOME.
Make sure "SetEnv MAGICK_HOME C:/imagemagick" is set at the end of your httpd.conf file. Assuming imagemagick is installed in that directory.
Be sure that you have the extension "php_imagick.dll" in your php.ini file as well.
It should work just fine if you have all those set.
On another note, here is a nice little library someone built to make imagick easier to use. https://github.com/francodacosta/phmagick
I hope that helps! Good luck!
I've never used WAMP but I have found that sometimes installing PHP extensions on Windows I need to ensure that any dll's that the extension relies on is in the Windows system PATH. If there is more than the one dll packaged with the imagemagick extension, try adding the directory that the dll's reside in to the Windows system PATH then REBOOT (to ensure that the web server gets a copy of the NEW environment).
I know this is an old question but i guess this will help someone someday out there....
If you are on WAMPP and have PHP 5.4.x installed , go here http://www.peewit.fr/imagick/
and download appropriate files as instructed. It will work.
Please see this answer already on StackOverflow:
Installing ImageMagick extension with php/windows
I answered this question some time ago. This solves the DLL mismatch error.