Be aware that if you’re using Redis to handle a queue, don’t rename your APP_NAME environment variable while there are jobs on the queue, as they will all mysteriously disappear.
This is because the APP_NAME is used as a prefix to the Redis key, so Laravel will fail to find any jobs that have already been added.
'redis' => [
'client' => env('REDIS_CLIENT', 'predis'),
'options' => [
'cluster' => env('REDIS_CLUSTER', 'predis'),
'prefix' => Str::slug(env('APP_NAME', 'laravel'), '_').'_database_',
This is a common problem – the error is in Illuminate/Container/Container.php (line 736 or 741).
Common reason: spaces in environment variable values in .env file
Two other fixes that have worked for me:
- after an apt-get upgrade on Homestead, installing the php7.0-mbstring package fixed it (Laravel needs four PHP extensions: OpenSSL, PDO, Mbstring and Tokenizer)
- on another installation, changing syntax from:
'production' === env('APP_ENV')
in a ternary operator in config/app.php was the solution.
I wrote this StackOverflow answer, explaining how you can safely backup your work, destroy the old PHP 5.6 Vagrant box and download a brand new one that comes with PHP 7 as standard.
In my opinion this will be easier and cleaner for most people than trying to perform an in-place upgrade (the exception is where you’ve extensively customised PHP, MySQL or Nginx, in which case you need to backup the appropriate config files too.)
There are also some notes on the format of Homestead.yaml when you have more than one site, as the documentation on shared folders isn’t terribly clear.