Tue Jun 20 13:17:41.195156 2017] [:error] [pid 14454] [client 203.131.216.144:60475]
PHP Fatal error: Uncaught exception 'UnexpectedValueException' with message 'The stream or file "/var/www/html/app/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied' in
/var/www/html/app/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:107\nStack trace:\n#0
/var/www/html/app/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php(37): Monolog\Handler\StreamHandler->write(Array)\n#1
/var/www/html/app/vendor/monolog/monolog/src/Monolog/Logger.php(336): Monolog\Handler\AbstractProcessingHandler->handle(Array)\n#2
/var/www/html/app/vendor/monolog/monolog/src/Monolog/Logger.php(615): Monolog\Logger->addRecord(400, Object(Symfony\Component\Debug\Exception\FatalErrorException), Array)\n#3
/var/www/html/app/vendor/laravel/framework/src/Illuminate/Log/Writer.php(202): Monolog\Logger->error(Object(Symfony\Component\Debug\Exception\FatalErrorException), Array)\n#4
/var/www/html/app/vendor/laravel/framework/src/Illuminate/Log/Writer.php(113): Illuminate\Log\Writer->writeLog('er in
/var/www/html/app/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php on line 107, referer: http://203.131.209.179/app/login
Asked
Active
Viewed 1.9k times
6

Community
- 1
- 1

Sangwondee
- 75
- 1
- 1
- 8
-
Have you give the permissions to storage logs. – Hasitha Diluka Jun 21 '17 at 06:31
4 Answers
9
Directory Permissions
After installing Laravel, you may need to configure some permissions. Directories within the
storage
and thebootstrap/cache
directories should be writable by your web server or Laravel will not run.
https://laravel.com/docs/5.4/installation#installing-laravel
So, for example, in Linux you can do this by executing chmod
command:
chmod -R 755 storage bootstrap/cache

Community
- 1
- 1

Alexey Mezenin
- 158,981
- 26
- 290
- 279
-
This is not a complete answer. I set the permissions and am still getting permission denied on laravel.log. – Jay Bienvenu Sep 21 '17 at 13:04
-
@JayBienvenu instead of downvoting you could try to find a problem in your system and add your own answer. This solution perfectly works for me for years (Linux, Mac OS). – Alexey Mezenin Sep 21 '17 at 18:09
-
That's what I've spent most of this afternoon doing. Thanks for your help. – Jay Bienvenu Sep 21 '17 at 21:47
-
3
-
Hey , i have the same problem with Symfony 4.4 ( Windows 10) ; any solution ? – Hello_world May 09 '21 at 05:38
4
In your project directory run this command:
chmod -R 777 storage bootstrap/cache

Motiur Rahaman
- 121
- 1
- 6
-
1This is a dangerous way of solving this because you are proposing to grant all the permissions on all the users on the system, on that situation alway the right way it to dig deeper into logs and code trying to understand why is getting a `Permission denied` error. – wolmi Jan 31 '20 at 10:12
-
0
Use this command for giving the right permissions to the storage folder that involves logs/laravel.logs
sudo chmod -R 775 storage
If you are using windows the 775 means :
owner group other
rwx rwx r_x

Pejman Kheyri
- 4,044
- 9
- 32
- 39