Laravel New Project - Permission Denied - laravel

I am trying to setup a new Laravel site and I am running into an issue I have never had such problems with before. When loading up my site, I get the error:
The stream or file "/var/www/html/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied
I have edited the file permissions to 775. I don't know what else to do!

Try changing the owner of the folder:
chown -R apache:apache /var/www/html/

you should change your project folder permission

The stream or file "/var/www/html/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied
This error basically happens when in your project absent ../storage/logs folder. Firstly you must be check this folder exists in your project. If does not exist this folder add it and inside it .gitignore file.
/storage/logs/.gitignore
*
!.gitignore

Related

Storage Cache creates files with different owner/groups?

I am using Laravel and it works well. After updating one blade file on my local pc and deployed it with git, Laravel can't open that particular blade anymore.
file_put_contents(/var/www/vhosts/***/httpdocs/memberportal/storage/framework/views/8274d2f145c8a134eb15ccbb69c2df396814d64e.php):
failed to open stream: Permission denied (View: /var/www/vhosts/***/httpdocs/memberportal/resources/views/emails/newsletter/2019-04-2/translations/advertise/en.blade.php)
at /var/www/vhosts/***/httpdocs/memberportal/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php:122,
ErrorException(code: 0): file_put_contents(/var/www/vhosts/***/httpdocs/memberportal/storage/framework/views/8274d2f145c8a134eb15ccbb69c2df396814d64e.php):
failed to open stream: Permission denied at /var/www/vhosts/***/httpdocs/memberportal/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php:122)
The folder permission and owner of the storage folder and en.blade.php are correct. However, I noticed that the owner/group of the files in the cache are different.
All caches files with owner root:root are not accessible. Any ideas why Laravel changes the ownership of cache files on my production server, when deploying with git? The storage files are ignored by git, so I do not understand how this happens.
Any advice?

Files system problems

Did clean installation of ddev on my Mac.
Set up Drupal 8 project and have problems with file permissions on sites/default/files folder. For some reason it resets the permissions I set (chmod -R a+w) and web server can't write to this folder afterwards.
Files are owned by uid_1000 gid_50.
Example of the message
Warning: file_put_contents(sites/default/files/php/twig/5c1ad9b345ce5_status-messages.html.twig_3IhisVoQLOYIb64NBegMDuHJs/.htaccess): failed to open stream: Permission denied in Drupal\Component\PhpStorage\FileStorage->ensureDirectory() (line 123 of core/lib/Drupal/Component/PhpStorage/FileStorage.php).

How to solve laravel file_input_error

When I log in, this error show ->
i already give permission to src/storage
file_put_contents(/var/www/html/catalog/src/storage/framework/cache/55/f9/55f98a9ae16c0c5f7c41c2f6d5435d3f37274a71): failed to open stream: No such file or directory
Create cache directory in storage directory, and give him read & write permission to it. Error saying that your cache directory does not exists

Persistent Permission Denied Error

I have seen a few posts on this (and tried the recommended solutions) but they are regarding Laravel 4 - And I am on Laravel 5.
For example;
'Failed to open stream: Permission denied' error - Laravel
I get the Command "dump-autoload" is not defined error and the reason for that is explained here;
http://laravel.io/forum/12-08-2014-command-dump-autoload-is-not-defined
In the above post, composer dump-autoload was suggested. I tried it, and again this morning the same error is back;
ErrorException in Filesystem.php line
74:file_put_contents(/vagrant/source/laravel- excel/storage/
framework/sessions/8338f386fc3de7bdc8d1b6dc7ee6790f71516d98): failed
to open stream: Permission denied`
Any suggestions?
Also, try the above comments and do a
composer self update
You Have to set the permission to Read & Write
In Mac We do this by using
**sudo chmod -R o+w storage**
Storage is the name of file U want to change permission
And currently my terminal is in the same folder where my storage folder is present therefore I did not specify its address

file_put_contents errors in Joomla

I have a Joomla 1.5.20 site and I am not able to upload & update any file in it. The website is running on a Windows Webserver.
Warning: file_put_contents(D:\inetpub\vhosts\hidden\httpdocs\v1\administrator\cache/da4f9e501a6359708d714f016ef2d500.spc) [function.file-put-contents]: failed to open stream: Permission denied in D:\inetpub\vhosts\hidden.tld\httpdocs\v1\libraries\simplepie\simplepie.php on line 8666
Warning: D:\inetpub\vhosts\hidden.tld\httpdocs\v1\administrator\cache/da4f9e501a6359708d714f016ef2d500.spc is not writeable in D:\inetpub\vhosts\hidden.tld\httpdocs\v1\libraries\simplepie\simplepie.php on line 1779
Warning: file_put_contents(D:\inetpub\vhosts\hidden.tld\httpdocs\v1\administrator\cache/da4f9e501a6359708d714f016ef2d500.spc) [function.file-put-contents]: failed to open stream: Permission denied in D:\inetpub\vhosts\hidden.tld\httpdocs\v1\libraries\simplepie\simplepie.php on line 8666
Warning: D:\inetpub\vhosts\hidden.tld\httpdocs\v1\administrator\cache/da4f9e501a6359708d714f016ef2d500.spc is not writeable in D:\inetpub\vhosts\hidden.tld\httpdocs\v1\libraries\simplepie\simplepie.php on line 1779
I have tried deleting and recreating cache folder. Since it is a windows webserver I don't it a permission issue. Please advise me on how to fix it. Thanks!
You need to check your folder permissions:
Login to Administrator panel
Select Help > System info from top menu
Select tab Directory Permissions, all folders listed here need to have 'Writable' permissions.
If any of those folders are Unwritable, login to your server with ftp client, or cPanel, and change folder's CHMOD permissions to 755

Resources