I have a project updating a very old application built on Zend Framework 1.12, and MongoDB 2.4. Recently PHP was upgraded to 5.6 and now an upgrade to MongoDB 2.6 is requested. The server is also old (Redhat 6.9) I do not have provision to upgrade to a later Server OS. MongoDB is on a separate server (not same box as the application files).
Here's what I've done so far:
Stood up a GUI-based Virtual machine (Windows 10 host, Centos 7 Guest, PHP 5.6 and mongo on same).
Installing MongoDB for the most part was smooth, with exception to the MongoDB PHP Driver.
The application code threw 'Class Mongo not found' errors because the legacy code base was instantiating via new Mongo($connStr)
, even trying new MongoClient()
did not work (gave same class not found error).
The mongodb.so file was put in its proper place, and properly mentioned via the /etc/php.ini file
with regard to extension_dir and extension=mongodb.so.
With phpinfo() I verified extension mongodb.so
was loading properly, but perhaps
the wrong PHP Driver was compiled.
I was not able to get the installed driver version above 1.12 and is likely a result of
the varied attempts at compiling drivers.
Tried to reuse a Vagrant & Virtualbox VM where the same application structure was replicated, but sadly my OS (Solus) no longer brings up this VM, it refuses to mount folders the way it did a few months ago. So this too was a dead end. I returned to the Windows as host GUI VM... kept trying different things suggested, but did not get much further.
I've done a fair amount of research on this, but could use some community guidance. Perhaps the best way forward is to completely purge MongoDB from the VM and try again? Since it is PHP below 7, perhaps I installed the wrong thing.. php-driver for mogodb wont't compile
This link MongoDB 2.6 Update Error discusses the removal.
Desired result is PHP 5.6.33 with Zend Framework 1.12 and MongoDB 2.6.latest
Hopefully, the amount of recoding in the application will be minimal but at this point I haven't got a standalone PHP script (outside the Zend app) to connect to MongoDB on a test DB/Collection.
I have budgeted enough time to fix the code, but for now I'm spinning wheels.
Any help/advice appreciated. Thanks in advance.
sudo yum install libcurl4-openssl-dev
sudo yum install openssl-dev
sudo yum install libssl-dev
sudo yum install libsslcommon2-dev
sudo yum install pkg-config
and then... once all that's done
sudo pecl install mongo
mongo.so
and placed it in directory /usr/lib64/php/modules
which is good.extension=mongo.so
was added to /etc/php.ini phpinfo();
php --ri mongo
to see which mongo php driver is installed. It may print...mongo
Mongo Support => enabled
Version => 1.6.16
SSL Support => enabled
To see the mongodb version installed, type mongod --version
which may print...
db version v2.6.12