Iv recently been trying to upload my php application from xampp which i have installed on my home machine to a server. Now the code works perfectly on xampp at home and the mongodb driver works as expected, however after migrating it to the LAMP server, the f3 framework throws this error :
Fatal error: Class 'MongoDB' not found in /nfs/fs0/home/dhu/www/fatfree/lib/db/mongo.php on line 107
Internal Server Error
Fatal error: Class 'MongoDB' not found
In reference i looked up the line it is complaining about and its this one :
$this->db=new \MongoDB(new $class($dsn,$options?:array()),$dbname);
And after looking up solutions on stack and other websites they said to check the version of mongo etc installed so i look it up on the php side to see what was enabled and it returns :
PHP Version 5.6.24-0+deb8u1
mongodb
mongodb support enabled
mongodb version 1.1.8
mongodb stability stable
libmongoc version 1.3.5
libbson version 1.3.5
So since mongo is both installed and enabled on the php server im unsure what exactly the issue is with line 107 in the fatfree framework, does anyone have any idea's? Any help would be appreciated.
So after no real solutions been found here im gonna update to see if i can get more help.
Note the server settings can be found here:
http://lamp0.cs.stir.ac.uk/
and the error here:
http://lamp0.cs.stir.ac.uk/~dhu/
The line its referring too is:
$this->db=new \MongoDB(new $class($dsn,$options?:array()),$dbname);
Within the MONGODB library, mongo.php. After looking at various ways to set the DB up and trying to rewrite the setup code nothing seems to work....
$manager = new MongoDB\Driver\Manager("mongodb://mydetails:27017");
If i removed the fatfree framework this line does not throw an error during setup which is surprising as i expected it to be unable to find MongoDB\Driver however it had no problem, its main problem seems simply to be that one line in the fatfree framework and im unsure why...
You need to add MongoDB as dependency in the composer.json
file of your Fat-Free Framework.
Just add MongoDB to the require dependency list, if it is not there create one like below.
"require": {
"mongodb/mongodb": "^1.0"
},
Then run composer install
again. Now you can reference MongoDB classes inside your code.
First install autoload class for mongodb in your project.Then try with below code $client = new MongoDB\Client("mongodb://localhost:27017");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With