Getting PHP 5 back in Homestead

So PHP 7 was released a few weeks back. Which is great but I don’t want to move to it right now. I do want to move to PHP 7 some time in the next few months – but not today. Not on version 7.0.0.

So I want to keep going with PHP 5.x in my Vagrant Homestead dev box VM server, at least for a little while. I’m using an Oracle fork of the Homestead box, as I need Oracle db connections.

Problem is, every time I vagrant up after PHP 7 was released it says php5-fpm: unrecognized service, and when I SSH in to the box and do service --status-all it says that I’ve got php7.0-fpm running (but php5-fpm is not there).

So obviously the box has updated itself to PHP 7. Which I don’t want. But how to fix it?

The answer was that the homestead-oracle box was using the laravel/homestead base box. But it was using the latest version of that base box, which is (now) 0.4.0, which has PHP 7 on it.

So the solution was to simply tell the homestead-oracle box to use version 0.3.3 of the base box, by adding the line config.vm.box_version = "~> 0.3" just under = settings["box"] ||= "laravel/homestead" in the scripts/homestead.rb file (as per this pull request).

And then do vagrant destroy and vagrant up.

And now it’s all fixed.  🙂

Getting PHP 5 back in Homestead

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s