解压软件包时出现问题:无法创建目录。 Wordpress、Apache2、Ubuntu

3

这个问题可能很普遍,但我已经尝试了大部分答案和权限777。但是,仍然没有运气。

/etc/apache2/sites-available/mysite.conf

<VirtualHost *:80>
        ServerName www.mysite.com
        ServerAdmin mymail@mail.com
        DocumentRoot /var/www/html/wordpress
        ErrorLog ${APACHE_LOG_DIR}/mysite_error.log
        CustomLog ${APACHE_LOG_DIR}/mysite.log combined 
</VirtualHost>

/etc/vsftpd.conf

listen=YES
anonymous_enable=NO
local_enable=YES
write_enable=YES
dirmessage_enable=YES
use_localtime=YES
xferlog_enable=YES
connect_from_port_20=YES
chroot_local_user=YES
secure_chroot_dir=/var/run/vsftpd/empty
pam_service_name=vsftpd
rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
allow_writeable_chroot=YES

我将权限设置为777,用于/usr/share/wordpress/var/lib/wordpress

2个回答

5
更新会在站点目录中的wp-content/update中创建一个目录。Linux不会自动将子目录的权限设置为父目录的权限。因此,wp-content/upload不一定具有777权限。
尝试将wp-content/update的权限更改为777。如果这样做有效,则意味着WordPress文件夹的所有者不是尝试更新站点的用户。
对我有效的方法是将我的ftp客户端添加到WordPress进程所有者所在的组中。 (如何知道WordPress用于插件安装的Linux用户) 找到所有者,然后在站点目录中将所有目录设置为775权限,将所有文件设置为665。
chmod 775 $(find -type d)
chmod 665 $(find -type f)

谢谢您的回答。但是,它并没有解决我的问题。/usr/share/wordpress/wp-content/uploads原本是软链接到/var/lib/wordpress/wp-content/uploads目录。我已经将其权限设置为777了。最终,我在/usr/share/wordpress/wp-content/themes目录中解压缩了主题,并将主题目录软链接到/var/lib/wordpress/wp-content/themes/ - Lwin Htoo Ko

4
你需要给相关目录赋予写入权限。理想情况下,你只需要为相关文件或文件夹授权,然后再将权限还原,以避免网站易受攻击。 你可以使用以下命令行命令来解决此问题(假设你在WordPress根文件夹中):
# cd wp-content
# chmod -R a+w plugins
# chmod -R a+w themes
# chmod -R a+w upgrade

最安全的解决方案是将Apache添加到与WordPress安装程序所有者相同的组中,并更改所有组权限为可写。
更详细的解决方案可以在此找到:http://techzog.com/wordpress/fixing-unpacking-package-could-not-create-directory-error-wordpress/

适用于我,我正在尝试上传一个插件。 - Pablo

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接