Deploying Laravel 5.2 unusual permission error - php

I am trying to load my project on the live server.
these are the specs
PHP version 5.6
Server : Windows
I have loaded all the files and chmod 777
Storage
Vendor
bootstrap/cache
but it keeps giving me the following streaming error:
Fatal error: Uncaught exception 'UnexpectedValueException' with
message 'The stream or file
"C:\inetpub\wwwroot\websites\mysite\storage/logs/laravel.log" could
not be opened: failed to open stream: Permission denied' in
C:\inetpub\wwwroot\websites\mysite\vendor\monolog\monolog\src\Monolog\Handler\StreamHandler.php:87
Stack trace: #0
C:\inetpub\wwwroot\websites\mysite\vendor\monolog\monolog\src\Monolog\Handler\AbstractProcessingHandler.php(37):
Monolog\Handler\StreamHandler->write(Array) #1
C:\inetpub\wwwroot\websites\mysite\vendor\monolog\monolog\src\Monolog\Logger.php(336):
Monolog\Handler\AbstractProcessingHandler->handle(Array) #2
C:\inetpub\wwwroot\websites\mysite\vendor\monolog\monolog\src\Monolog\Logger.php(615):
Monolog\Logger->addRecord(400, Object(UnexpectedValueException),
Array) #3
C:\inetpub\wwwroot\websites\mysite\vendor\laravel\framework\src\Illuminate\Log\Writer.php(202):
Monolog\Logger->error(Object(UnexpectedValueExc
in C:\inetpub\wwwroot\websites\mysite\vendor\monolog\monolog\src\Monolog\Handler\StreamHandler.php on
line 87
Fatal error: Uncaught exception 'UnexpectedValueException' with
message 'The stream or file
"C:\inetpub\wwwroot\websites\mysite\storage/logs/laravel.log" could
not be opened: failed to open stream: Permission denied' in
C:\inetpub\wwwroot\websites\mysite\vendor\monolog\monolog\src\Monolog\Handler\StreamHandler.php:87
Stack trace: #0
C:\inetpub\wwwroot\websites\mysite\vendor\monolog\monolog\src\Monolog\Handler\AbstractProcessingHandler.php(37):
Monolog\Handler\StreamHandler->write(Array) #1
C:\inetpub\wwwroot\websites\mysite\vendor\monolog\monolog\src\Monolog\Logger.php(336):
Monolog\Handler\AbstractProcessingHandler->handle(Array) #2
C:\inetpub\wwwroot\websites\mysite\vendor\monolog\monolog\src\Monolog\Logger.php(615):
Monolog\Logger->addRecord(400,
Object(Symfony\Component\Debug\Exception\FatalErrorException), Array)>
3 C:\inetpub\wwwroot\websites\mysite\vendor\laravel\framework\src\Illuminate\Log\Writer.php(202):
Monolog\Logger->er
in C:\inetpub\wwwroot\websites\mysite\vendor\monolog\monolog\src\Monolog\Handler\StreamHandler.php on
line 87

You need to allow writing for logs dir chmod -R 777 storage/logs

You didn't set permissions correctly. You're on Windows, so read this or this. storage folder with all subfolders and files should be accessible to r&w.

I had a similar problem, turns out the server didnt create the file with the correct owner, even though permissions were set correctly. Hope this helps someone!
I deleted that particular log (im using daily logs) and it worked again.

Delete laravel.log file inside logs folder.
It worked for me.

Related

php fopen() permissions issue

I looked everywhere on the web and just couldn't find a solution.
I am getting this error:
Warning: fopen(/var/www/html/includes/../log/404/log_2018-04-07.txt): failed to open stream: Permission denied in /var/www/html/vendor/katzgrau/klogger/src/Logger.php on line 167
Fatal error: Uncaught exception 'RuntimeException' with message 'The file could not be opened. Check permissions.' in /var/www/html/vendor/katzgrau/klogger/src/Logger.php:134 Stack trace:
#0 /var/www/html/includes/db_class.php(7204): Katzgrau\KLogger\Logger->__construct('/var/www/html/i...')
#1 /var/www/html/includes/db_class.php(7217): db_class->getLogger('404')
#2 /var/www/html/includes/furl_router.php(55): db_class->logger('404')
#3 /var/www/html/includes/furl_router.php(229): goTo404('no page-data / ...')
#4 /var/www/html/index.php(17): require_once('/var/www/html/i...')
#5 {main} thrown in /var/www/html/vendor/katzgrau/klogger/src/Logger.php on line 134
From what I read here it's a permission issue but I can't figure it out. I granted all permissions from root folder, I have no idea what am I doing wrong.
Check folder write permissions. Maybe the user trying to write the log has no permissions. sudo chmod -R 666 logs gives read and write permissions to all users.
For anyone using Katzgrau\KLogger\Logger and using relative paths to locate the log file, use an absolute path, e.g.:
$logger = new Logger(__DIR__ . '/../../logs');
After reading a bit about another issue I had but with a MySQL function, after exploring, I figured out I should use MySQL version 5.6 while I used version 5.7.
I uninstalled MySQL 5.7 and install 5.6 instead. It solved both the MySQL issue and the issue mentioned above.

My website gives blank page - PHP FPM Error

I'm trying to install pterodactyl server management panel on my CentOS 7 server.. I did chown and chmod stuff like docs told me so. But when i try to open the website i see a blank page (phpinfo.php file works like it should work)
output of www-error.log
[22-Nov-2017 16:49:58 UTC] PHP Fatal error: Uncaught UnexpectedValueException: The stream or file "/var/www/html/pterodactyl/storage/logs/laravel-2017-11-22.log" could not be opened: failed to open stream: Permission denied in /var/www/html/pterodactyl/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:107
Stack trace:
#0 /var/www/html/pterodactyl/vendor/monolog/monolog/src/Monolog/Handler/RotatingFileHandler.php(107): Monolog\Handler\StreamHandler->write(Array)
#1 /var/www/html/pterodactyl/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php(37): Monolog\Handler\RotatingFileHandler->write(Array)
#2 /var/www/html/pterodactyl/vendor/monolog/monolog/src/Monolog/Logger.php(337): Monolog\Handler\AbstractProcessingHandler->handle(Array)
#3 /var/www/html/pterodactyl/vendor/monolog/monolog/src/Monolog/Logger.php(616): Monolog\Logger->addRecord(400, Object(Symfony\Component\Debug\Exception\FatalErrorException), Array)
#4 /var/www/html/pterodactyl/vendor/laravel/framework/src/Illuminate/Log/Writer.php(203): Monolog\Logger->error(Ob in /var/www/html/pterodactyl/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php on line 107
You should create the following folder /var/www/html/pterodactyl/storage/logs/ then change the permission so Apache or Nginx can write to that folder.

Laravel 5.0: Migration Refresh Error

I am an absolute beginner of laravel.
I would like to make some changes in my database. but when I try to refresh my databases, I keep dealing with the error below.
Before making this post, I googled so much and read many references. However, none of that worked and helped me solve the error.
Has anyone encountered this error before? Any advice would be appreciated. Thanks in advance.
PHP Fatal error: Uncaught exception 'UnexpectedValueException' with message 'The stream or file "/web/journal/storage/logs/laravel-2016-04-03.log" could not be opened: failed to open stream: Permission denied' in /web/journal/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:87 Stack trace: #0 /web/journal/vendor/monolog/monolog/src/Monolog/Handler/RotatingFileHandler.php(88): Monolog\Handler\StreamHandler->write(Array) #1 /web/journal/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php(37): Monolog\Handler\RotatingFileHandler->write(Array)#2 /web/journal/vendor/monolog/monolog/src/Monolog/Logger.php(336): Monolog\Handler\AbstractProcessingHandler->handle(Array)#3 /web/journal/vendor/monolog/monolog/src/Monolog/Logger.php(615): Monolog\Logger->addRecord(400, 'exception 'Unex...', Array)#4 /web/journal/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(47): Monolog\Logger->error('exception 'Unex...')#5 /web/journal/app/Exceptions/Handler.php(27): Illuminate\Foundation\ in /web/journal/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php on line 87 PHP Fatal error: Uncaught exception 'UnexpectedValueException' with message 'The stream or file "/web/journal/storage/logs/laravel-2016-04-03.log" could not be opened: failed to open stream: Permission denied' in /web/journal/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:87Stack trace: #0 /web/journal/vendor/monolog/monolog/src/Monolog/Handler/RotatingFileHandler.php(88): Monolog\Handler\StreamHandler->write(Array) #1 /web/journal/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php(37): Monolog\Handler\RotatingFileHandler->write(Array)#2 /web/journal/vendor/monolog/monolog/src/Monolog/Logger.php(336): Monolog\Handler\AbstractProcessingHandler->handle(Array)#3 /web/journal/vendor/monolog/monolog/src/Monolog/Logger.php(615): Monolog\Logger->addRecord(400, 'exception 'Symf...', Array) #4 /web/journal/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(47): Monolog\Logger->error('exception 'Symf...')#5 /web/journal/app/Exceptions/Handler.php(27): Illuminate\Foundation\ in /web/journal/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php on line 87
run
composer dump-autoload
inside project, before running artisan
Add www-data group and write permission to the folder /storage/logs/. error is about writing permission of the log file. need to change permission of /storage/logs/. then only the real error will be seen
sudo chmod -R 777 storage
would help change permission

how to give permission to web server in windows 7 to write to a network folder

so my script is running in my localhost(pc1) and i am trying to save an excel file using phpexcel in a network folder (\\pc2\c$\myfolder) but it gives me an error saying that i dont have permission in that particular folder eventhough i have a full access. I can manually create, edit or deleta a file in that folder.
error msg:
Warning: fopen(\\pc2\c$\myfolder\12122014.xls) [function.fopen]: failed to open stream: Permission denied in C:\wamp\www\receivables\PHPExcel\Shared\OLE\PPS\Root.php on line 90
Fatal error: Uncaught exception 'PHPExcel_Writer_Exception' with message 'Can't open \\pc2\c$\myfolder\12122014.xls. It may be in use or protected.' in C:\wamp\www\receivables\PHPExcel\Shared\OLE\PPS\Root.php:93 Stack trace: #0 C:\wamp\www\receivables\PHPExcel\Writer\Excel5.php(226): PHPExcel_Shared_OLE_PPS_Root->save('\\ipcsvs001\c...') #1 C:\wamp\www\receivables\index.php(241): PHPExcel_Writer_Excel5->save('\\ipcsvs001\c...') #2 {main} thrown in C:\wamp\www\receivables\PHPExcel\Shared\OLE\PPS\Root.php on line 93
note: i am using wamp server(not sure if this matters)

Trouble getting cakephp 2.4.0 running - fatal errors when attempting to complete tutorial

I am trying to follow the instructions for the cakephp tutorial found here: http://book.cakephp.org/2.0/en/getting-started.html
I uploaded the CakePHP files to my webserver, created the database using MySQL workbench, and created database.php and updated it to point to my MySQL server.
At this point it sounds like I should be able to open up the website in my browser and see something, but instead I get these errors (I have removed the full path):
Warning: _cake_core_ cache was unable to write 'cake_dev_en-us' to File cache in /caketut/lib/Cake/Cache/Cache.php on line 325
Warning: caketut/app/tmp/cache/persistent/ is not writable in /www/premium/med/pediatrics/www.hobmt.umn.edu/htdocs/caketut/lib/Cake/Cache/Engine/FileEngine.php on line 380
Fatal error: Uncaught exception 'CacheException' with message 'Cache engine _cake_core_ is not properly configured.' in /caketut/lib/Cake/Cache/Cache.php:181
Stack trace:
#0 /caketut/lib/Cake/Cache/Cache.php(151): Cache::_buildEngine('_cake_core_')
#1 /caketut/app/Config/core.php(367): Cache::config('_cake_core_', Array)
#2 /caketut/lib/Cake/Core/Configure.php(72): include('/www/premium/me...')
#3 /caketut/lib/Cake/bootstrap.php(177): Configure::bootstrap(true)
#4 /caketut/app/webroot/index.php(92): include('/www/premium/me...')
#5 {main} thrown in /caketut/lib/Cake/Cache/Cache.php on line 181
I tried setting the permissions for the Cache folder located in /caketut/lib/Cake and all subfolders/files to be 0776, and this removes all errors except this one:
Fatal error: Class 'Cache' not found in /caketut/app/Config/core.php on line 361
I tried doing searches but was unsuccessful in finding a solution. I would really appreciate any assistance!
try to chmod the whole script with 0777 permissions .
sudo chmod -R 0777 caketut

Categories