tags:

views:

26

answers:

1

hello,

i have fedora 13, and i have installed httpd,php,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?

+1  A: 

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);
VolkerK
got it to work, i had to uninstall everything, re-add the repo, update yum which is the thing that fixed the problem.and reinstalled. and it works fine now :)
saadluul