Support the ongoing development of Laravel.io →
Installation Configuration
Last updated 2 years ago.
0

I had a similar need a bit ago, so here comes a lot of information:

You can specify a box version with the ‘vagrant box add’ statement.

vagrant box add laravel/homestead -–box-version 0.3.0

This will download the box version 0.3.0, other version numbers can be found at https://atlas.hashicorp.com/laravel/boxes/homestead, some of the older ones might not be downloadable.

If you have an older version already installed and you want to keep it, you can extract the box from vagrant like this:

vagrant box repackage laravel/homestead virtualbox 0.3.0

This will extract a package.box file in the current directory; it will overwrite any existing file. I renamed mine, homestead-0.3.0.box.

Then in the future you can add it by specifying the name, ‘vagrant add box path/to/homestead-0.3.0.box’

Now, to get it to load with the homestead package, you will need to add a config value to your homestead config file.

If your using the latest version of homestead (4.x), you can add a config option to the .homestead/homestead.yaml, perhaps under the provider line,

version = “0.3.0” 

… or whichever version you end up using. Be aware that some of the new features on the newest config may not work on the old version, so you might need to comment out or adjust the configs.

If you have an older homestead config, then you will need to add the full vagrant config line to the scripts/homestead.rb file, perhaps under the “#Configure The Box” section,

config.vm.box_version = “0.3.0”

I have version 0.3.0 and it has php version 5.6.17 installed, I was trying to get to 5.6.10 but .17 was close enough.

You can list the currently installed versions in vagrant with,

vagrant box list 

Returns something like this,

/>vagrant box list
laravel/homestead (virtualbox, 0.3.0)
laravel/homestead (virtualbox, 0.3.3)

Here are the available versions on atlas, that should download,

Box: laravel/homestead
Address: https://atlas.hashicorp.com/laravel/homestead
Available versions: 0.1.0, 0.1.1, 0.1.2, 0.1.3, 0.1.4, 0.1.5, 0.1.6, 0.1.7, 0.1.8, 0.1.9, 0.2.0, 0.2.1, 0.2.2, 0.2.4, 0.2.5, 0.2.6, 0.2.7, 0.3.0, 0.3.3, 0.4.0, 0.4.1

Hope that helps

Links: Virtual box versioning, https://www.vagrantup.com/docs/boxes/versioning.html Virtual box add and repackage command flags, https://www.vagrantup.com/docs/cli/box.html Homestead box versions, https://atlas.hashicorp.com/laravel/boxes/homestead

Last updated 8 years ago.
0

Thank you for your help!!

0

Hi, I'm trying to follow the steps above in order to use the homestead box with PHP 5.6. I have a legacy code base that won't work in PHP 7 and I made the mistake up upgrading without looking :( - Anyhow, I need to get back up and running and can't seem to make it work!

I started from scratch (deleted Homestead, old boxes, etc):

Got the older box: vagrant box add laravel/homestead -–box-version 0.3.0

Got Homestead: git clone https://github.com/laravel/homestead.git Homestead

Fired it up: bash init.sh

Edited the YAML file to include: version: “0.3.0”

ran Vagrant Up and get this: default: php7.0-fpm: unrecognized service

What am I doing wrong!? Thank so much for any help!

Last updated 8 years ago.
0

Right, I didn't use the most recent when I did this.

You need to update other homestead files as those are all pointing to php7 now.

In your scripts folder, you need to change all of the references to php7.0 to php5.

homestead.rb (a couple more changes here)
-> line 190,
change path "/etc/php/7.0/fpm/php-fpm.conf" to "/etc/php/php5-fpm.conf"
-> line 201,
change "service php7.0-fpm restart" to "service php5-fpm restart"

clear-variables.sh 
-> line 4, 
change path "/etc/php/7.0/fpm/php-fpm.conf" to "/etc/php/php5-fpm.conf"

backfire.sh 
-> line 26,
change "service php7.0-fpm restart" to "service php5-fpm restart"

serve-symfony2.sh 
-> line 35 and 47
change "php7.0-fpm.sock" to "php5-fpm.sock"
-> in line 69, 
change "service php7.0-fpm restart" to "service php5-fpm restart"

serve-laravel.sh
-> line 43
change "php7.0-fpm.sock" to "php5-fpm.sock"
-> in line 68, 
change "service php7.0-fpm restart" to "service php5-fpm restart"

serve-hhvm.sh
-> line 59,
change "service php7.0-fpm restart" to "service php5-fpm restart"

*edit: updated the php5-fpm.sock path

Last updated 8 years ago.
0

Oh,

One more thing I do is change the init.sh (init.bat) file to make the config folder in the current homestead folder.

I also add these to the homestead.yaml

provider: virtualbox
// added after 

// change for each homestead machine
hostname: hsbx1 
name: testvm

// specify the box version
version: "0.3.0"

This allows me to run multiple homestead instances without overwriting the previous one.

I do not use the homestead php scripts as I run on windows and do not want to install php so I just use vagrant up, vagrant halt, etc. in the homestead folder.

I did all of the changes as a test and created a testvm homestead box, the php 5.6.13

0

Thank you so much for your help!! I finally got it up and going with the suggestion to edit the files in the scripts dir.

I had to modify the paths however to this:

// for the conf
/etc/php5/fpm/php-fpm.conf

//for the sock
/var/run/php5-fpm.sock

It's been days, so really, I can't thank you enough!

0

I see that I left that path out when making the post.

I'm happy that it is working :)

0

I also made same editions like azabraxas but I'm using version: "0.2.7" and still get:

502 Bad Gateway nginx/1.8.0

Still looking for the reason

0

Is there any information in the nginx log file ?

/var/log/nginx/... (domain name).error
0

I made a local install of version 2.7 and the only way i was able to get the same error was if the paths were wrong in the homestead config.

Example,

folders:
    - map: C:\local_devel\Code
      to: /home/vagrant/Code

sites:
    - map: phptesting.lan
      to: /home/vagrant/Code/phptesting/public

If either of these "to" values were incorrect I got the error you mentioned.

Using the 127.0.0.1:8000 or the phptesting.lan with a modified hosts file.

To fix, either ssh in and check the /etc/nginx/sites-enabled/ files, or fix in the config and do vagrant provision

Last updated 8 years ago.
0

Thank you TerrePorter I could finally fix it. My Laravel app is back and running.

I had to edit sites available here

nano /etc/nginx/sites-available/myowndomain.app

and change this line

fastcgi_pass unix:/var/run/php/php5-fpm.sock;

to this line

fastcgi_pass unix:/var/run/php5-fpm.sock;

and that was it! :)

Looking to the logs here was very helpful

sudo nano /var/log/nginx/myowndomain.app-error.log
0

Awesome! Gald you got it working.

0

i think it will be helpful to fork the current homestead and reconfig for PHP version 5.6

0

Franckweb you saved my day! I have the same problem with running app on php 5.6, and fixing nginx config solve the problem

0

Sign in to participate in this thread!

Eventy

Your banner here too?

franck franckweb Joined 17 May 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.