Unable to install MongoDB PHP driver on XAMPP Windows - php

I am using Windows OS (64-bit) and running XAMPP(PHP 5.4.7). I tried installing the PHP MongoDB Driver but it is not reflecting on the phpinfo() page.
I followed the same steps as listed:
I downloaded php_mongo-1.3.2RC1.zip (latest one) from https://github.com/mongodb/mongo-php-driver/downloads
I extracted the folder and copied the php_mongo-1.3.1-5.4-vc9.dll file and pasted in C://XAMPP/php/ext/.
My PHP extension build says API20100525,TS,VC9
I opened php.ini file and i inserted ;extension=php_mongo-1.3.1-5.4-vc9.dll at the last line.
I then looked at the phpinfo() page as well as I tried the
echo extension_loaded("mongo") ? "loaded\n" : "not loaded\n";
It says it is not loaded.

Try removing the ; from the beginning of ;extension=php_mongo-1.3.1-5.4-vc9.dll in your php.ini

After doing all the steps as mentioned in the question, 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.

Related

Cannot load imagick library

I have installed the imagick from here (ImageMagick-7.0.3-1-Q16-x64-dll) and the dll (TS 32 bit) from here. And also copiend the CORE_RL_* to the C:\xampp\apache\bin BUT still i get the following error when i run the laravel server.
ERROR: Warning: PHP Startup: Unable to load dynamic library 'C:\xampp\php\ext\php_imagick.dll' - The specified module could not be found.
in Unknown on line 0
Also, I placed dll file in C:\xampp\php\ext\php_imagick.dll.
Also, the imagick is shown in the phpinfo().
And when i use it using laravel i get the following error.
getting Imagick to work on Windows has always been a bit hit and miss as pointed out here is a good guide
http://stackoverflow.com/a/36378764/1090867
But it misses an important point
You do not need to put the binary into the PHP folder!
So here are the steps I follow myself every time I need to do this. This should work for apache, Nginx, or IIS.
Step 1
find out your php version and setting
You need to version, Architecture, Compiler and Thread Safety
if Thread Safety is disabled this is NTS is enabled it will TS
Step 2
Get and install a copy of ImageMagick and make sure it matches your Architecture, this also needs to be dll.exe rather than the static version.
Regarding Q8 and Q16 I'll leave that to you but both versions will work
Link
I recommend changing the install directory name to something generic like
C:\Imagemagick since I've had some problems in the past with the default directory name with PHP and windows.
Just install but make sure you tick add application path and I normally tick the legacy utils as well.
Once it's installed go to your environment variables and make sure it is actually in the path. There is no need to copy anything to your PHP folder
Just to make sure everything is working open the command line and type convert --version you should get a response
Step 3
This unfortunately is the hard part and can be a bit of trial and error. I've found the following provides the best php_imagick.dll that seems to work 9 times out of 10
http://www.peewit.fr/imagick/
Just pick the version that matches your install.
If this doesn't work then go to php.net and try each version until one works... (start at the latest)
http://windows.php.net/downloads/pecl/releases/imagick/
Once you have a php_imagick.dll put it into your php/ext/ folder
thne locate your php.ini file go to the bottom (or whereever your extensions are) and add extension=php_imagick.dll
Step 4
Restart PHP (or your computer) and it should be working if not try a different php_imagick.dll and repeat.
If the above doesn't work
Then try a slightly older version of Imagick I normally use version 6.8.6-8 Q16.
Please note I've only ever really done this on Windows 7 and Windows Server 2008, 2008 R2, 2012, and 2012 R2 all x64 with x86 PHP
If this still doesn't work then you probably need to copy over the CORE_RL files into your Imagick directory this normally causes more issues but if you are running out ideas then give it a go
I just ran into this issue. Only I'm using PHP on the command line (PHP CLI). The problem is the dependencies that the main php_imagick.dll file has. PHP will attempt to load the extension but since Windows can't find the CORE_RL_ DLLs, the extension will fail to load and the error/warning message about being unable to load the DLL will appear. It helps to know how Windows loads DLLs:
https://msdn.microsoft.com/en-us/library/windows/desktop/ms682586(v=vs.85).aspx
It's pretty convoluted but you can see that the reason the Apache /bin directory trick works with Apache is that httpd.exe is located in that directory. However, when using PHP CLI, the DLLs need to be located in the same directory as php.exe.
If you don't want duplicate DLLs floating around, add the directory containing php.exe to the system PATH and plop all the CORE_RL_ DLLs there. The PATH is the last thing searched, but it'll work fine. If you don't want spurious entries in your system PATH, then set the extra PATH information only during startup of Apache.
This is because the dependencies are missing. Those who are facing the same error Unable to load dynamic library 'php_imagick', Please follow the below steps
Go to https://pecl.php.net/package/imagick choose a stable version and click on the DLL link.
From the DLL list click the link which, is suitable for your PHP version.
After downloading the php_imagick zip file, extract it and copy the php_imagick.dll file to C:\xampp\php\ext folder.
Extract all DLL files from the php_imagick zip file (except php_imagick.dll) to the PHP root directory (where you have php.exe). Ex: For XAMPP user C:\xampp\php folder.
Add extension=php_imagick to your php.ini file.
Restart the Apache server.
Things to keep in mind before choosing from the DLL list.
Check the PHP version.
Check the architecture (x64/x86).
Check Thread Safety (enabled/disabled).
N.B: Above solution is for XAMPP users only.
I changed php_imagick in php.ini file to php_imagick.dll and it happened
I had the same problem. It turns out I have to install complete ImageMagic application, not just ImageMagic php extension.
And I also set MAGICK_HOME environment variable.

Change php configuration file in PhpStorm

I have installed WAMP server on my computer and tried to configure the PHP Interpreter in PhpStorm but it keeps pointing to the wrong php.ini file.
How can I change it to the correct one?
Let me know if you need more information.
Edit
The place where php.ini that WAMP tells me to edit is C:\wamp64\bin\apache\apache2.4.17\bin\php.ini
The one that PhpStorm is pointing to has a big DO NOT EDIT label on it.
If this is for a website you are attempting to write then you need to point your Configuration File at
C:\wamp\bin\apache\apache{version}\bin\php.ini
NOTE
There are PHP ADDONS provided for PHP7 that will install into the existing WAMPServer 3.0.x and the latest is PHP7.0.8 found here or from SourceForge
I had the same problem, and I backed up the original php.ini content inside bin\php\php7.0xxx folder, and I replaced the content with the php.ini inside C:\wamp\bin\apache\apache{version}\bin\php.ini, and then restarted phpstorm and it worked.

PHP scws extention is not loaded by MAMP

I have a problem about loading extension of PHP in MAMP:
I have compiled and installed scws.so (PHP extension for Chinese words segmentation) into folder '/Applications/MAMP/bin/php/php5.3.6/lib/php/extensions' together with other extensions like pgsql.so, etc.
Also, I've updated the php.ini under '/Applications/MAMP/bin/php/php5.3.6' by adding 'extension=scws.so'.
If I issue command '/Applications/MAMP/bin/php/php5.3.6/bin/php -m' in console, I can see 'scws' is in the output list. But it has not been loaded after starting MAMP, also, I can not see 'scws' is listed with function phpinfo().
Could anyone help me about how to force the load of the new PHP extension? Why it is listed by 'php -m', but actually not loaded by MAMP?
Thanks in advance!
The configuration for PHP called from web server is different from command line php. In phpinfo() check the path to the php.ini file that is being used and make sure that it is the same file that you edited to add the extensions.

Load php_oauth.dll into local server

I'm facing problem to load the php_oauth.dll extension for my xampp. I downloaded the php_oauth.dll and added extension=php_oauth.dll in php.ini , but when i restart my apache, it cannot start the server anymore.
I'm using window 7 ,64bits.
Initially, I download the file from
http://downloads.php.net/pierre/
but i found that it was 32bits file , so I'm searching fo 64bit and found out
http://www.mediafire.com/php-win64-extensions
unfortunately,I still cannot load the oauth. Any solution to solve it? I look through many article, but it seems like dont have it, anyone can provide ,so that, others that using win 64bit can follow
Thank you!
This looks to be like a path problem. Make sure the extension is store in the correct extension directory.
The settings of this can be found inside php.ini as something like
extension_dir = C:\php\extensions
By default this is ext folder inside PHP installation.
Or, follow the instruction from PHP manual while installing extensions, if you are not sure what you are doing.

MySQL not working with php; and crashing apache when enabled

I just recently setup a fresh install of PHP, Mysql and Apache on my Windows 2003 server. Php is working fine and my Navicat MySQL browser can connect to my tables. However no matter what I do. MySQL doesn't show in phpInfo() even though I have the extensions in my ext folder. I installed PHP via the windows binary installer. Any idea what I'm missing? I'm pretty new to PHP is this is the first time I've tried to setup my own server I'm sure I'm missing something simple. Thanks.
--- EDIT ---
So as suggested by Alan Geleynse I added the extension to my php.ini, now Apache crashes every time I try to enable php_mysql.dll any ideas on this one? I may just restart my php from scratch if this is any more trouble.
You probably need to enable the extension in your php.ini
Search through php.ini for extension and you should see a list, some of which will be commented out. If you remove the comment for MySQL, it should load the extension.
If you do not see it, you should be able to add this line to your php.ini. Make sure that the dll listed is the one you want and is located in your extension directory.
extension=mysql.dll
Seems the issue was not only a missing php_mysql.dll but I was also missing libmysql.dll The installer still borked the install of the extension files though. Oh well it happens thanks to everyone for the help.
Probably apache crashes because of missing dll. There is probably a directory 'ext' in your php installation dir. Check whether there is a 'php_mysql.dll' file in it.
Also, check for directive 'extension_dir' in your php.ini, it must point to the location of extensions directory. For example, I have php installed in 'C:\php' and 'C:\php\ext' folder in it. My php.ini contains line:
extension_dir = "C:/php/ext"
I just fixed this problem on my computer by copying libMysql.dll from the MySql server directory to c:/windows/system32/, just a few minutes ago.

Categories