laravel 5.1 file_put_contents wrong path - php

So I am using laravel 5.1 on ubuntu with nginx and php-fpm, I am having a little issue with my sessions. I have done all the permissions (chown to nginx/php user and group and chmod 777 on storage) however I think there is another issue.
The session file is created as I can see it on the server however when laravel is trying to write to it I don't think it can find the file see bellow:
at HandleExceptions->handleError('2', 'file_put_contents(/54dc94489b4c137d744f0427ce2c7e5e): failed to open stream: Permission denied',
Is there an issue with laravel finding the session path ? I am not really sure what to do, I have edited the filtsystem class and hard coded the path to the session directory however that isn't the correct solution.

I had to create 'storage/framework/views'

Related

Unable to change storage/framework permissions

I honestly don't know what I am doing wrong. I have been trying to work on the business logic of a Laravel application I am working on, but now I want to see my views in a browser, and no matter what I do I get an exception relating to the file permissions of storage/framework. The latest one is
file_put_contents(/home/vagrant/Code/bitpaigow/storage/framework/sessions/VMdtCxzQwaGVremFgwFzj9HnNRkvKuDOMzUsWrXP): failed to open stream: No such file or directory
I have so far tried two different servers: Homestead and Laravel's serve command. What I understand is the problem now is my permissions. Homestead, hoping to allow access to those directories from my Laravel app, however, no matter what I do I always run into an error relating to these folders having the wrong permissions.
I have tried chmod 777 storage/framework but I still get the same error. Any help would be great. Thanks.

Laravel 5.4 laravel.log permission issue

I have Laravel 5.4 installed on my Mac using Composer and MAMP Pro. The installation completed successfully, but when I try to load localhost/lsapp/public, an UnexpectedValueException error is returned. I have checked the file permissions for the storage and logs directories and both are set to 755 using the command line. It seems the log file cannot be written for some reason. Any suggestions?
Full permission denied message: The stream or file "/Applications/MAMP/htdocs/lsapp/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied
in StreamHandler.php (line 107)
When you go into a production environment, I'd recommend the following:
755 permissions for the /log
644 permission for the files inside
For example if you're using apache:
The user owner of the directory (www-data) can read, write and execute.
The assigned group (www-data, where my user is) can read and execute, but not write.
Everyone else can read and execute, but not write.
I just faced the same issue with my installation. Here's what I did to solve it:
Make sure that www-data (or your web server's user) is either the owner or group's owner of the logs directory.
Then make sure that this user have read-write-execute on that folder. On linux I used 770 for that folder. Then laravel is now working fine.
Hope that's help!

Symfony3 : Warning:copy([...]Entity/User.php~): Permission denied

The exact error is the following
[Symfony\Component\Debug\Exception\ContextErrorException] Warning:copy(/Applications/MAMP/htdocs/Project/src/MR/UserBundle/Entity/User.php~): failed to open stream: Permission denied
on my Symfony3 command :
'php bin/console doctrine:generate:entities'
Does anyone ever had this warning ? or see what may cause the problem ?
I don't know if it's related to that, but I made a terrible mistake this morning, 'rm'ving my User directory (on OS X) with -R option.. a nightmare. I had to reinstall mysql, and did the same with MAMP. My symfony project was intact because of its location in the 'htdocs' directory.
I had the same problem with my var/ directory but solved it with this tutorial from the official website.
Hoping for a solve, because I cannot work on the project now..
Thanks in advance !
When Symfony generates entities, it makes a backup, and in your case the file it is backing up is called 'User.php~'. So for some reason when you run the command:
php bin/console doctrine:generate:entities
It doesn't have permission to write to that particular folder. Maybe do you have to use sudo? Or maybe you have to login as a different user? Regardless, it's a permission problem of writing the backup file.
By the way, the new file would be 'User.php', and the backup once the command completes is renamed 'User.php~'.
Hope this helps.

Laravel 5.2 : file_put_contents (xxxxxxxxxxxxxxx.php) failed to open stream: Permission denied

I have installed fresh Xampp, And set the virtual host, When i accessed the site, The following error came up.
file_put_contents(/b237142d7ac388af2fe193a8361f611a83409dff.php): failed to open stream: Permission denied.
I searched for the issue, Folk says that its /storage permission issue i have changed the permission to sudo chmod -R 777 /site-name/storage.
But the issue still remains.
Am i missing something ?
In the storage folder,app, framework folders were missing, By adding them the issue is gone and now things are working like a charm.
I had the same problem with a Laravel 5.2 project. I already had the folders app and framework in storage folder. Then I found that in framework folder you need to have three folders: cache, views and sessions-- and make sure storage folder has the write permission.
This answer helped to solve the problem finally.

Laravel Permissions

I did an installation of laravel, and copied the files to a xampp hosted folder on the same machine. When I try to visit my index.php file however, I'm getting the following error:
Error in exception handler: The stream or file "/Applications/XAMPP/xamppfiles/htdocs/TestManagement/app/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied in /Applications/XAMPP/xamppfiles/htdocs/TestManagement/bootstrap/compiled.php:8969
I'm always a bit hesitant about changing permissions, as I've done some pretty bad chmodding before. Was wondering if there was a rule of thumb or expected behavior for this. Should this be 777 or 755?
The Laravel and Monolog documentation appear to contain no reference to the 'right' permissions. You can make it work with restrictive permissions, but be aware of all of the users that need access:
the web server user
cron user (if you run artisan commands via cron)
anyone who manually runs artisan commands.
They will each need read/write permissions to the log files.
Always use 777 on app/storage folder

Categories