I install mongodb on xampp . It show successfully installed in phpinfo. But when I call it says me this error
Fatal error: Uncaught Error: Class 'MongoClient' not found in ...
my code :
echo extension_loaded('mongodb');
$mongo = new MongoClient("mongodb://localhost:27017");
I install it manually. First line echo true.
MongoClient seems to be part of mongo extension. You are checking for mongodb extension which wouldn't define it.
Related
I've been trying to install the MongoDB extension for PHP for a while now with no luck. I followed the standard steps:
Installed the driver via Pecl
Added it to my PHP.ini file (both CLI and Apache2)
Restarted Apache2
Yet, my code believes it does not exist:
$conn = new Mongo($_ENV["DB"]);
$db = $conn->test;
PHP Fatal error: Uncaught Error: Class 'Mongo' not found in /var/www/ag/API/index.php:22\nStack trace:\n#0 {main}\n thrown in /var/www/ag/API/index.php on line 22
Any ideas what I am doing wrong? I am using PHP 7.3 and Apache 2.4.38 on Debian
I saw a question like this for Windows, but it was of no help to me.
I'm getting this error when trying to install orocrm :
Fatal error: Cannot use 'True' as class name as it is reserved in
C:\xampp\htdocs\crm-application\vendor\oro\platform\src\Oro\Component\ConfigExpression\Condition\True.php
on line 10
Any idea what might be the cause of this?
You are using PHP7. For now OroCrm doesn't support PHP7.
You need to downgrade PHP to 5.6 version.
I try to install mongo in my PC (windows 7). I have wamp 2.2.11 with php 5.3.0
I follow the instruction from.
http://php.net/manual/en/mongo.installation.php#mongo.installation.windows
But it is not working with the code
$m = new MongoClient();
echo "Connection to database successfully";
Giving Fatal error: Class 'MongoClient' not found.
I have search here
MongoClient not found in WAMP
MongoDB not working with PHP on WAMP
WAMPServer Fatal error: Class 'Mongo' not found
And some other but nothing happen. I have add php_mongo.dll file at
wamp\bin\php\php5.3.0\ext
And change php.ini at wamp\bin\apache\Apache2.2.11\bin
But it is not working.
Please help.
I get this error:
Fatal error: Class 'SoapClient' not found in /hoe/roits/wp.com/wp-content/plugins/Aggmges/classitle.php on line 51
Worpress doesnt seem to have the latest php installed as I understand. What can I do to install the newest php or make it so that the SoapClient will work in worpress?
http://php.net/manual/en/soap.installation.php
Install the php soap module if you don't have it, and make sure enabled in php.ini
Fatal error:
Class 'Mongo' not found in C:\Apache
Software
Foundation\Apache2.2\htdocs\sample\testdb.php
Can anyone help me out with this issue? Why is that saying so?
The following is the code that I have used. I have created a database named phptest in MongoDB and inserted a document. Then I tried connecting to MongoDB via PHP but it threw this error.
Can anyone help me get rid of this? I have included the php-mongo dll and saved in php.ini file also.
<?php
echo "succeeded!";
$connection = new Mongo();
$db = $connection->test;
$collection = $db->phptest;
?>
Make sure you have the correct php driver installed.
For example if "Thread Safety" is enabled in your php.ini, then make sure you have the "Thread-Safe Mongo Extension" installed and NOT the "Non-Thread-Safe" version.
You're probably using an older version of the Mongo DB driver. The class Mongo has been replaced with MongoClient, since v 1.3.0 of the driver. See this stackoverflow thread :
mongo DB - php driver version
http://www.php.net/manual/en/class.mongo.php