Troubleshooting Laravel ‘Class log does not exist’ error

This is a common problem – the error is in Illuminate/Container/Container.php (line 736 or 741).

Forum thread

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.


How to upgrade Laravel Homestead to PHP7

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.