Fix: Unable To Locate WordPress Plugin Directory / Could not create directory / Installation Failed

If you own a wordpress blog chances are at some point or another you will have seen at least one of the following error messages:

‘Could not create directory. /web/wordpress/wp-content/plugins/’
‘Unable To Locate WordPress Plug-in Directory’
‘Installation Failed’

This occurs when attempting to install a new theme, plugin or update your wordpress installation with the latest release. This error usually follows a prompt asking you to enter your ‘Connection Information. To perform the requested action, connection information is required.’

The following simple steps will not only ensure you never see the above error messages again, but also remove the requirement to enter connection information altogether. Now won’t that make life so much easier? Being able to use the wordpress control panel as intended.

All you need to do is edit your wp-config.php.

1. FTP into your web server, and take a copy of your wp-config.php so you can modify it. (Always remember to take a backup!)
2. Open wp-config.php in your editor of choice (wordpad, notepad++, vim, nano)
3. Somewhere near the end you will find the following code

/* That's all, stop editing! Happy blogging. */

/** WordPress absolute path to the WordPress directory. */
if ( !defined('ABSPATH') )
define('ABSPATH', dirname(__FILE__) . '/');

/** Sets up WordPress vars and included files. */
require_once(ABSPATH . 'wp-settings.php');

4. Now insert the following code below

if(is_admin()) {
add_filter('filesystem_method', create_function('$a', 'return "direct";' ));
define( 'FS_CHMOD_DIR', 0751 );
}

5. Save the changes, and upload to your web-server replacing your existing wp-config.php (Have you taken a backup?)

That’s it, now try installing or updating a plug-in from the wordpress control panel. You should no longer be prompted to enter the credentials as before, and you shouldn’t have any complaints about not being able to find the directory.

In case you were wondering, the reason you see these messages is because wordpress needs to make changes directly to the file system whenever it updates plugins, installation files or themes. If it doesn’t have the required permissions by default it will prompt you to enter them manually. More often that not the host file system has different read/write permissions than that of your wordpress user account.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s