Installation failed: Could not create directory – WordPress Plugins Themes and Updates


Whenever trying to install a plugin or updating a theme, you may see this error message;

Installation failed: Could not create directory.

or

Update failed: Could not create directory.

Here’s how to fix it;

Use SSH client i.e. Putty or any FTP software i.e. CoreFTP to remove “plugins” folder in the wp-content directory;

First remove “plugins” folder in the “wp-content” directory;

Afterwards create the “plugins” folder in the same “wp-content” directory;

Refresh your browser and try to install or update themes or plugins. It should work.

Similarly, remove and create the “uploads” directory in the “wp-content” folder.

Via SSH commands

First of all, losen up your wordpress installation while setting up;

chown www-data:www-data -R *
find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {}

When done setting it up, issue these commands to secure it back;

chown admin:admin -R *
chown www-data:www-data wp-content

Modify wp-config.php file

Add this code in the wp-config.php if your WordPress installation requires FTP access;

define(‘FS_METHOD’,’direct’);

In the wp-config.php file, add this line;

define( ‘UPLOADS’, ‘wp-content/uploads’ );

before this line;

require_once(ABSPATH . ‘wp-settings.php’);

or add these credentials;

define(‘FS_CHMOD_FILE’, 0755);
define(‘FS_CHMOD_DIR’, 0755);
define(‘FS_METHOD’, ‘ftpext’);
define(‘FTP_BASE’, ‘/httpdocs/’);
define(‘FTP_CONTENT_DIR’, ‘/httpdocs/wp-content/’);
define(‘FTP_PLUGIN_DIR ‘, ‘/httpdocs/wp-content/plugins/’);
define(‘FTP_USER’, ‘username’);
define(‘FTP_PASS’, ‘password’);
define(‘FTP_HOST’, ‘123.456.789’);
define(‘FTP_SSL’, false);

Courtesy:

https://stackoverflow.com/questions/18352682/correct-file-permissions-for-wordpress

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s