Homestead randomly stopped working for me, so I tried to remove the whole thing and reinstall, but it's not gone well.
I have it "running" after a day and a half of muddling my way through various issues. However, for reasons that I cannot understand, my Homestead box is now running PHP 7.
The instructions I was following had optional options for installing PHP 7, but I intentionally skipped that because we are on PHP 5.
For the life of me, I can't figure out how to fix this. Things I have tried:
I have destroyed and reinstalled the box multiple times.
I have deleted the VirtualBox box multiple times and redownloaded it.
I tried installing v0.3.3 of the box based on one suggestion. (I also updated the homestead.rb script accordingly.) At one point, something failed during the install process with php7.0-fpm: unrecognized service and the configured sites were returning 502 Bad Gateway errors.
After reinstalling with v.0.4.0, it has started "running" as I described (serves the sites as expected, etc.), but with PHP 7.
Searching for solutions has persistently led to a dead-end.
I'm just a dummy front-end developer. :) Laravel, Vagrant, Homestead, all this stuff makes my head hurt. I just want this to work again so I can go back to my actual work. Any advice or alternate avenues of pursuit for researching this problem would be appreciated.
I've been through this issue too and I solved it by installing an old homestead box v0.3.3 and I've used an old release of homestead installer, so I suggest that you remove your current box v0.4.0 and delete your homestead folder then do this:
$vagrant box add laravel/homestead --box-version 0.3.3
and then download an older version of Homestead installer from git, I'm using v2.1.8 it works fine.
Enjoy php 5.6 :)
I had a similar problem where I tried to upgrade Homestead to the most recent Homestead 7.0 box and configure it to run PHP 5.6 instead of PH7, which various sources said was possible via adding a line to the .yaml file specifying the PHP version.
sites:
- map: myproject.local
to: /home/vagrant/Code/craven/public_html
php: "5.6"
What actually happened when I tried that was that I got a 502 CGI gateway error. Here is a summary of the steps I had to take to fix it:
1) SSH into the Homestead virtual machine.
ssh vagrant#127.0.0.1 -p 2222
Taking a look at the nginx error log in /var/log/nginx/ reveals that the PHP 5.6 files the server is looking for don't exist.
You can get confirmation of this by having a look at the executables.
ls -la /usr/bin/php*
2) To install PHP 5.6, run
sudo apt-get update
sudo apt-get install php5.6-fpm
You can confirm that the php 5.6 service is running via the command
service --status-all
3) Once all this is working, refresh the web page for your site and it should now work. In my case, because I was running a Laravel 4.2 site, I then to install Mcrypt:
sudo apt-get install php5.6-mcrypt
4) In order to get my mysql database up and running, I also had to install mysql.
sudo apt-get install php5.6-mysql
And of course after all that, I had to re-import the database contents from the file I'd exported before upgrading the Homestead box.
Note that if you ever destroy and recreate the Homestead box, you will need to repeat all these steps again.
Related
I'm using Vagrant/Homestead/Virtualbox ~ Vagrant version 2.2.10 | Homestead 10.1.1 | Virtualbox 5.2
I'm running the SilverStripe installation on PHP7.4 and my PHP CLI version is also PHP7.4
Following the SilverStripe installation instructions I've ran the following:
composer create-project silverstripe/installer client-folder
When I load up my installation for the first time I get the following error: (I've censored out the client's name)
Weirdly, even though install.php is no longer included with the installed, I got an old install.php file and ran it and the install.php page loaded up perfectly. When I then ran the install script it gave me the error above again.
I've gone through and made sure all the required extensions are installed.
Could anyone advise on how to fix this please?
I've had a look at this. I tried to destroy my vagrant box using the 'vagrant destroy' command but it didn't work.
I ended up opening up the Virtual Box UI and I then destroyed my Vagrant local machine using that interface.
Afterwards, I ran Vagrant Up to create the 'new' box for the 'first time'.
Silverstripe now loads up perfectly well. As a side, Laravel also didn't work and now works.
In short, it was a problem with my local machine and not SilverStripe.
when I install Homestead by using vagrant box add laravel/homestead and call homestead I miss all the commands that should be available. Never happened before. Did something chance in the process of installation?
This tutorial is step by step setup procedure with explanation.
This is might be what you are looking for:
Laravel Homestead with Windows 10 Step by Step setup procedure with explanation
I worked and tested it.
Here at the office we are using Homestead as our local development environment. All projects we had so far were made in PHP5.6. Now we have a new project and we are going to use PHP7. I can't run PHP7 in my current PHP5.6 homestead machine. How can I achieve to run PHP5.6 and PHP7 projects? They do not have to run at the same time, so I if it's possible to change the Homestead.yaml to use a newer version, that would be fine.
What I have tried already was to run vagrant box add laravel/homestead --box-version 1.0.1. This added the 1.0.1 box but when I added version: 1.0.1 to my Homestead.yaml and started vagrant the PHP version was still on 5.6.
In case people find this post - the answer has changed.
If you run Homestead v6 or above - you automatically get multiple PHP versions installed by default.
In your Homestead.yaml file you can set the version:
sites:
- map: homestead.app
to: /home/vagrant/Code/Laravel/public
php: "5.6"
In addition, you may use any of the supported PHP versions via the CLI:
php5.6 artisan list
php7.0 artisan list
php7.1 artisan list
Check the Laravel docs for more info: https://laravel.com/docs/5.4/homestead#multiple-php-versions
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)
Found a solution! I followed this tutorial. I can run a PHP 5.6 and a PHP 7 Homestead. The only thing I had to do (I already have a PHP 5.6 homestead configured) was:
Clone the latest homestead version in a Homestead-7 folder (or a different name) by running git clone https://github.com/laravel/homestead.git ~/Homestead-7
Go into this directory and run bash init.sh and answer no to all questions.
That's it! You might have to upgrade your vagrant (mine was too old) but that's easy to do by just downloading the latest version on https://www.vagrantup.com/downloads.html (Do not forget to run vagrant provision in Homestead-7)
I like to add to Laurence answer.
After adding php5.6 to Homestead.yml, you cannot simply do "vagrant up --provision". It will not work. You have to actually destroy the vm by running command "vagrant destroy" and recreate back the vm.
So before destroying the vm, better to backup every database you have in there. I do this by dumping all the sql in Code folder. Later after I run the command "vagrant up" I can simply ssh to my vm and go to mysql and run "source dump.sql" in mysql command line again.
I m a newbie and learning Laravel. I m having a trouble with install php and homestead.
As I read in Laravel Official Website:
Laravel Homestead is an official, pre-packaged Vagrant box that provides you a wonderful development environment without requiring you to install PHP, a web server, and any other server software on your local machine.
So I think I do not need to install php in my local machine ??? But when I install composer, it requires PHP.exe and I cannot browse that PATH. I misunderstand here. I have been stuck in this problem and research many websites for whole day, so I think better to ask (even if it is stupid question). Could anyone explain for me please...
---EDIT_NEW---
This is my completed steps to use Laravel:
Install git
Install virturalbox
Install vagrant
vagrant box add laravel/homestead
git clone https://github.com/laravel/homestead.git Homestead
cd Homestead, bash init.sh
Configure Homestead
add to Hosts file
Now I have to install laravel, it requires composer. Composer installation requires php.exe PATH. But if I dont use XAMPP or others local development environment, how can I install Composer ?
(Note: Maybe I misunderstand here "without requiring you to install PHP, a web server, and any other server software on your local machine").
Are you executing composer "inside" Homested vagrant VM or in windows "cmd"? In the first case it's strange in the second of course it doesn't work. You need to acces the Homestead VM via SSH
Thanks for help, with your answers and Laracast Video: https://laracasts.com/lessons/say-hello-to-laravel-homestead-two. Now I got the answer.
You need to follow some steps to running Laravel in your system (windows 10).
1) Install XAMPP or WAMPP, you can download XAMPP from Here.
2) Install composer, find it from Here.
3) Install GIT (optional).
Than go for create New Laravel App.
1) Open Terminal -> goto C:/xampp/htdocs/
2) composer create-project laravel/laravel <App_Name>
3) php artisan serve
I was wondering how I would be able to run multiple versions of homestead without having VirtualBox crash.
I am currently running a default installation of the laravel homestead, but I need to install another older version, the reason is that in current version 0.4.0 the mysql server is 5.7 which is fine, but i need another environment with 5.6 because i have an old project which requires 5.6, so homestead version 0.3.0 would be fine.
Just to be clear: I know how to run multiple sites. That is not the issue. I just want to run a second, custom version of the Laravel Homestead Vagrant box, while still having the possibility to run my normal one.
Details: i managed to add both versions. Output of:
vagrant box list
laravel/homestead (virtualbox, 0.3.0)
laravel/homestead (virtualbox, 0.4.0)
so version 0.4.0 is running fine, now how i can run 0.3.0 ?
Thanks in advance!
Ok i managed it.
I will post the solution for those who faced this issue, because I was not able to find a step by step guide with a homestead related instructions.
Without too much theory the steps are:
Decide which box version you need from here (https://atlas.hashicorp.com/laravel/boxes/homestead), in my case it was 0.3.0 and run
vagrant box add laravel/homestead --box-version 0.3.0
Find on github the propper release of homestead (https://github.com/laravel/homestead/releases) in my case it was (v2.1.8)
and download and extract it to a directory for example Homestead2 in your home folder
Inside Homestead2 directory find scripts/homestead.rb file and edit it.
find lines
config.vm.box = settings["box"] ||= "laravel/homestead"
config.vm.hostname = settings["hostname"] ||= "homestead"
between them add line, in my case :
config.vm.box_version = "0.3.0"
you can also rename
vb.name = settings["name"] ||= "homestead"
if you wish
from within this directory run vagrant up
after this you can use it as usual.
I hope this helps somebody.
There's an option for running a box with version in Vagrantfile.
In your case you need to add box_version to your Vagrantfile similar to this:
Vagrant.configure('2') do |config|
// This line
config.vm.box_version = 0.3.0
end
You can check it out from documentation.