Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP

Anthony Giuliano
Anthony Giuliano
9,569 Points

Installing Laravel

I got through the first stage and installed Vagrant and Virtual Box. Just curious why we need these programs, and why we need projects like this on a virtual box.

Anthony Giuliano
Anthony Giuliano
9,569 Points

Also, I installed Laravel on my computer while I was at work, and now that I'm home, the laravel.dev page isn't loading. I assume this is due to some change in my network settings, but how would I go about troubleshooting this?

5 Answers

I think a big advantage of using a 'box' is if you're working in a team with lot's of people on different operating systems. It also comes with loads of programs installed, the rails version for instance comes with loads of really useful programs to help manage you're applications and dependencies. It streamlines installing loads of different components into one download!

It sounds like you might not have vagrant running.

Some useful commands:

To boot up

vagrant up

To shut down

vagrant halt

To access

vagrant ssh

To reload (after changes to homestead.yaml)

vagrant provision

If you run vagrant ssh and it complains, it probably means you don't have it started. I wouldn't be surprised if it shut down if you closed / turned off your machine!

Hope this helps

Chris Shaw
Chris Shaw
26,676 Points

Hi Anthony,

These programs aren't a required but are recommended as Homestead is designed specifically for Laravel so you can the best performance and development experience while retaining the site locally outside the virtual machine.

Personally I prefer to use MAMP Pro on my MacBook Pro as the virtual machine can chew up some vital memory but all-in-all I love the custom built stack within the virtual machine as you can take your project anywhere with you and not have to deal with setting everything up again from the start.

Also, I installed Laravel on my computer while I was at work, and now that I'm home, the laravel.dev page isn't loading. I assume this is due to some change in my network settings, but how would I go about troubleshooting this?

How have you setup your Homestead.yaml file?

Anthony Giuliano
Anthony Giuliano
9,569 Points

Hmm so I got back to work, that host still won't open, with the same error. Is this like MAMP where I have to have something running in order for it to work? Sorry this seems like it might be obvious but I don't recall anything like that in any of the videos, unless it was one of the terminal commands I didn't fully understand.

Anthony Giuliano
Anthony Giuliano
9,569 Points

Yea that's what I was thinking, I've been using MAMP for all the other PHP projects I've been following along with, I didn't understand why anyone would go through all that trouble if you could just let MAMP do it.

Re the yaml file, yes I followed along all the way up to the point where I verified it was up and running by navigating the browser to 127.0.0.1:8000 and seeing the Hello page. I set up the new host in my hosts file and that worked just fine. Then I packed up and went home, now the page won't load. I'm getting the error: Error code: ERR_CONNECTION_REFUSED.

Thanks for the response by the way!

Anthony Giuliano
Anthony Giuliano
9,569 Points

Thanks Tom that's super helpful, bookmark worthy in fact! It occurred to me as I was launching MAMP earlier today that not having one of those programs running probably had something to do with it. Now I feel pretty stupid for not catching in the video what 'vagrant up' was actually doing. I'm sure that's what the problem was, but I already went back and reinstalled it without homestead on a host I added in MAMP, and that's fine for my purposes.. I'm just trying to learn at this point, not really working on an application. Only problem is I realized that somehow I set it up as a production environment instead of local. Not sure if that will have any impact on my ability to follow along later, but I guess I'll find out lol.

Thanks again for the help.

No worries!

Production is the default environment.

The doc's tell you how to setup different environments, with some more info on the laravel forums. To follow along with laravel-basics, you shouldn't have to change your envo, but good to know!

Tom