Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

zakhttp's avatar

Installing mongoDb on Laravel Homestead and php7

Hello Guys, i created a script to help install mongoDB on homestead with php7, Since it was a 3days hassle for me to figure out the problem, so decided to automate the process, Here is the repo: https://github.com/zakhttp/Mongostead7.git Please make sure to change permission of the file to be able to execute it using the command: sudo chmod +x mongoHomestead7.sh

0 likes
17 replies
computecoholic@gmail.com's avatar
Level 1

hi @zakhttp, I like your repo. But there's a typo while trying to restart php fpm. I've create a pull request for that. Thanks :)

thomasdiluccio's avatar

That's truly awesome and it saves me a lot of time. Thank you @zakhttp

There is still one thing I don't manage to do. How to connect the MongoDB databases using GUI client like Mongochef or Robomongo ? Do you guys have any clue how to fix that ?

alquesadilla's avatar

@ thomasdiluccio Connect to mongo on 27017 port using mongochef.

yazeed's avatar

That's awesome indeed. I also wondered how to connect to it through GUI tools like Robomongo & MongoChef.

Here's how though ????

Robomongo MongoDB Homestead Setup

1 like
XavierLaracasts's avatar

Hi @zakhttp ,

Thank you for your contribution.

I am a proper newbie and seem to understand this does not work on Mac (because of Ubuntu-like commands such as apt-get). Am I right? I have installed MacPorts, but it does not make a difference and I doubt it should... Would you have any suggestions to get MongoDB working on my homestead on Mac?

here is the message I get when running your bash script:

MongoDB install script with PHP7 & nginx [Laravel Homestead] By Zakaria BenBakkar, @zakhttp, [email protected] Importing the public key used by the package management system sudo: apt-key: command not found Creating a list file for MongoDB. sh: line 8: lsb_release: command not found tee: /etc/apt/sources.list.d/mongodb-org-3.2.list: No such file or directory deb http://repo.mongodb.org/apt/ubuntu /mongodb-org/3.2 multiverse Updating the packages list sudo: apt-get: command not found Install the latest version of MongoDb sudo: apt-get: command not found Fixing the pecl errors list sed: -i may not be used with stdin Installing OpenSSl Libraries sudo: apt-get: command not found sudo: apt-get: command not found

Thank you

iskren.dimov's avatar

Great work @zakhttp , thanks, saved me some time. :) Btw I saw, that you are writing directly in the php.ini files, which is not a common practice anymore, so I've moved things to a separate .ini file. There is a tricky part with which module should be loaded after which, that's why I have created a pull request to update your script.

Cheers!

gnick666's avatar

Thanks for doing this! It's a great timesaver!

orrd's avatar

@XavierLaracasts you have to run it inside your Homestead command line ("homestead ssh"), not on your Mac command line.

@iskren.dimov it looks like it now no longer writes directly to the php.ini I think right?

mistre83's avatar

@yazeed did you solved the problem? I'm trying to do the same things and i cant connect Robomongo to MongoDB installed on homestead.

However, thansk a lot for this script!

roemer's avatar

Thank you so much! Saved me a bunch of time.

Please or to participate in this conversation.