Fatal Error: Class 'Mongo' Not Found...

Working on this Mongo script in PHP - the script is meant to be run from the command line as there's about seven different parameters I need to pass into it.  The script itself takes a defined CSV file and build a multi-collection structure for storing in  as a Mongo table. I get the basic stuff working - the data is porting over and storing very nicely into Mongo -- and I go to work on the command-line options (argc/argv stuff) for the script.  First thing I do, is specify the php executable to the shell:

[ccne lang="php" line_numbers="on" tab_size="4" width="100%"]

#! /usr/bin/php <?php


And I go on to code the handlers for the command-line arguments on a Friday.  When I come back to work on Monday, I go back to run the script and I get the error:

Fatal Error: Class Mongo not found in {source code} on Line such-and-such... which is a huge WTF to me because we're talking about  nothing changing in the source code over the weekend...

I run mac ports and get a PHP update but I get the same error.

I check that the mongo extensions are loaded with php -i:

MongoDB Support => enabled
Version => 1.0.9
Directive => Local Value => Master Value
mongo.allow_persistent => 1 => 1
mongo.auto_reconnect => 1 => 1
mongo.chunk_size => 262144 => 262144
mongo.cmd => $ => $
mongo.default_host => localhost => localhost
mongo.default_port => 27017 => 27017
mongo.long_as_object => 0 => 0
mongo.native_long => 0 => 0
mongo.utf8 => 1 => 1

I google the error and read that (derp-derp) the mongo extension is probably not loaded in the php-cli.ini file.  Which I search for but don't seem to have on my system.

I do have the Zend CE install still hanging around and since I'm using PHPStorm now (it rocks!), I nuke the Zend installation.  Nope - still getting the error.  I run it past a couple of the Mongo/PHP wonks here at work and get lots of hmmm....but it's a head-scratcher for all of us.

Then, right before I fall asleep last night, I get the answer...it's in the shell directive in the script...the /usr/bin/php is not the same as the mac-ports version of php.  I ls -l and file the two php files and I get:

p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica} p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px} span.Apple-tab-span {white-space:pre}

$ ls -l /usr/bin/php

-rwxr-xr-x  1 root  wheel  30168960 Aug 22 19:44 /usr/bin/php

$ file /usr/bin/php

/usr/bin/php: Mach-O universal binary with 3 architectures

/usr/bin/php (for architecture x86_64): Mach-O 64-bit executable x86_64

/usr/bin/php (for architecture i386): Mach-O executable i386

$ ls -l /opt/local/bin/php

-rwxr-xr-x  2 root  admin  6054056 Jan 10 14:49 /opt/local/bin/php

$ file /opt/local/bin/php

/opt/local/bin/php: Mach-O 64-bit executable x86_64

Once I change the directive in the script source to point the shell to the correct executable, the mac-ports version of PHP, my Mongo-Fatal error goes away and life, once again, is good.