MongoClient not found in PHP
I downloaded php_mongo-1.3.2RC1.zip
from https://github.com/mongodb/mongo-php-driver/downloads
Then I extracted all of them in my directory C:\xampp\php\ext
. To use mongodb, although the php file is in the "C: \ xampp \ htdocs \ index.php" directory, I added extension=php_mongo-1.3.2RC1-5.2-vc9.dll
this line to C:\xampp\php\php.ini
.
But I have this error Fatal error: Class 'MongoClient' not found
. What can I do to make it work?
I am using Xampp
in windows 8 64 bit
, running on php 5.2
.
I've tried writing php
to cmd
and it returns the following lines:
Warning: PHP Startup: mongo: Unable to initialize module
Module compiled with module API=20060613
PHP compiled with module API=20100525
These options need to match
in Unknown on line 0
I tried phpinfo()
as @ j0k asked and it returned:
Configuration File (php.ini) Path C:\Windows
Loaded Configuration File C:\xampp\php\php.ini
source to share
I think you are using php 5.4
(info from my web server):
$ php -v; phpize -v
PHP 5.4.11 (cli) (built: Feb 10 2013 03:38:26)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
Configuring for:
PHP Api Version: 20100412
Zend Module Api No: 20100525
Zend Extension Api No: 220100525
The API module version is identical.
…
Module compiled with module API=20060613
…
This php 5.2
(from source):
$ grep '#define ZEND_MODULE_API_NO' php-src-php-5.2.17/Zend/zend_modules.h| sed 's/#define ZEND_MODULE_API_NO//'
20060613
Check php ( php -v; phpize -v
) version and configure php-mongo-driver. You can see the versions at phpinfo();
(Recommended: PHP API, PHP Extension, Zend Extension, Thread Safety)
source to share