Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

penguinfeet's avatar

Laravel 5 Installation - Runtime exception in compiled.php line 6911

Hi guys,

I ran a fresh install of a Laravel 5 project and I am trying to get it set up with Homstead. However, it is giving me the below error (about the cipher/key). I went into the .env file and changed the app key = to the default one (AES-256-CBC), but still not working. Do you have any idea what might be happening? Thank you!

Whoops, looks like something went wrong.

1/1 RuntimeException in compiled.php line 6911: No supported encrypter found. The cipher and / or key length are invalid. in compiled.php line 6911 at EncryptionServiceProvider->Illuminate\Encryption{closure}(object(Application), array()) in compiled.php line 1057 at Container->build(object(Closure), array()) in compiled.php line 1010 at Container->make('encrypter', array()) in compiled.php line 1537 at Application->make('Illuminate\Contracts\Encryption\Encrypter') in compiled.php line 1102 at Container->resolveClass(object(ReflectionParameter)) in compiled.php line 1086 at Container->getDependencies(array(object(ReflectionParameter)), array()) in compiled.php line 1072 at Container->build('App\Http\Middleware\EncryptCookies', array()) in compiled.php line 1010 at Container->make('App\Http\Middleware\EncryptCookies', array()) in compiled.php line 1537 at Application->make('App\Http\Middleware\EncryptCookies') in compiled.php line 9400 at Pipeline->Illuminate\Pipeline{closure}(object(Request)) in compiled.php line 2659 at CheckForMaintenanceMode->handle(object(Request), object(Closure)) at call_user_func_array(array(object(CheckForMaintenanceMode), 'handle'), array(object(Request), object(Closure))) in compiled.php line 9400 at Pipeline->Illuminate\Pipeline{closure}(object(Request)) at call_user_func(object(Closure), object(Request)) in compiled.php line 9390 at Pipeline->then(object(Closure)) in compiled.php line 1999 at Kernel->sendRequestThroughRouter(object(Request)) in compiled.php line 1985 at Kernel->handle(object(Request)) in index.php line 54

0 likes
11 replies
mstnorris's avatar

@penguinfeet you didn't do it correctly.

  1. Add an APP_KEY by running php artisan key:generate from the command line in your project root. This will generate a random, 32 character string which is used for encryption.
  2. You should already have 'cipher' => 'AES-256-CBC', within your config/app.php file if it is a new project. That is where I think you are confused.
  3. You're good to go :D
4 likes
penguinfeet's avatar

@mstnorris So looking in my config/app.php file, the 'ciper' line is already in there. When I run php artisan key:generate, the APP_KEY is not changing...It stays as the default SomeString. Any idea what may be happening?

mstnorris's avatar
Level 55

Just type in any 32 character string - "ukvRzvoJPTquzYPL4KRLXJt4ePPvJYKD" for example. Not sure why it isn't generating, if it isn't set to "SomeRandomString" then the command won't know what to overwrite.

penguinfeet's avatar

It is set to SomeRandomString (in the .env file and in the app.php file), the command is just not over writing it. Very strange. I'll just type in a random key.

mstnorris's avatar

Sometimes that can happen, it doesn't matter though, any random string will do as long as it is private. But that should solve your issue.

meetgodhani's avatar

Did anyone solved this? I still get error after setting a key in Laravel Forge ? It just driving me crazy on how to solve this.

penguinfeet's avatar

@meetgodhani Just use a fake key with 32 characters like the one above in your .env file and in your config/app.php file. It will work.

ahuggins's avatar

@penguinfeet is what worked for me. It seems Forge might have an issue writing to the .env file. So you can generate a key with Artisan, but then you might have to add it to the .env file. Or at least that worked for me.

Also, you don't want to update your config/app.php file since that will cause issue with git. You are better off writing it in your .env file if you have to manually put it somewhere. I guess you could add it to Forge as an environment variable too.

peanut's avatar

If nobody else knows about this, the easiest way I did it was rename .env.example to .env and then run php artisan key:generate and that was it. I had to rename the file BEFORE I ran that command which was what was throwing me off!

infernobass7's avatar

I had this issue. As well as Laravel randomly trying to access a database called forge on localhost but my .env file contained all of the logins correctly and non were using the forge database but in the database file it did reference forge. I want to say if there are enough pieces trying to read from the .env file at the same time, causing one of them to return that the .env file does not contain a value. If you run into this issue randomly, then you should overwrite the data in the files in config folder.

Please or to participate in this conversation.