MongoDB - Wampserver : Class 'Mongo' not found - php

I am trying to install MongoDb on windows platform. I'm using PHP with WampServer.
But while executing the PHP program it gives the following error:
Fatal error: Class 'Mongo' not found in C:\wamp\www\test\index.php on line 19
So is there any way to check whether MongoDB is running with PHP or not ?

Please check php loaded extensions using phpinfo() function whether mongoDB extension is loaded or not.
Do check these as well.
Fatal Error - 'Mongo' class not found
Fatal error: Class 'Mongo' not found in xampp
Add the following line to your php.ini file:
extension=php_mongo.dll
Docs Link: http://php.net/manual/en/mongo.installation.php

Check this possible solution
Copy c:\wamp\bin\php\php-5.3.x\ext\
Edit c:\wamp\bin\apache\Apache2.2.xx\bin\php.ini and add the line where the extensions are loaded.
Why run WAMP on 32bit Windows 7 64bit?
The Mongo PHP driver does not have a 64bit binary win32, if you are running the 64bit version of WAMP, PHP will refuse to load the 32-bit version of php_mongo.dll.

Related

MongoDB php extension install on ubuntu 12.04: fatal error: Zend/zend_string.h: No such file or directory

I've been trying to install a php 5.6 driver for mongodb on Ubuntu 12.04. (Will be using this on a Zend Framework 1.11 system, yes this is old, I am fully aware).
I've tried a few things, nothing works.
It seems I should get it to work using this installation:
http://php.net/manual/en/mongodb.installation.manual.php
But for some reason at the make all -j 5 step I get the following error:
In file included from /var/mongotest/mongo-php-driver/src/bson.c:29:0:
./phongo_compat.h:21:30: fatal error: Zend/zend_string.h: No such file or directory
compilation terminated.
In file included from /var/mongotest/mongo-php-driver/src/bson-encode.c:29:0:
./phongo_compat.h:21:30: fatal error: Zend/zend_string.h: No such file or directory
Just install php5.6-dev, it includes all the header files.

Fatal error: Uncaught Error: Call to undefined method MongoDB\Driver\Manager

Here are some necessary version related details of the packages I have installed on a dream-compute (godaddy) server machine with Ubuntu 16.04 with root access
Apache Server version: Apache/2.4.18 (Ubuntu)
php version 7
mongo db version v3.2.10 and
$ pecl search mongo
.Matched packages, channel pecl.php.net:
=======================================
Package Stable/(Latest) Local
mongo 1.6.14 (stable) MongoDB database driver
mongodb 1.1.9 (stable) 1.1.9 MongoDB driver for PHP
I have set up a website that was previously running on a different server with PHP 5.6 and an old mongo-php driver.
Previously I was using MongoClient class in the connection string but after some searching I changed it to MongoDB\Driver\Manager in my connection class of the php website.
I have also included extension=mongodb.so in the /etc/php/7.0/apache2/php.ini file
The rest of the website is working fine, only when i browse to a page which has a mongodb call at the back-end gives me the following error (from php error log file):
PHP Warning: Module 'mongodb' already loaded in Unknown on line 0
PHP Fatal error: Uncaught Error: Call to undefined method MongoDB\Driver\Manager::selectDB() in /var/www/html/iot/includes/class.abstract-data-collection.php:118
I am not an expert in linux and hence I am stuck here. Anyone have any idea what should I try to actually get to the problem, should I need to change the php code or is there anything I am missing in the configuration?
TA

Loading Cassandra Extension in PHP running on HHVM on Apache

I have been trying to load the datastax cassandra php-driver on ubuntu (apache web server). I am also running php on hhvm. Now the problem is that I have installed the driver and I have the cassandra extension file located in /usr/lib/php5/20131226/cassandra.so. I have also edited /etc/hhvm/php.ini file to contain:
hhvm.dynamic_extension_path = /usr/lib/php5/20131226
hhvm.dynamic_extensions[cassandra] = cassandra.so
And I have edited /etc/hhvm/server.ini to contain:
hhvm.enable_zend_compat = true.
Now when I start hhvm, I get the following error:
Uncaught exception: Could not open extension /usr/lib/php5/20131226/cassandra.so: /usr/lib/php5/20131226/cassandra.so: undefined symbol: zend_new_interned_string\n.
Could I please get help resolving this issue?

Fatal error: Class 'MongoClient' not found

I want to connect to MongoDB from PHP but I keep getting the fatal error in the title. My PHP version is 5.5.14, architecture x86, thread safety enabled, VC11.
So I downloaded 5.5 Thread Safe (TS) x86 from PECL, extracted php_mongo.dll to the \ext\ folder of my php installation, added extension=php_mongo.dll to the php.ini file, and restarted Apache.
I keep getting the same fatal error when I use either Mongo() and MongoClient().
Also, I can access mongo from CMD, starting it with mongod and then opening another cmd window to handle the database using mongo. I installed PHP and Apache separately (No XAMPP or WAMP) on Windows 8.1 x64.
Installation folders:
Apache: C:\Apache24
PHP: C:\php
MongoDB: C:\Program Files\MongoDB
In the lastest version, you can use new MongoDB\Driver\Manager() to create the obj instead of the MongoClient().

sqlsrv_connect() not found

I'm working on a project that uses the SQL Server Driver for PHP, and want to upgrade the driver to the new version (2.0), because I need some of the functions that have been implemented there.
I replaced the old .dll in the php/ext directory and restarted the web server. But now I receive the following error:
Fatal error: Call to undefined function sqlsrv_connect() in E:\ProjekteExtern\hades\_apl\classes\sql\sqlsrv.class.php on line 34
The phpinfo() output shows sqlsrv, just like with the previous version.
Does anybody know why I'm getting this error or have any ideas to solve this problem?
For those still having errors with PHP and Microsoft SQL Server using PHP SQL, check the web server's log (Apache, IIS, etc). I have just found out that WampServer x64 is not compatible with PHP SQL Server Driver, so I'm installing the 32-bit version back again.
UPDATE:
for WampServer 2.2, PHP is compiled thread-safe and with VC++ 9.0, so it works using either
php_pdo_sqlsrv_53_ts_vc9.dll
or
php_sqlsrv_53_ts_vc9.dll

Categories