Files system problems - ddev

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).

Related

Laravel Cache files losing permissions - Windows 10 IIS & Active Directory

My problem is that when I use caching in Laravel with file driver, I occassionally lose permissions to the cache file. Permissions are set properly, parent folder does not lose any permissions, only the specific cache file. After restarting the machine, permissions are back and I can delete the file manually.
The "permission" error is like:
file_put_contents(C:\inetpub\wwwroot\office_map_dev\storage\framework/cache/data/ca/0d/ca0d727b27eefcb8763203d9ad28f5a5eb29a85e): Failed to open stream: Permission denied

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?

Laravel New Project - Permission Denied

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

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

When I upload my CodeIgniter System to my Amazon EC2, why are all of my permissions messed up?

For some weird reason, my "system" folder has permissions of "000" when I upload it. This totally breaks CodeIgniter as I get all sorts of errors:
Message: CI_Config::include(/[mysite]/system/application/config/assetlibpro.php) [ci-config.include]: failed to open stream: Permission denied
I don't think this is an EC2-specific problem. If you fix the permissions using
chmod -R 755 /[mysite]/system
you should be OK (755 means read/write/execute for owner, read/execute for group and world)

Resources