Have set up a project and when trying to connect to the local host I get this error in the console:
[Wed Aug 12 21:26:46 2015] 127.0.0.1:50079 [500]: / - Uncaught exception 'UnexpectedValueException' with message 'The stream or file "/CT/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied' in /CT/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:87 Stack trace: 0 /CT/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php(37): Monolog\Handler\StreamHandler->write(Array) 1 /CT/vendor/monolog/monolog/src/Monolog/Logger.php(289): Monolog\Handler\AbstractProcessingHandler->handle(Array) 2 /CT/vendor/monolog/monolog/src/Monolog/Logger.php(565): Monolog\Logger->addRecord(400, Object(UnexpectedValueException), Array) 3 /CT/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(49): Monolog\Logger->error(Object(UnexpectedValueException)) 4 /CT/app/Exceptions/Handler.php(30): Illuminate\Foundation\Exceptions\Handler->report(Object(UnexpectedValueException)) 5 /CT/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(79): App\Exceptions\Handler->report(Ob in /CT/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php on line 87
I have followed other's instructions to recursively call chmod 777 on the problem folder (even though it is bad practise) and still no luck.
It seems to be a fairly common problem but I can't find anything of much use.
Short version: In addition to the folder needing write permission, you'll need write permission on the file itself.
/CT/storage/logs/laravel.log
Try
chmod 777 storage/logs/laravel.log
Long Version: Unix permissions have, and will continue to plague, PHP developers until the end of time.
The problem is there's no simple "right" answer here. What your permissions need to be will depend on how you're running your web-server (mod_php
vs. fastcgi), what your current user account is, how those accounts relate (what group they're in), and how the log file was initially created. If you first created the log file by running PHP from the command line, the file will be owned by you. If you first created it by running PHP from the web browser, the file will be owned by the web server user.
Good luck!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With