I have two sites on the same machine - demo and dev.

They are served from their respective home directories.

I've set up private files on both. All the settings seem to be exactly the same. However, on dev, private files work perfectly, but on demo, they don't. When you upload a file it gives no indication of error in the GUI, but when you try to access it you get a 404. The dblog says "The file permissions could not be set on private://2018-04/foo.txt." Searching for it on the command line shows that it has been saved to <webroot>/private:/2018-04/foo.txt instead of to /home/demo/private-files/2018-04/foo.txt.

Although, strangely, it does in fact create the subdirectory /home/demo/private-files/2018-04/ ! It just does not put the file in there.

On both sites the private file paths are set :

demo show settings dev show settings

And the permissions are exactly the same:

file perms

There is no difference between the .htaccess in either directory:

empty diff

What am I missing?

  • Do both websites' apache configurations set to use the same user and group. i.e. www-data:www-data or separate users like dev:www-data or dev:dev, etc. I presume the web server is apache, since you mentioned the .htaccess file. – osman Apr 27 '18 at 18:50
  • Yes. I had originally tried to run them as different users, using mpm-itk, but it never worked. I have now removed all references to different users and restarted apache, but it didn't help. Thanks though – naomi Apr 29 '18 at 6:53
  • Check the temp folder permissions and see whether you have hardcoded tmp folder path in settings.php – Razeem Ahmad Apr 29 '18 at 10:09
  • @Razeem, temp file is the default, /tmp for both which has 777 permissions. What is the relevance of this to private files anyway? – naomi May 11 '18 at 10:50

Your Answer

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

Browse other questions tagged or ask your own question.