If you’ve read this guide to checking PHP code for PHP 7 compatibility / used the inspection in the past, you may notice that it’s apparently disappeared – you’re supposed to be able to choose Run Inspection by Name… and choose PHP 7 Compatibility from the list.
This is because it’s been merged with the Language Level inspection.
- Preferences > Languages and Frameworks > PHP
- set desired PHP Language Level under Development environment
- Run inspection by name…
- choose Language Level
Thanks to Jetbrains Support for helping me with that..
(Tested with PhpStorm 2017.1 EAP)
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.