Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel 5.2 not working on php 7 on Windows 10

I have followed every direction but I cannot get Laravel 5.2 to work on php 7 on Windows 10. On the same server I have Laravel 4.2 (this is the app I want to upgrade) working with no issues whatsoever. None of the answers on similar questions seem to work.

The error I get is:

No supported encrypter found. The cipher and / or key length are invalid.

If I chage the cipher method to MCRYPT_RIJNDAEL_128 the error becomes:

mcrypt_encrypt(): Key of size 0 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported

I have tried

  • php artisan key:generate
  • php artisan config:clear
  • php artisan clear-compiled
  • php artisan config:clear
  • adding app key to /config/app.php, deleting the .env file, adding the key to both .env and app.php and still does not work.

Currently, my .env file looks like this.

.env file

and my app.php file looks like this. app.php

How do I solve this problem? Currently only the home page is working. The login and register pages fail with the errors specified above.

Laravel was installed like this: create-project --prefer-dist laravel/laravel appdir

like image 264
Joe Avatar asked Mar 08 '16 14:03

Joe


1 Answers

Don't worry this is a common problem that is easy to miss.

In your app.php file you are trying to find an env key of somestring (in this case the actual value you want to return) and not the key in which you set the value in the env file.

Setting the key in your app.php file as the following:

'key' => env('APP_KEY')

Should correctly look for the APP_KEY in your env file and set the corresponding value!

like image 72
Nicklas Kevin Frank Avatar answered Sep 30 '22 05:09

Nicklas Kevin Frank