我在Linode
下的主機運行的是Ubuntu 16.04 + apache2
,在wordpress
更新時出現無法創建文件夾的錯誤。
而更改wp-content
的權限爲775
等辦法並沒有效果。注意:不要將你的文件夾權限改爲777
,因爲這樣一來會有很大的安全隱患。
這種情況下,我們需要將wordpress
文件夾所屬的用戶更換爲apache
所屬用戶:
$ sudo chown -R www-data /var/www/path-to-your-wordpress-root
請將path-to-your-wordpress-root
替換爲你的wp
根目錄地址,運行命令。這樣一來再更新,就不會出錯了。
以上解決方案根據
https://www.tipsandtricks-hq.com/how-to-fix-the-unable-to-create-directory-error-in-wordpress-5264
實驗所得
The webserver (Apache) runs as user www-data and group www-data by
default on a Ubuntu system. If the files/folders are not owned by this
user (www-data) then the webserver will be unable to write changes to
them.Change the filesystem permission on the folder (where the web
application wants to write to) to the “parent directory” as mentioned
in the error message.For example, do (prepend with sudo if you’re not the current owner and need to elevate your own permissions in order to do it):
chown www-data /path/to/directory
to make www-data the owner which makes it writeable usually, or another approach via groups:
> chgrp www-data /path/to/directory
> chmod g+w /path/to/directory