2

How does Drupal check the write permissions on a folder in Linux?

I am using php5-fpm and the web server is working as the user that owns the Drupal directory and I expect that even with a 700 the directories should be readable and writeable by the PHP process and there should be errors only when nginx itself needs access to files or folders.

Does Drupal just test the file permissions for the other user, or does it attempt to read and write as the PHP process itself? It appears to work only when o+rwx is set on the sites/default/files folder but r-x alone should work.

Can anyone point me to the exact routines that make that check?

  • After some more checks I realized what had happened. I use nginx with php5-fpm and when reorganising the configurations I did some cutting and pasting that resulted in the port used for the problem domain being replaced by one assigned to a different user. After switching the file perms to o+w I saw that the created directories were owned by the other user and fixed the fpm files after that. – vfclists Sep 2 '12 at 1:07
3

You're probably looking for the file_prepare_directory() function:

Checks that the directory exists and is writable.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.