Installing (Downgrading) Homestead to PHP 7.0

Adnan Sabanovic
2 min readMay 11, 2017

--

Laravel Homestead

The other day I had a problem with setting up an older Laravel app on my homestead that is written with some older dependency versions.

The biggest problem was Guzzle 5 that has a completely different syntax , when making server requests, from Guzzle 6. There were some other packages that depended on Guzzle as well and my Homestead was up to date with the latest version and PHP 7.1.3.

Web Hosting Recommendation

Many people have asked me about the hosting I am using. To be honest I tried different hosting accounts from shared, VPS and dedicated. In case you want some really affordable hosting I recommend Bluehost. I am also hosting some of my Laravel projects right there on this $3.95 shared account and it works great.

My recommendation for the best affordable web hosting. Click here to jump right there!

Continue …

Now there is another issue where Guzzle 5 isn’t working with PHP 7.1.* and this bug is current.

What I had to do is to destroy my current vagrant install with PHP 7.1.* and install a new one with PHP 7.

Taylor Otwell has a vagrant box dedicated to PHP 7.0 only which can be found here https://atlas.hashicorp.com/laravel/boxes/homestead-7

Make sure you use this https://laravel.com/docs/5.4/homestead#old-versions to help you stay on the right path.

Now in order to install this, make sure you pull the right Homestead github repo, with tag v3.1.0

After you have cloned the repo and you got your Homestead directory, use your git bash console to type:

git checkout tags/v.3.1.0

Now go to you Homestead/scripts/homestead.rb — This file should have vagrant box laravel/homestead-7 for vagrant box. If it is not, feel free to change laravel/homestead to laravel/homestead-7 .

In the end you should have your homestead.rb something like this

# Configure The Box

config.vm.define settings[“name”] ||= “homestead-7.0”
config.vm.box = settings[“box”] ||= “laravel/homestead-7”
config.vm.box_version = settings[“version”] ||= “>= 0.1.0”
config.vm.hostname = settings[“hostname”] ||= “homestead”

You can put any name for the settings[“name”]

Then run the vagrant up — provision

It will download and add the vagrant box automatically for you.

Once you are done and able to do vagrant ssh, do it and check the php version php –v . It should be 7.0 now.

And that’s it. Feel free to write any comments you have.

If you find this interesting then follow me on Twitter or LinkedIn.

--

--

Adnan Sabanovic
Adnan Sabanovic

Written by Adnan Sabanovic

Just a tech guy involved in mastering life using mental and physical discipline. Journaling about productivity, personal development and overall growth. #Life

Responses (2)