Laravel 5 and Homestead

I have been learning Laravel 5 (using the Laracasts, lynda.com and the book Easy Laravel 5 by Jason Gilmore) over the past few weeks, and enjoying it thoroughly.

I have always used XAMPP on Windows when developing websites and applications, so I have been skipping over the parts on Homestead. But I am starting to wonder if it would be useful for me to know Homestead too.

Is there an advantage to developing a Laravel-based application using Homestead over XAMPP? If so, it would probably be worth my while not skipping that step. (I have studied Web Hosting with Linux and Ubuntu, so I am comfortable with command line, but not an expert by any means.)

There are several advantages. Bruno, the local PHP Guru goes through and explains a lot of good reasons in his article about Vagrant and starting with PHP developing with it.

Scott

2 Likes

Yes, a few hours of your time is worth learning how to set-up the vm.

Okay, thanks. Then I will definitely go back and set that up and use it in the future for all my practice applications.

Thereā€™s definitely an advantage. @swader could give you an earful about it :smiley:

Good reads (by Bruno):
How to get a Homestead box running quickly:

And more reasons why to use Vagrant:

2 Likes

Thanks for the recommendations, guys : )
@WebMachine if you get stuck, let us know! Iā€™m in the process of updating that quick tip btw, itā€™ll become even quicker to set up soon.

1 Like

I didnā€™t even see your answer, literally read right past it, till Bruno said recommendations, plural, and I checked again to see whose answer Iā€™d probably duplicated :smiley:

Actually I am stuck. :smiley:

I am using the ebook Easy Laravel 5 by Jason Gilmore and got as far as installing Vagrant, Virtual Box and the Homestead box and stalled at the command homestead init with the error message " ā€˜homesteadā€™ is not recognized as an internal or external command, operable program or batch file. "

I went back to the Laracast ā€œLaravel 5 Fundamentalsā€ I had worked through (having skipped the section on Homestead and used my XAMPP) and started going through the video on Homestead but ran out of time. Before I return to that, I am going to read those two articles that @jeffreylees recommended.

Okay, I got past that part using a different CLI. Now Iā€™m stuck at a point where my paths were wrong pointing to homestead.yaml. I managed to fix those, and it messed up another path. All the articles I read claim using Homestead will make the whole process easy and fun (Yes, they said ā€˜funā€™). I canā€™t seem to get to the point where I can actually use Homestead with my Laravel development.

Here is what I have -

Hereā€™s the part of my homestead.rb file that is causing the error:

  # Configure The Public Key For SSH Access
    if settings.include? 'authorize'
      config.vm.provision "shell" do |s|
        s.inline = "echo $1 | grep -xq \"$1\" /home/vagrant/.ssh/authorized_keys || echo $1 | tee -a /home/vagrant/.ssh/authorized_keys"
        s.args = [File.read(File.expand_path(settings["authorize"]))]
      end
    end

and the part of my Vagrantfile that I adjusted to fix the path to the homestead.yaml file and a few others:

VAGRANTFILE_API_VERSION = "2"
confDir = $confDir ||= File.expand_path("~/Homestead")

homesteadYamlPath = confDir + "/src/stubs/Homestead.yaml"
afterScriptPath = confDir + "/src/stubs/after.sh"
aliasesPath = confDir + "/src/stubs/aliases"

require File.expand_path(confDir + '/scripts/homestead.rb')

Could somebody please point me in the right direction. Right now I feel like Iā€™m flying blind-folded.

Okay, so Iā€™m not getting any help with this. Maybe I should start fresh, delete everything Iā€™ve done so far, and try with @swader 's suggestions and Brunoā€™s tutorial and articles, without using my other resources.

Trouble is, I hate to abandon an attempt at something without at least figuring out exactly what went wrong and how to fix it.

Sorry, I donā€™t know enough about Vagrant and etc to be of much more help. For me, though, Iā€™d rather clear it, do it the other way if that works, and move on than troubleshoot it, in this case - Iā€™m not a VM person, so as long as it works or I can figure it out, itā€™s not worth my time to troubleshoot setup problems for my own stuff unless thereā€™s no alternative.

I understand being curious, but your time is worth something too :wink:

1 Like

Hi,

Iā€™d start afresh and use only one set of ā€œHow toā€™sā€. Donā€™t mix and match, as that usually leads to something messing up, some how in some way.

I personally started with this tutorial and used PuPHPet, as it sets up Vagrant to build the exact VM that I want.

Scott

Thanks, Scott. Iā€™ll do that then.

This might sound like a stupid question, but not ever having set up Vagrant and Homestead and venturing into totally uncharted territory for me, is there any harm in my just deleting all the relevant folders, or do I risk missing something?

Which folders do you mean exactly? I wouldnā€™t delete the Vagrant or Virtualbox files or rather the files that were installed with the software. Those installations shouldnā€™t really be the problem.

Scott

Did you see the screenshot I posted above of my terminal where I tried ā€˜vagrant upā€™ in the Homestead directory? There is an issue with one of the paths.

I am sorry to say, I have no experience with Homestead. As I mentioned, I used PuPHPet. Maybe it would be better to uninstall and reinstall Vagrant, if that is where you think you are having problems.

Scott

I think this thread may end up in a different forum - it turns out that on my laptop (MSI MS 1755), virtualization is supported, but disabled. I have spent all evening hunting everywhere in my BIOS and on Google and canā€™t find where to enable it.

Ahā€¦ yes I remember that issue. F**kin windows ā€“ nothing is easy. Though it has been about 2 years since I had to deal with it so canā€™t exactly recall how to fix it. Perhaps search on google ā€œwindows enable virtualizationā€ and see if you canā€™t find something.

Apparently the problem is with my make and model of laptop - it technically is a gaming laptop (donā€™t know if thatā€™s the reason MSI made it impossible to find where to enable virtualization), but when I go into the BIOS, that feature is not there. However, I used Speccy to take a look, and apparently it is supported, just not enabled.

Maybe there is an upgrade of your bios, which will allow the virtualization?

Scott