【问题标题】:Unpacking the package… Could not create directory. Wordpress, Apache2, Ubuntu解压包... 无法创建目录。 WordPress、Apache2、Ubuntu
【发布时间】:2015-03-03 12:48:41
【问题描述】:

这个问题可能无处不在,但我已经尝试了大多数答案和许可 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

【问题讨论】:

    标签: wordpress permissions lamp ubuntu-14.04


    【解决方案1】:

    您需要授予相关目录的写入权限。理想情况下,您应该只对相关文件或文件夹执行此操作然后将权限恢复,以免您的网站易受攻击

    您可以在命令行中使用以下命令修复此问题(假设您位于 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/

    【讨论】:

    • 对我有用,我正在尝试上传插件
    【解决方案2】:

    更新在站点目录内的 wp-content/update 中创建一个目录。 Linux 不会自动将子目录的权限设置为父目录的权限。因此 wp-content/upload 不一定有 777 权限。

    尝试将 wp-content/update 的权限更改为 777。如果可行,则意味着 WordPress 文件夹的所有者不是尝试更新站点的用户。

    对我有用的是将我的 ftp 客户端添加到 WordPress 进程所有者的组中。 (How do I know which linux user Wordpress uses for plugin installation) 找到所有者。然后将站点目录中的所有目录权限设置为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/
    猜你喜欢
    • 2013-12-20
    • 1970-01-01
    • 2019-02-12
    • 1970-01-01
    • 2016-09-06
    • 1970-01-01
    • 2013-05-07
    • 2014-03-14
    • 2017-07-10
    相关资源
    最近更新 更多