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

Niely's avatar
Level 1

oauth-private.key does not exist or is not readable

Hi!

So, I imported another project from Bitbucket and tried to launch it using 'php artisan serve', I always get this error: " [LogicException] Key path "file:///var/www/html/DesignViewer5/storage/oauth-private.key" does not exist or is not readable

"

I don't get this error when I make a project myself, I can't run any other command. I tried 'php artisan key:generate', and got the exact same error.

I tried: 'composer update', and got this: " Loading composer repositories with package information Updating dependencies (including require-dev) Package operations: 0 installs, 1 update, 0 removals

  • Updating spatie/laravel-permission (1.11.1 => 1.12.0) Downloading: 100% Writing lock file Generating autoload files

Illuminate\Foundation\ComposerScripts::postUpdate php artisan optimize

[LogicException] Key path "file:///var/www/html/DesignViewer5/storage/oauth-private.key" doe s not exist or is not readable

Script php artisan optimize handling the post-update-cmd event returned with error code 1 "

Anyone knows how to fix it? Thanks!

0 likes
1 reply
Niely's avatar
Niely
OP
Best Answer
Level 1

down vote accept

I found the solution Solution: In config/app.php I had to comment these lines:

/Laravel\Passport\PassportServiceProvider::class, App\Providers\CodeGrantProvider::class, Spatie\Permission\PermissionServiceProvider::class,/

Than you need to migrate the whole database again, than uncomment this line:

Laravel\Passport\PassportServiceProvider::class,

And run php artisan passport:install my application keys weren't working so I had to do:

php artisan config:clear php artisan key:generate php artisan config:clear

And than I could do php artisan serve

Thanks!

1 like

Please or to participate in this conversation.