Issue unlink with Drupal 9.0.3 - php

I'm new here, i have a problem with Drupal 9.0.3 and I'm not that much of a Drupal expert either.
The problem is this: after i do "drush cache-rebuild", this happen
[warning] unlink(/bitnami/drupal/sites/default/files/css/css_GBUUzqz5ceINiDlSQ1o7Z8ZvirKTZAlcfXIJ2cvHW6Q.css.gz): Permission denied FileSystem.php:124In FileSystem.php line 324: Failed to unlink file 'public://css/css_GBUUzqz5ceINiDlSQ1o7Z8ZvirKTZAlcf XIJ2cvHW6Q.css.gz'.
I also tried to play a bit with the permissions but nothing happens. I honestly don't know which module or modification of the last ones will have led to this sudden error. Thank you for all kinds of support.

You got that warning because the user you are logged in does not have write permission on the folder /bitnami/drupal/sites/default/files/css/. So, drush (running as that user) cannot delete the aggregated css files while rebuilding the cache.
To solve this, you need to set the permissions of that folder to 775 and make sure that the user you are logged in with belongs to the group-owner of it.

I solved with sudo drush cache-rebuild
However, thanks equally to both you guys.

Related

"failed to open stream: Permission denied" after 777 my entire app

I'm growing several grey hairs trying to work this one out.
All of a sudden in my Laravel project, I can't upload any files to my symlinked public/storage directly as it's complaining about permissions.
I then 777'ed every single file in the app (I know, I know), and it's still complaining about permissions. I've also run composer dump-autoload, which never seems to do anything but I thought I'd give it a go anyway.
Does anyone know what else I can try? I can verify everything is 777, so I can't see why any permissions would fail...
Gah, sorry guys, this was a bit of a red herring.
777'ing everything wasn't working because the uploaded files were being set to 644 (so my manual 777 was only being applied to files that already existed)
For future reference, if anyone's using Laravel and a queued job can't access a 644 file, set the file to 664 immediately after upload (apache owns the uploaded file, but www-data (or ec2-user) is the one trying to access when queued).
SE Linux might be a possible culprit, because the policies change in some cases, eg. when there are broken modules, it will mess up. that would be setsebool -P httpd_read_user_content 1 (if this should throw an error, manually deleting the broken modules is the only thing that helps).

XAMPP - phpMyAdmin error session_start() Permission denied (13)

I recently upgraded my Macbook's OS to El Capitan. I set up XAMPP just like i did on my old OS. I am trying to create a Database using phpMyAdmin But all i am getting is this error:
Warning in ./libraries/session.inc.php#101
session_start():
open(/var/folders/w3/w7pdy78x5r57wmgcytwvh16r0000gn/T/sess_t4t8i795i8d67a52b785rr0j86isrn8c,
O_RDWR) failed: Permission denied (13)
Backtrace
./libraries/session.inc.php#101: session_start()
./libraries/common.inc.php#350: require(./libraries/session.inc.php)
./server_databases.php#12: require_once(./libraries/common.inc.php)
I thought it was a permissions issue so i changed all the XAMPP folders to read and write for all but still getting the same error. I have never been faced with this error before and my phpMyAdmin worked fine on my old OS. I have seen similar questions posted on here but none of the answers for them are working for me. Dose anyone know what it could be? Is this a problem within XAMPP/Apache or is this coming from the browser maybe? Im so lost with it and all out of ideas!
UPDATE
I don't know if this helps but i just checked my PHP info settings for session.save_path and it says "NO VALUE" is that suppose to be like that?
I had this problem even with correct folder permissions.
I solved it deleting the session files that were in the folder
After spending all night trying to figure out the problem i finally found the solution. I copied the location of the TMPDIR.
Then used this in the Terminal:
sudo chmod 777 /paste/TMPDIR/location/here/...
And then restart XAMPP and should be all good from there. I hope this helps :)
go to your phpinfo() then find your "session.save_path" value
use your terminal locate to that path then try type "ls" to list file
delete all file named start with sess_* (in my case I deleted "rm sess_c4ac83103bb5d8a77352a7cc4c9036eb") and then try refresh phpmyadmin again.
it's works for me., hope it helps.
I had same issue in my MAC OX and XAMPP.
To solve issue try to remove session files from location reported in error message. MAC users: /Application/XAMPP/xampfiles/temp/(whatever the session id is - it will be in error message and you will find file with the same name)
Additionally open terminal in the location of /temp folder and change access:
chmod -R o+w
In case you added vhost it might be in conflict with settings (user daemon, group daemon in htdocs.conf in case you changed user as an vhost change in your XAMPP recommended for MAC users to avoid 403 access denied issue for MAC OX users using XAMPP).
in case you have relocated folders in XAMPP/htdocs/ your session will contain same id but will have wrong location and needs to be removed manually as location of your project was while session was active. Go in folder reported in error message and delete session files.
This worked for me, hopefully will save you some time.

PHP Composer failed to open stream - Permission Denied

I've come across a strange issue with regards to the use of composer in my current PHP project.
Some of the answers on S.O that relate to this issue have been helpful, in the sense that changing folder permissions to 0755 on the root composer folder as well as subsequent sub folders and files, resolves the issue; however this seems to be temporary.
My PHP script breaks at the line where I require("vendor/autoload.php"). It then only resolves when I change the folder and file permissions to 0755; but every new day I find that the issue persists, then I have to set the permissions again. It's as if the permissions on the folders and files reset at irregular intervals.
Intitially I thought this could be an auto-update issue, however from what I've researched, composer does not auto-update itself by default unless manually doing so.
Your assistance will be greatly appreciated. I'm dumbfounded as to why this happens.

Can't mkdir or open files on server, even with 777 permissions

I see that similar questions have been answered on Stack Overflow, but the solutions haven't fixed my particular problem, so I have to ask...
I have an app that needs to make directories and modify files outside the site directory. This works find on the production server.
After spinning up a test server with the exact same version of Ubuntu and PHP, I'm getting errors on the staging server when it tries to open files or create directories.
Here are the errors:
mkdir() [http://php.net/function.mkdir]: Permission denied
fopen(/root/Dropbox/Backend/Booth-01/settings.sh) [http://php.net/function.fopen]: failed to open stream: Permission denied
Things I have tried:
checking the username running the application (it's www-data)
changing the owner of the external directory recursively to www-data
changing permissions on the directory to 777 (I know, this is a bad idea, but I was just trying it to see if that would help until I figured out what the issue was and will change the permissions to something more restrictive once I get it working)
checking the umask value. It was set to 0002, which shouldn't give me problems. Just for kicks, I tried changing it to 0000 and it didn't help.
checking to make sure PHP's safe mode wasn't enabled.
checking to make sure that nothing was specified in open_basedir. In any case, if that was the issue, it would throw a different error message.
I can't think of what to try next and I'm hoping that someone else is seeing something that I'm not.
Ubuntu 12.04.5 x64
PHP 5.3.10
It's not only the folder itself you have to have permissions on. You should also check the parent folders. I think, if you check this, this will fix your problem.
If this is an external drive (see if it shows up in mount) then you may have to remount it. An auto-mounted external drive can thwart permissions
sudo umount <moint-point>
sudo mount /dev/<device> <new-moint-point>

PHP Permission Denied Errors

I'm trying to troubleshoot this error, but I have had no luck.
Warning: mkdir() [function.mkdir]: Permission denied in Users/myuser/Sites/mysite.me/git/framework/libs/smarty/sysplugins/smarty_internal_write_file.php
I keep getting the mkdir() [function.mkdir]: permission denied error in one particular folder. I have made sure to chmod 777 foldername through linux and it still hasn't worked. I am doing this on a local machine through XAMPP. I've also made sure to make sure it is read and write for everyone from a GUI standpoint. I'm still having no luck. Thoughts?
I'm getting a warning for mkdir, chmod, touch, rename, and include.
For anybody who ends up here from there:
https://stackoverflow.com/questions/12801733/php-upload-outside-web-root-permission-denied-to-mkdir was marked as an exact duplicate of this thread. That thread was also cross-posted to the AWS forums where it received an answer.
That said, the accepted answer here is actually wrong. (Maybe not wrong wrong, but still somewhat wrong.) The better way to approach this is to have the owner/group of the Apache process match the owner/group of the directory that you want Apache (and in-turn, PHP) to be able to write to.
This way, you're granting access to specific, managed users instead of opening up your file system permissions too broadly.
Add write permissions for all users (or at least webserver user eg. www-data for apache) in which mkdir is creating the directory.

Categories