Fixing the “Unpacking the package… Could not create directory.” Error in WordPress

Many WordPress users who are using a dedicated or VPS server or are setting up WordPress manually on your hosting provider in Linux or OSX get stuck with plugin installs. WordPress plugin and theme upgrades fail with the error “Unpacking the package… Could not create directory.”. This is mostly due to incorrect permissions and can be fixed easily.

Could not create directory WordPress

To fix this, you need to change the permissions on your plugins and upgrade folder.

The plugins directory is located in <WORDPRESS ROOT>/wp-content/plugins and the upgrade directory is in the same/wp-content/upgrade folder.

You need to change the permissions of both these permissions to 777. You can do this using the following commands from the command line (assuming that you are in the WORDPRESS_ROOT folder):

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

Once done, you should be able to install your plugins and upgrade your plugins and themes successfully.

In case you are using a graphical tool to set permissions, you need to set permissions of the plugins and upgrade folders to Read, Write, Execute for user group and world (all users).

Pro Tip: Some plugins like W3 Total Cache require access to other files and folders. In my case, it was needed to create two folders in the wp-content directory and make changes to the wp-config.php and .htaccess files. In this case, you should temporarily change the permissions of the folders where the plugin is trying to create and modify files to 777 using the same commands above.

Pro Tip: Install the plugin but remember to change the permissions back to their original value as changing permissions of critical WordPress files to 777 may expose your site to security risks and leave it vulnerable to hackers. 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. The commands just to give the group members write permissions are:

# cd wp-content
# chmod g+w plugins
# chmod g+w upgrade
# chmod g+w themes

Let us know if you found this article useful using the comments below and whether it helped you resolve the “Unpacking the package… Could not create directory.” error in WordPress.

Leave a Reply

Your email address will not be published. Required fields are marked *

CommentLuv badge