简体   繁体   中英

Drupal 7 file system error: The directory sites/default/files exists but is not writable and could not be made writable

I'm copying a Drupal 7 installation from one machine to another. Both machines are Mac OSX running current versions of MAMP. Procedure as follows:

  1. create sql dump file
  2. rsync -ar path/to/source path/to/destination
  3. chmod -R 755 destination/sites/default/files
  4. chown -R username destination
  5. import sql dumpfile
  6. adjust settings.php (actually, they remain the same across environments, but just checking db connect info and $base_url.)

Everything works here, on the destination side, except that the sites/default/files directory can not be made writable[sic]. Something in the directory tree and/or permissions is changing, but I can't figure out what/how. What gives?

sites/default/files needs to be writable by the web user, or writable by all users.

all users:

chmod -R a+w destination/sites/default/files

or, make apache (or whoever your web user is) the owner

chown -R apache:apache destination/sites/default/files

Note: 755 and 777 sets everything as executable. 777 would have worked, it's just not proper. Executable permission is necessary for directories, but files generally should not be executable unless they need to be.

I personally prefer making apache the owner of the files directory and all the contents inside because that's what happens anyway when Drupal writes files.

可能你需要在目录上运行restorecon,例如:

restorecon -rv default/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM