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.
If you do sudo apt-get upgrade on a Ubuntu box (e.g. a local VVV development environment) and suddenly find your WordPress Dashboard and admin screens are blank (entirely empty grey background except for the admin bar and left hand navigation – because nothing is being printed below the header), you might well need to do:
sudo apt-get install php7.0-xml
This can be triggered by certain plugins, such as JetPack, needing the xml_parser_create() function, which doesn’t exist without that package.
But the error:
PHP Fatal error: Uncaught Error: Call to undefined function xml_parser_create() in /srv/www/example-project/htdocs/wp-includes/class-IXR.php:264
…won’t be visible, and you might start removing plugins unnecessarily (because wiping the plugins will seem to cure the problem…) So I hope that helps.
P.S. when you have something like this, running wp plugin status at the command line (install WP-CLI) is a good idea, as you’ll see all the errors.
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.