Can’t install new plugins because of the error “Could not create directory”

@pwnguin,

I had the same problems running mod_php with WordPress and I finally figured it out.

# chown www-data:www-data  /home/CIM140/public_html/wordpress/ -R

As long as YOU control the box this won’t cause any security issues.


EDIT:

You might also need to change your umask to 022 so new directories created by WordPress will have 755 permissions and files will have 644 permissions.

Another option is to override default file permissions in wp-config.php:

define('FS_CHMOD_DIR', (0755 & ~ umask()));
define('FS_CHMOD_FILE', (0644 & ~ umask()));

You can also force the filesystem method for updates.

  • (Primary Preference) “Direct” forces it to use Direct File I/O requests from within PHP, this is fraught with opening up security issues on poorly configured hosts, This is chosen automatically when appropriate.
  • (Secondary Preference) “ssh” is to force the usage of the SSH PHP Extension.
  • (3rd Preference) “ftpext” is to force the usage of the FTP PHP Extension for FTP Access, and finally
  • (4th Preference) “ftpsockets” utilises the PHP Sockets Class for FTP Access.

These can be defined in wp-config.php with: define('FS_METHOD', 'ftpext');

You can get all the currently defined constants by executing the print_r(@get_defined_constants()); command in php.

Leave a Comment