title: MongoDB / PHP on WAMP -- phpinfo vs php -i
body: <p>I'm trying to set up MongoDB with PHP and WAMP.  I had WAMP 64 bit installed previously, but I see that the PHP drivers don't work with that, so I uninstalled it and installed 32 bit.  I downloaded the PHP drivers from here: <a href="http://downloads.mongodb.org/mongo-latest-php5.3vc9ts.zip" rel="nofollow">http://downloads.mongodb.org/mongo-latest-php5.3vc9ts.zip</a>, put the dll in ext and added the extension in my php.ini.</p>
  
  <p>I don't get any errors when I start WAMP, but my phpinfo() doesn't show Mongo listed, and when I try to something simple like</p>
  
  <pre><code>$m = new Mongo(); // connect
  </code></pre>
  
  <p>I get this error:</p>
  
  <pre><code>( ! ) Fatal error: Class 'Mongo' not found in C:\development\uswom\btf\test\mongo.php on line 3
  </code></pre>
  
  <p>My phpinfo shows this information:</p>
  
  <pre><code>Build Date  Aug 23 2011 11:47:20
  Compiler    MSVC9 (Visual C++ 2008)
  Architecture    x86 
  PHP API     20090626
  PHP Extension   20090626
  Zend Extension  220090626
  Zend Extension Build    API220090626,TS,VC9
  PHP Extension Build     API20090626,TS,VC9 
  </code></pre>
  
  <p>When I do php -i from the command line, it shows me that mongo is loaded:</p>
  
  <pre><code>mongo
  
  MongoDB Support =&gt; enabled
  Version =&gt; 1.2.7-
  
  Directive =&gt; Local Value =&gt; Master Value
  mongo.allow_empty_keys =&gt; 0 =&gt; 0
  mongo.allow_persistent =&gt; 1 =&gt; 1
  mongo.auto_reconnect =&gt; 1 =&gt; 1
  mongo.chunk_size =&gt; 262144 =&gt; 262144
  mongo.cmd =&gt; $ =&gt; $
  mongo.default_host =&gt; localhost =&gt; localhost
  mongo.default_port =&gt; 27017 =&gt; 27017
  mongo.long_as_object =&gt; 0 =&gt; 0
  mongo.native_long =&gt; 0 =&gt; 0
  mongo.no_id =&gt; 0 =&gt; 0
  mongo.utf8 =&gt; 1 =&gt; 1
  </code></pre>
  
  <p>WAMP is the only php that I have installed, and to make sure that my CLI PHP was matching up with my WAMP phpinfo, I checked the details and they match up:</p>
  
  <pre><code>Build Date =&gt; Aug 23 2011 11:47:20
  Compiler =&gt; MSVC9 (Visual C++ 2008)
  Architecture =&gt; x86
  PHP API =&gt; 20090626
  PHP Extension =&gt; 20090626
  Zend Extension =&gt; 220090626
  Zend Extension Build =&gt; API220090626,TS,VC9
  PHP Extension Build =&gt; API20090626,TS,VC9
  </code></pre>
  
  <p>Finally, "where php" shows me that command line is running the PHP from my WAMP install:
      C:\Program Files (x86)\wamp\bin\php\php5.3.8\php.exe</p>
  
  <p>1) Any idea why CLI "php -i" would show that Mongo is loaded, but phpinfo() doesn't?</p>
  
  <p>2) I'm guessing that my "new Mongo()" call is failing for the same reason that phpinfo() isn't showing me that Mongo is loaded, but I'm not sure where to start debugging the Mongo loading issue.  I checked wamp/logs/apache_error.log and it shows no errors at startup. </p>
  
  <p>Thanks in advance.</p>