简体   繁体   中英

Unpacking the package… Could not create directory. Wordpress, Apache2, Ubuntu

This question could be all around but I have tried most answers and permission 777. But, still no luck.

/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

I set permission 777 to /usr/share/wordpress and /var/lib/wordpress .

The update creates a directory in wp-content/update inside the site directory. Linux does not set permissions automatically of child directories to those of the parent. Therefore wp-content/upload will not necessarily have 777 permissions.

Try change permissions of wp-content/update to 777. If this works it means that the owner of the WordPress folders is not the the user trying to update the site.

What worked for me was to add my ftp client to the group that the owner of the WordPress process. ( How do I know which linux user Wordpress uses for plugin installation ) to find the owner. and then set all directories to 775 permissions and files to 665 in the site directory.

chmod 775 $(find -type d)
chmod 665 $(find -type f)

You need to give write permissions to the relevant directories. Ideally, you should do it only for the relevant file or folder and then revert the permissions back so as to not leave your site vulnerable .

You can fix this using the following commands from the command line (assuming that you are in the WordPress root folder):

# cd wp-content
# chmod -R a+w plugins
# chmod -R a+w themes
# chmod -R a+w upgrade

The safest solution is to add Apache to the same group as the owner of the WordPress installation and change all group permissions to writeable.

A more detailed solution can be found at: http://techzog.com/wordpress/fixing-unpacking-package-could-not-create-directory-error-wordpress/

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