Laravel stopped working after upgrade to PHP 7
Just upgraded to PHP 7 and your Laravel 5 app stopped working? Get errors like this?
This post shows how to fix it.
Laravel 5.0 uses mcrypt extension which was finally removed from PHP7. That’s why you get errors. In order to fix it you have 2 options:
1) Upgrade Laravel 5 and your application to the latest version (http://laravel.com/docs/master/upgrade). It’s pretty tedious process, but should be done anyway.
2) Or you can use fake mcrypt extension, to make Laravel think mcrypt is present.
Install laravel-mcrypt-faker
Note that we use –ignore-platform-reqs otherwise you’ll get errors like
Then open your config/app.php file and comment out Illuminate\Encryption\EncryptionServiceProvider in the providers list.
Replace it with either Thomaswelton\LaravelMcryptFaker\NoEncryptionServiceProvider or Thomaswelton\LaravelMcryptFaker\OpensslEncryptionServiceProvider.
NoEncryptionServiceProvider provides no encryption at all. Set cipher variable in config/app.php to null (i.e. no encryption). Don’t use it for production.
OpensslEncryptionServiceProvider encrypts data using defuse/php-encryption package. In order to use it, you have to regenerate app key
This should fix the problem.