On Debian Jessie, Apache2 --version "0.91-ubuntu1", PHP 5.6.30.
I have tried many the questions already answered when searching for the topic.
1) I did the manual install for MongoDB PHP Driver http://php.net/manual/en/mongodb.installation.manual.php
2) To check if it works I created a file testMongo.php and added
< ?php phpinfo(); ?>
3) Running testMongo.php in the browser yield that configuration file can be found in.
/etc/php5/apache2/php.ini
4) My mongo.so file can be located using the command
php -i | grep extension_dir
5) Output is:
extension_dir => /usr/lib/php5/20131226 => /usr/lib/php5/20131226
6) In this file I added right after "Dynamic Extensions"
extension=/usr/lib/php5/20131226/mongo.so
7) I then went over to Composer and did the Command-line installation
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('SHA384', 'composer-setup.php') === '544e09ee996cdf60ece3804abc52599c22b1f40f4323403c44d44fdfdd586475ca9813a858088ffbc1f233e9b180f061') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
8) Once Composer is installed I tried:
php composer.phar require mongodb/mongodb
However this results in the following message:
Problem 1
- mongodb/mongodb 1.2.0 requires ext-mongodb ^1.3.0 -> the requested PHP extension mongodb is missing from your system.
- mongodb/mongodb 1.2.0 requires ext-mongodb ^1.3.0 -> the requested PHP extension mongodb is missing from your system.
- mongodb/mongodb 1.2.0 requires ext-mongodb ^1.3.0 -> the requested PHP extension mongodb is missing from your system.
- Installation request for mongodb/mongodb ^1.2 -> satisfiable by mongodb/mongodb[1.2.0].
Some fellows mentioned in a post that I could use --ignore-platform-reqs It works!
When i run:
# php5 index.php$client = new MongoDB\Client(< connection to mongo-atlas>) //Works with python
I get the following error:
PHP Fatal error: Class 'MongoDB\Driver\Manager'
not found in /var/www/vendor/mongodb/mongodb/src/Client.php on line 83