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).
- 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.
- 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.”
- Confirm the changes.
- 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.
- From your web hosting account, open the “File Manager”.
- Within the root folder, locate the “wp-config.php” file and open it.
- 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’, ‘yoursite.com’); define(‘FTP_SSL’, false);
- Save the “wp-config.php” file.
- 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.
If you enjoyed reading this article on how to fix installation failed, could not create a directory, you should check out this one about WordPress plugin update failed.
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, how to fix sorry, this file type is not permitted for security reasons and the link you followed has expired.