Whilst trying to use the php-7 version of Laravel Homestead in a per-project installation, I see this error during vagrant up
:
php5-fpm: unrecognized service
I've tried vagrant destroy
and reinstalling the Vagrant box, but it still comes back to this error.
I didn't get the error when using Homestead globally.
How might this be fixed?
The issue was that whilst box: laravel/homestead-7
was set correctly in Homestead.yaml
, the composer dependency for laravel/homestead
was still using the php-5 version. This meant that the provisioning scripts for Vagrant in vendor/laravel/homestead
were those for php-5 and not php-7.
That can be fixed by using a specific branch of laravel/homestead
for the composer dependency.
In composer.json
, add a custom repository for laravel/homestead
:
"repositories": [
{
"type": "git",
"url": "https://github.com/laravel/homestead"
}
]
And require the php-7
branch specifically for laravel/homestead
:
"require-dev": {
"laravel/homestead": "dev-php-7"
}
Then composer update
and re-provisioning the Vagrant box will fix the issue.
UPDATE
laravel/homestead
now has PHP 7.0 by default, and the old php-7
branch no longer exists. To resolve this issue, you simply need to update to the latest version of laravel/homestead
via composer.json
.