Skip to content
Advertisement

EC2 User Access or File Access Problems?

I’ve been having some issues using an EC2 instance when I try and call CLI commands. I am using Laravel but I cant quite be sure if it is a Laravel issue or EC2.

When I ssh into my EC2 instance, I run the following laravel command to migrate my database:

php artisan migrate

And I get the following error:

PHP Fatal error: Uncaught exception ‘UnexpectedValueException’ with message ‘The stream or file “/var/app/current/storage/logs/laravel.log” could not be opened: failed to open stream: Permission denied’ in /var/app/current/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:107

I then run sudo php artisan migrate and get a totally different error:

[PDOException] SQLSTATE[HY000] [2002] No such file or directory

Then I run php artisan migrate again and it all works as expected!

Anyone have any ideas what is causing this behaviour or how I might fault find?

NOTE: EC2 is 64bit Amazon Linux 2016.03 v2.1.4 running PHP 5.5

Advertisement

Answer

JavaScript

NOT RECOMMENDED: Change the permissions of bootstrap and storage to 777.

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement