Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

kjnvalkjnsb's avatar

Homestead PHP 7

Hello,

Can anybody help me with instructions of some sort for installing PHP 7 on my homestead box? I haven't had much luck with my own attempts and not found much online about this.

Thanks!

0 likes
18 replies
Corez64's avatar

Just a disclaimer before I try to explain, I haven't tried this so it may not work.

If you follow the instructions from Zend PHP7 Repositories for setting up the repo and installing PHP you should then on your host machine edit the file homestead/scripts/serve.sh and change the line fastcgi_pass unix:/var/run/php5-fpm.sock; to fastcgi_pass unix:/run/php7-fpm.sock; then provision homestead and hopefully it should work. I used this guide, Running PHP7-FPM Nightly Build on Ubuntu 14.04, to help me out a bit.

If that doesn't work you could try using Rasmus Lerdorf's PHP7 Dev Vagrant Image image, it isn't have the ease-of-use that the homestead commands give but you can use php7dev.yaml in a very similar way. You will need to create the nginx hosts yourself but there is a guide how to do that in the readme.

shiroamada's avatar

Anyone can post the tutorial, how do I have homestead PHP5 and PHP7 two boxes and how do I swap among them?

jekinney's avatar

It explains it in the homestead docs. Homestead that has php 7 goes into its own file. Cd into the new file and use vagrant up. To switch back vagrant halt, cd into the normal homestead (or if installed globally cd out of new homestead and homestead up).

By the way you ask how, and reply you don't want a tutorial, but demand your question get answered as to how? @Corez64 had a great answer.

davorminchorov's avatar

We have to probably wait for a few days before the official PHP7 homestead box is released. Last time I heard, they are waiting for Memchached to be updated for PHP 7. The Homestead-7 repository is still using RC last time I checked.

shiroamada's avatar

Hi all, thanks for your reply. The reason I want to keep two boxes because some development still using php 5.x and I would try out php 7 on the new project. Want to have video tutorial / page tutorial so setup two boxes and allowed me to swap it.

Thanks!

3 likes
DavidEwers's avatar

Unable to load my app in the browser after upgrading my homestead box to 7 as described in the docs. I added the box directive at the top of the yaml file too. I can vagrant up and ssh into a server session, but nothing appears in the browser. Things ran perfectly before. I'm really stuck now, and any help is deeply appreciated.

I posted this as a new question since here it shows up having 9 responses when that is really the total for the thread.

lindstrom's avatar

@shiroamada what about Per Project Homestead rather than two global installs? All you need to do is add the box: honestead7 directive at the top under the ---- of your Homestead.yaml file. Then vagrant up from that project's directory.

---
box: laravel/homestead-7

@DavidEwers I'll find your other thread, but suspect you just need to edit your /etc/nging/sites-enabled/yoursite.app configuration. Look for:

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

replace it with

fastcgi_pass unix:/var/run/php/php7.0-fpm.sock; 
DavidEwers's avatar

Thanks, Lindstrom. Wish I could say that solved the problem, but this line was already correct in the file. Any other ideas? Really want to get working again.

DavidEwers's avatar

Problem solved with help from a friend in my PHP group. I had to map directly to my app code directory in the yaml file. Then I had to destroy the vagrant box and start it up again. Success! I'm not sure why I got by with the default homestead mapping before. Hope this helps someone having the same trouble.

shiroamada's avatar

@lindstrom do you mind to show your full Homestead.yaml how u config it, I still not get the full picture how it able to do it. Thanks

bugsysha's avatar

I switched to docker cause I couldn't wait any longer for Homestead PHP7 box. I would advise to all to switch also, more control and much faster. But I have to be fair, homestead is pretty fast, fastest box out there.

davorminchorov's avatar

Wait for what? The Homestead 7 box is already using the latest PHP7 GPA version. Also the Homestead box is using PHP7 by default as of version 4.0!

felipeumpierre's avatar

Hello guys, I have installed Homestead 3.0.1, but I saw that by default PHP 7 is installed, and I need to install PHP 5.6 for my current projects. There is some how to change the homestead.rb file to install just PHP 5.6 in my VM?

Thanks!

davorminchorov's avatar

install laravel/homestead v2.* and add the vagrant box with version 3.x! It uses PHP 5.6

haiderghaleb's avatar

Hey guys, I installed Laravel homestead v3.0.1 but now I don't have access to "homestead up", "homestead halt" ...etc.

I installed homestead via composer => composer global require "laravel/homestead=~3.0"

Anyone knows how to fix it, when i roll it back to v2.* it appears but then I have conflict with PHP5.6 & PHP7.

Thanks in advance

davorminchorov's avatar

Go to the homestead directory and just run vagrant up, you don't need the homestead command. Don't forget to set up aliases for your commands.

Please or to participate in this conversation.