Jun 152017

ADM

Installation failed: Could not create directory in WordPress

  • June 15 2017
  • ADM

 

 

Installation failed: Could not create directory in WordPress - wordpress

 

Recently I got the following error when I tried to install a new WordPress plugin: "Installation failed: Could not create directory."

Installation failed: Could not create directory in WordPress - WorpressError01

There are two things that I've checked first:

1. Web Server Ownership

First, make sure that your web server user has ownership of the directories where WorldPress is installed.

If you don't know the username run the following command:

# ps aux | egrep '(apache|httpd)'

The command will list all the processes or the users with the name in the brackets ('apache' or 'httpd') that are currently running.

For my case:

Installation failed: Could not create directory in WordPress - WorpressError02

Next, to make sure that your web server user has ownership of the directories where WorldPress is installed, run the following command:

# chown -R apache /var/www/html/

2. Directory Permissions

Setup the right permission for the directories:

$ sudo find /var/www/html/ -type d -exec chmod 755 {} \;

Setup the right permission for the files:

$ sudo find /var/www/html/ -type f -exec chmod 644 {} \;

Note: there is a high possibility that doing just the directory permission will be enough.

Another possibility of getting the "Installation failed: Could not create directory." error is when the server is running out of space, common enough when the server is running on small VPS or a backup operation doesn't delete the old files.