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
the following code
Finally, we need to save the changes:
sudo service php7.0-fpm restart && sudo service nginx restart
2 thoughts on “MongoDB on Laravel Homestead with PHP 7”
Thanks!! 😀 I been looking for away to do this!!
I’m glad to know that my solution helped you!
Good luck! 😀