Just have two box versions and two Homestead.yaml files along with the VagrantFile. Have to change the IP and use different ports 8001 2223 etc
How do i setup 2 homestead boxes? ( one with php 5.6 and one with php 7)
Hi everyone, i just started playing with homestead after some mysql issues with my existing development environment (mamp pro)
i am trying to figure out how to setup 2 global Homestead boxes. One with php 5.6 and one with php 7. any good tutorials on how about doing so?
I have several projects so a homestead box per site is out of the question :)
I'm currently trying to accomplish this, but so far no luck. I managed to download the 0.3.3 Homestead box, but when trying to vagrant up, the console tells me that I don't have box 0.4.0 and starts downloading it.
@unitedworx homestead has various boxes defined these can be defined on top of your Homestead.yaml file. In my experience use the homestead repo v2.* for php5 and 3.* for php7.
Hi @unitedworx, did you manage to do it?
Personally I have setup homestead as in the doc with the latest version (PHP7). Then for PHP5.6 apps I prefer to stick with the per project setup with composer. The extra 4GB for the VM are better than playing around with other solutions that may break at some point for xyz reasons.
So basically I import the 2 boxes:
vagrant box add laravel/homestead --box-version 0.3.3
vagrant box add laravel/homestead
At the root of the project, added the following in composer.json:
"require-dev": {
"laravel/homestead": "v2.2.1", //to install the php56 with you VM
I had a vendor directory before and bumped into some dependencies issues (like symfony/process 3.0.3 is installed instead of a 2.8.x branch). I deleted the vendor directory and did a composer install again.
Before launching a vagrant up, I modified the Homestead.yaml in the project , adding the line with version:
---
ip: "192.168.10.20"
version: "0.3.3"
And voila!
You can have 2 boxes only:
//git clone the branch you want in a second Homestead directory:
git clone --branch 2.2.1 https://github.com/laravel/homestead.git Homestead2
Then, tweaking the init.sh file to setup, i.e., a second .homestead2 and finally modify the vagrant file confDir variable accordingly should do the trick. I may do that eventually. :)
i gave up on using homestead since mamp pro I use was ten times simpler to use and i can even switch between various php versions dead easily. Only reason I was looking into homestead was since I found that mamp does not use a native mysql driver and there are some inconsistencies there. i will probably give homestead another go once i have some free time in my hands.
Hey, thanks for the update. I do use mamp pro as well but more for drupal or wordpress stuff when I need to play with Adobe... (quite demanding in memory). For an app, I prefer homestead since it is closer of what the production server would be. And you don't need to mess up your own OS to get specific things. It also makes sense to use homestead or any VM when you work with other developers using either Windows or Mac. It simplifies the hassle. Let us know if you need further help.
Have a look at PuPHPet you can define a VM really simply there, just create 2 (setup once and then just change the PHP version and download the archive again) and Bob's ya Uncle. If you set 2 different IP addresses (instead of just changing the PHP version), you should also then be able to have both VMs running side by side without a problem.
Normally I run one VM for multiple sites as it's simpler than having lots of separate vagrant / vm setups, but if I need something specific (ie: closer to a different production environment) then I'll just create another config specific for that project / set of projects.
Whilst Homestead worked for me.. I found this to offer far more flexibility (and for me, the option to use VMware over VirtualBox for better performance / reliability too, albeit not free).
Cheers..
Ian
If anyone is interested, figured it might be informative.
A month or so ago I had a detail conversation about setting up multiple versions of homestead on windows, http://laravel.io/forum/02-03-2016-install-specific-laravel-homestead-version-and-502-bad-gateway-nginx-solved
Thanks @ian_h, I'll give it a try, it seems very simple indeed and could help since I use Parallel.
Since Homestead v6 multiple PHP versions in one homestead vagrant box are possible. The latest Laravel-Version with Homestead including PHP 5.6 is Laravel 5.6. See https://laravel.com/docs/5.6/homestead for details and installation instructions. Use the following commands during installation to get this Homestead-Vagrant-Box:
vagrant box add laravel/homestead --box-version 6.4.0
git clone https://github.com/laravel/homestead.git .
git checkout v7.20.0
This Homestead-Version supports PHP 5.6 to 7.3. (More details in german: https://blog.dmr-solutions.com/blog/homestead-vagrant-box-mit-php-56)
Good Luck and regards, Ralf Lütke
Just for reference, you can use both php 5.6 and php 7 on the same homestead install. Just update the nginx confit for each site to use the php version you want.
Please or to participate in this conversation.