Reputation: 51
I have Fedora 13, and I have installed httpd, php, and mysql using yum.
Then downloaded mongodb.
Added the extension=mongo.so
to my php.ini
Restarted httpd
Wrote the following code:
<?php
$connect = new mongo();
$db = $connect->data;
$collection = $db->foobar;
$info = array("name" => "wael", "age" => 24);
$collection = insert($info);
$obj = $collection->findOne();
var_dump($obj);
?>
Tried running it.
But it shows nothing on my localhost.
What can I do?
Upvotes: 1
Views: 564
Reputation: 96159
Let php report errors to you.
see error_reporting, display_startup_errors, display_errors, error_log.
You might also want to check whether the extension has been loaded at all.
error_reporting(E_ALL); ini_set('display_errors', 1);
if ( !class_exists('mongo') ) {
echo 'there is no class "mongo". mongodb extension loaded: ';
var_dump(extension_loaded('mongo'));
echo 'php.ini used by this instance of php: ', get_cfg_var('cfg_file_path');
die;
}
$connect = new mongo();
$db = $connect->data;
$collection = $db->foobar;
$info = array("name" => "wael", "age" => 24);
$collection = insert($info);
$obj = $collection->findOne();
var_dump($obj);
Upvotes: 1