How to fix “installation failed, could not create directory”

How to fix “installation failed, could not create directory”

The “Installation failed, could not create directory.” error message is a relatively standard error message that many WordPress users get. It often occurs when users try to use a new version of WordPress, try to upgrade WordPress plugins, or add and update themes. Why does it happen and how do you fix it?

This  happens due to an error during installation. The message tells us the installation was not successful due to WordPress being unable to create a new directory. Hence, we get the error message “Installation failed, could not create directory.”. It essentially means that the user might have missed a crucial step during installation.

Luckily, there are some things that you can do to fix the issue. You must know that when WordPress creates a new website, your files are stored in folders or directories, which the webserver creates. These folders can only be accessed if you give WordPress permission to do so; failure to do so might result in various error messages, such as the “Installation failed, could not create directory.”, or the “Failed to write to disk.” error message.

The error also happens if you exceed the quota limit of your server, or if the directory you are trying to reach is already full.

Learn below more about this topic in this article created by our team at wpDataTables.

The Web Server Must Own the Directories

The first step to getting rid of this error message is to ensure that your web server owns the directories where WordPress is installed.

To do this, you will have to enter some lines of code. The first line of code is used to access your username if you don’t know it.

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

This code will list all processes that are running, with the names of the user in the brackets. The next step would be to allow WordPress access(or ownership) of all the directories where WordPress is installed.

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

Option 1: Update Folder Permissions With cPanel

The permissions for folder usage depends on the rights that each user has. Within the web hosting server, each server will have permission to read, write and execute. These will depend on the permission levels based on user permissions.

For this option to work for you, you will need cPanel access and internet connection. Here are the steps that you should follow.

  • Login to your cPanel account.
  • Once logged in, search for “file manager” and open the first search option.
  • To view files of your website, open “public.html.”
  • Select all files under the root directory, right-click, and open “file permissions.”

  • Under the “permissions” button at the top of the page, click on the “change permissions” option.
  • Then, a dialog box will open. Under the numeric value field, enter the number “755”. Next, check the “Recurse into subdirectories.” checkbox and select the “Apply to directories only.” option. Click on OK and wait for the FTP client to finish the process. It might take some time.

NOTE: The 755 setting means the following things:

  • Read, write and execute for the owner, which can be you or anyone who logs in with your name.
  • Read and execute options for groups (mostly applicable to Linux, where users are organized in groups)
  • Read and execute permissions for the rest of the users (for example, readers of your website).
  1. The next step after the process is done, is to select all files under the root directory again and right-click, select “File permissions.”, and a dialog box will pop up.
  2. This time you will have to enter the number “644” under the numeric value field. Click on “Recurse into subdirectories.”, and select “Apply to files only.”
  3. Confirm the changes.
  4. Clear browser cache and try to install a plugin or a theme. Now, the “Installation failed, could not create directory.” error message should not occur again, and you should be able to install plugins and themes going forward.

Option 2: Configure FTP Permissions In The “wp-config.php” File

Another way to get rid of this error message, if the first option was unsuccessful, is to try to change the FTP permissions by configuring the “wp-config.php” file.

This option can fix the error message, as your server might not have permission to write new files. This is why the operation fails each time, and you can change it by configuring the “wp-config.php” file.

This process is quite simple. Here are the steps to fix the “Installation failed, could not create directory.” error.

  1. From your web hosting account, open the “File Manager”.
  2. Within the root folder, locate the “wp-config.php” file and open it.
  3. In your “wp-config.php” file, enter the following passage of code.

NOTE: Replace the information in brackets with your information.

define(‘FS_METHOD’, ‘ftpext’);
define(‘FTP_BASE’, ‘/pathtorootofyourblog/’);
define(‘FTP_USER’, ‘ftpusername’);
define(‘FTP_PASS’, ‘ftppassword’);
define(‘FTP_HOST’, ‘’);
define(‘FTP_SSL’, false);
  1. Save the “wp-config.php” file.
  2. Return to your dashboard and try to install the plugin or upgrade once again. This time, it should be done without any problems.

Other Possible Fixes

Although it seems unlikely, the error “Installation failed, could not create directory.” might be caused by insufficient disk space in your server. It is a common issue if you are using shared hosting.

Ensure you have enough space for the new files to be installed. Also, you should not store your backups in the same folder as your server, as you are risking your reserves with this method. Instead, use a cloud backup service like Dropbox.

Having sufficient disk space is the first prerequisite for new files to be installed. Given that disk sizes are bigger nowadays, this issue is often ignored. It will be an issue if, however, your disk space is small. You can check it as another option if the previous ones haven’t worked.

More About File Permissions

As mentioned above, several file systems use file permissions, and they allow files and folders to read, write, and execute processes. In the same way, WordPress gains access to your data for the website, and it needs permission to moderate files within the “wp-content” folder.

Servers use software for accessing and managing files. This software can access data for your website, which may be stored locally on your computer if the site is self-hosted, or it may be on another computer.

If you have a local server installed, then the issue of folder permission will likely occur. Usually, the permissions are handled by the hosting company. However, if this is the case, you will have to configure the permissions settings on your own to ensure the security of your files. This is why the “Installation failed, could not create directory.” error message frequently occurs.

Usually, a set of numbers dictates who can use which directories. Earlier, with the first option, numbers like 755 and 644 were used for handling permissions. These numbers tell the server what licenses are in place for specific files and folders. When installing plugins with WordPress, the server will need access to your folders. For this, they will need permission from your part.

These digits are not just random numbers, but are, in fact, a set of “instructions” that give permissions to the server. The first digit tells the software what the user of the account can do with the files, the second specifies what the group can do, and the third tells us what everyone else can do.

Managing permissions is essential for fixing the “Installation failed, could not create directory.” error. Hopefully, you can fix the issue with these options.

Let us know if this worked for you.

Hey, did you know data can be beautiful too?

wpDataTables can make it that way. There’s a good reason why it’s the #1 WordPress plugin for creating responsive tables and charts.

An actual example of wpDataTables in the wild

And it’s really easy to do something like this:

  1. You provide the table data
  2. Configure and customize it
  3. Publish it in a post or page

And it’s not just pretty, but also practical. You can make large tables with up to millions of rows, or you can use advanced filters and search, or you can go wild and make it editable.

“Yeah, but I just like Excel too much and there’s nothing like that on websites”. Yeah, there is. You can use conditional formatting like in Excel or Google Sheets.

Did I tell you you can create charts too with your data? And that’s only a small part. There are lots of other features for you.

FAQs about the “installation failed could not create directory” error

1. Why am I getting an “installation failed could not create directory” error message?

When the installation procedure is unable to build a required directory on the system, the error message “installation failed could not create directory” frequently appears. This might be caused by a number of things, such as permission problems, disk space restrictions, or software conflicts.

2. How can I fix the “could not create directory” error during installation?

You can try altering the directory’s permissions or making the directory manually before beginning the installation to resolve the “could not create directory” problem. Also, you might need to make some disk space available or remove any incompatible software that might be preventing the installation.

3. What directory is the installation process trying to create, and why is it failing?

A temporary file directory, configuration options, or other system resources could be created during the installation process. The installation will not succeed if the directory cannot be established. Finding the error-causing directory and figuring out why something failed are both crucial.

4. Is there a specific permission or setting that needs to be changed to create the directory during installation?

It might be necessary to have administrator rights or use certain settings that aren’t turned on by default in order to create folders during installation. To make sure that the installation can construct the required directories, you can try running it as an administrator or changing the permissions on the target directory.

5. Can a lack of disk space or storage cause the “could not create directory” error during installation?

The “could not create directory” problem during installation can most probably be brought on by a shortage of storage or disk space. Before attempting to install any software or updates, make sure your hard disk has enough free space.

6. Are there any known conflicts with other software or applications that could cause the installation to fail?

Errors like “could not create directory” can occur during installation because of conflicts with other programs or software. To test if any firewalls or antivirus programs are obstructing the installation process, you can temporarily disable them.

7. Is the error related to a specific operating system or hardware configuration?

Including Windows, macOS, and Linux, the “could not create directory” problem can appear on any operating system. It might also be connected to particular hardware setups, including the presence of specific drivers or devices.

8. Can a corrupted installer file cause the “could not create directory” error during installation?

The “could not create directory” problem during installation is unquestionably caused by a damaged installer file. Make sure the installer file isn’t corrupted or damaged and that you downloaded it from a reliable source.

9. Is there a way to bypass the directory creation step during installation to avoid the error?

You might be able to skip the directory creation stage during installation in some circumstances to prevent the issue. However, since the installation procedure could fail or the software could malfunction without the required folders, it might not be advised to do this.

10. Are there any known workarounds or alternative installation methods for this error?

Depending on the particular software and system settings, there can be alternate installation techniques or remedies for the “could not create directory” problem. You can try getting in touch with the software creator or looking for solutions on internet forums.

If you enjoyed reading this article on how to fix the “installation failed, could not create a directory” error, you should check out this one about WordPress plugin update failure.

We also wrote about a few related subjects like WordPress links not working, how to fix “your connection is not private”, how to fix the site is experiencing technical difficulties, and how to fix sorry, this file type is not permitted for security reasons and the link you followed has expired.

Up Next:

The Best WordPress Document Library Plugins

The Best WordPress Document Library Plugins