I am trying to load the mongo extension, but get:
Fatal error: Class 'Mongo' not found in /Library/WebServer/Documents/mongo_php.php on line 7
when I try to load this file in Safari browser
<?php
//phpinfo();
$dbhost = 'localhost';
$dbname = 'guestbook';
// Connect to guestbook database
$m = new Mongo("mongodb://$dbhost");
$db = $m->$dbname;
// select the collection 'guestbook' in the database 'guestbook'
$collection = $db->guestbook;
// pull a cursor query
$cursor = $collection->find();
foreach($cursor as $document) {
var_dump($document);
}
?>
mongo.so is in php.ini
;extension=/usr/lib/php/extensions/no-debug-non-zts-20090626/mongo.so
extension=mongo.so
(I've tried both)
I've also tried setting
extension_dir ="/usr/lib/php/extensions/no-debug-non-zts-20090626/"
where am I going wrong?
I have mongod up and waiting, also sleepy mongoose
mongod --rest --config /etc/mongodb.conf --pidfilepath /etc/mongodb.pid --logappend&
python /Users/ron/mongo/sleepy.mongoose-master/httpd.py
mongo shell and sleepymongoose and curl work fine
sh-3.2# php-config
Usage: /usr/bin/php-config [OPTION]
Options:
--prefix [/usr]
--includes [-I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib]
--ldflags [ ]
--libs [-lresolv -lz -lexslt -ltidy -lresolv -ledit -lncurses -lpq -lpq -liodbc -lldap -llber -liconv -liconv -lfreetype -lpng -lz -ljpeg -lcrypto -lssl -lcrypto -lcurl -lbz2 -lz -lpcre -lcrypto -lssl -lcrypto -lm -lxml2 -lz -licucore -lm -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -lcurl -lxml2 -lz -licucore -lm -liodbc -lxml2 -lz -licucore -lm -lnetsnmp -lcrypto -lxml2 -lz -licucore -lm -lxml2 -lz -licucore -lm -lxml2 -lz -licucore -lm -lxml2 -lz -licucore -lm -lxml2 -lz -licucore -lm -lxml2 -lz -licucore -lm -lxslt -lxml2 -lz -licucore -lm ]
--extension-dir [/usr/lib/php/extensions/no-debug-non-zts-20090626]
--include-dir [/usr/include/php]
--man-dir [/usr/share/man]
--php-binary [/usr/bin/php]
--php-sapis [cli apache2handler]
--configure-options [--prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --disable-dependency-tracking --sysconfdir=/private/etc --with-apxs2=/usr/sbin/apxs --enable-cli --with-config-file-path=/etc --with-libxml-dir=/usr --with-openssl=/usr --with-kerberos=/usr --with-zlib=/usr --enable-bcmath --with-bz2=/usr --enable-calendar --with-curl=/usr --enable-dba --enable-ndbm=/usr --enable-exif --enable-ftp --with-gd --with-freetype-dir=/usr/local --with-jpeg-dir=/usr/local --with-png-dir=/usr/local --enable-gd-native-ttf --with-icu-dir=/usr --with-iodbc=/usr --with-ldap=/usr --with-ldap-sasl=/usr --with-libedit=/usr --enable-mbstring --enable-mbregex --with-mysql=mysqlnd --with-mysqli=mysqlnd --without-pear --with-pdo-mysql=mysqlnd --with-mysql-sock=/var/mysql/mysql.sock --with-readline=/usr --enable-shmop --with-snmp=/usr --enable-soap --enable-sockets --enable-sqlite-utf8 --enable-suhosin --enable-sysvmsg --enable-sysvsem --enable-sysvshm --with-tidy --enable-wddx --with-xmlrpc --with-iconv-dir=/usr --with-xsl=/usr --enable-zend-multibyte --enable-zip --with-pcre-regex=/usr --with-pgsql=/usr --with-pdo-pgsql=/usr]
--version [5.3.15]
--vernum [50315]
sh-3.2# pwd
/usr/lib/php/extensions/no-debug-non-zts-20090626
sh-3.2# ls -l
total 1616
-rw-r--r-- 1 root wheel 653268 27 Aug 16:37 mongo.so
-r-xr-xr-x 1 root wheel 57312 26 Sep 2012 phpcups.so
-rwxr-xr-x 1 root wheel 395744 26 Sep 2012 xdebug.so
sh-3.2#
Fatal error: Class 'Mongo' not found in /Library/WebServer/Documents/mongo_php.php on line 7
when I try to load this file in Safari browser
<?php
//phpinfo();
$dbhost = 'localhost';
$dbname = 'guestbook';
// Connect to guestbook database
$m = new Mongo("mongodb://$dbhost");
$db = $m->$dbname;
// select the collection 'guestbook' in the database 'guestbook'
$collection = $db->guestbook;
// pull a cursor query
$cursor = $collection->find();
foreach($cursor as $document) {
var_dump($document);
}
?>
mongo.so is in php.ini
;extension=/usr/lib/php/extensions/no-debug-non-zts-20090626/mongo.so
extension=mongo.so
(I've tried both)
I've also tried setting
extension_dir ="/usr/lib/php/extensions/no-debug-non-zts-20090626/"
where am I going wrong?
I have mongod up and waiting, also sleepy mongoose
mongod --rest --config /etc/mongodb.conf --pidfilepath /etc/mongodb.pid --logappend&
python /Users/ron/mongo/sleepy.mongoose-master/httpd.py
mongo shell and sleepymongoose and curl work fine
sh-3.2# php-config
Usage: /usr/bin/php-config [OPTION]
Options:
--prefix [/usr]
--includes [-I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib]
--ldflags [ ]
--libs [-lresolv -lz -lexslt -ltidy -lresolv -ledit -lncurses -lpq -lpq -liodbc -lldap -llber -liconv -liconv -lfreetype -lpng -lz -ljpeg -lcrypto -lssl -lcrypto -lcurl -lbz2 -lz -lpcre -lcrypto -lssl -lcrypto -lm -lxml2 -lz -licucore -lm -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -lcurl -lxml2 -lz -licucore -lm -liodbc -lxml2 -lz -licucore -lm -lnetsnmp -lcrypto -lxml2 -lz -licucore -lm -lxml2 -lz -licucore -lm -lxml2 -lz -licucore -lm -lxml2 -lz -licucore -lm -lxml2 -lz -licucore -lm -lxml2 -lz -licucore -lm -lxslt -lxml2 -lz -licucore -lm ]
--extension-dir [/usr/lib/php/extensions/no-debug-non-zts-20090626]
--include-dir [/usr/include/php]
--man-dir [/usr/share/man]
--php-binary [/usr/bin/php]
--php-sapis [cli apache2handler]
--configure-options [--prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --disable-dependency-tracking --sysconfdir=/private/etc --with-apxs2=/usr/sbin/apxs --enable-cli --with-config-file-path=/etc --with-libxml-dir=/usr --with-openssl=/usr --with-kerberos=/usr --with-zlib=/usr --enable-bcmath --with-bz2=/usr --enable-calendar --with-curl=/usr --enable-dba --enable-ndbm=/usr --enable-exif --enable-ftp --with-gd --with-freetype-dir=/usr/local --with-jpeg-dir=/usr/local --with-png-dir=/usr/local --enable-gd-native-ttf --with-icu-dir=/usr --with-iodbc=/usr --with-ldap=/usr --with-ldap-sasl=/usr --with-libedit=/usr --enable-mbstring --enable-mbregex --with-mysql=mysqlnd --with-mysqli=mysqlnd --without-pear --with-pdo-mysql=mysqlnd --with-mysql-sock=/var/mysql/mysql.sock --with-readline=/usr --enable-shmop --with-snmp=/usr --enable-soap --enable-sockets --enable-sqlite-utf8 --enable-suhosin --enable-sysvmsg --enable-sysvsem --enable-sysvshm --with-tidy --enable-wddx --with-xmlrpc --with-iconv-dir=/usr --with-xsl=/usr --enable-zend-multibyte --enable-zip --with-pcre-regex=/usr --with-pgsql=/usr --with-pdo-pgsql=/usr]
--version [5.3.15]
--vernum [50315]
sh-3.2# pwd
/usr/lib/php/extensions/no-debug-non-zts-20090626
sh-3.2# ls -l
total 1616
-rw-r--r-- 1 root wheel 653268 27 Aug 16:37 mongo.so
-r-xr-xr-x 1 root wheel 57312 26 Sep 2012 phpcups.so
-rwxr-xr-x 1 root wheel 395744 26 Sep 2012 xdebug.so
sh-3.2#