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:
php7.0-fpm: unrecognized service
and the configured sites were returning 502 Bad Gateway errors.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 [email protected] -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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With