Hi, folks!
Because I had some troubles with installing and enabling MongoDB driver on Laravel Homestead with PHP 7 version installed on it, I will explain here how I have solved them.
Install MongoDB package
Import public key:
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
Creating a List File:
echo "deb http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list
Update packages list:
sudo apt-get update
Install MongoDB package:
sudo apt-get install -y mongodb-org
Make connection with PHP
Firstly, I have installed PHP MongoDB driver:
sudo pecl install mongodb
Secondly, I have added in
/etc/php/7.0/fpm/php.ini
and in
/etc/php/7.0/cli/php.ini
the following code
extension=mongodb.so
Finally, we need to save the changes:
sudo service php7.0-fpm restart && sudo service nginx restart
Thanks!! 😀 I been looking for away to do this!!
Hi, Jose!
I’m glad to know that my solution helped you!
Good luck! 😀