Installation failed could not create directory error in WordPress often triggers while users try to use a new version of WordPress or try to upgrade WordPress plugins and themes.
In this context, we shall look into methods to fix this WordPress error.
The "Installation failed, could not create directory" error message is a relatively standard error message.
It often occurs when users try to use a new version of WordPress or try to upgrade WordPress plugins and themes.
Sometimes, users also receive this error when they try to install WordPress plugins and themes via WordPress dashboard or while attempting to upload files to the wp-content directory on our server.
In general, some of the common reasons we have noticed for this error include:
1. Error during installation: It indicates that 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.
2. WordPress permission: When WordPress creates a new website, the files are stored in folders or directories, which the webserver creates.
These folders can only be accessed if we 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.
3. Disk quota: The error also happens if we exceed the quota limit of our server or if the directory we are trying to reach is already full.
The steps to be followed to fix the error depend on the real reason for this error.
Let us now discuss some of the possible steps to fix this error.
1. Correct Directory permission
The first step is to ensure that the ownership of the WordPress directories is correct.
Some cPanel based hosts require these directories to be under the ownership of the site user.
Some require that the web server owns the directories where WordPress is installed.
To do this, our Engineers first use the code below to list all processes that are running,
ps aux | egrep '(apache|httpd)'
The next step is to allow access to WordPress directories:
# chown -R apache /var/www/html/
2. Update Folder Permissions With cPanel
The permissions for folder usage depend on the rights that each user has.
For cPanel based servers, it can be corrected with the steps below:
i. Login to cPanel account.
ii. Once logged in, search for “file manager” and open the first search option.
iii. To view files of our website, open “public.html”.
iv. Select all files under the root directory, right-click and open “file permissions.”
v. Under the “permissions” button at the top of the page, click on the “change permissions” option.
vi. 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.
vii. 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.
viii. This time we will have to enter the number “644” under the numeric value field. Click on “Recurse into subdirectories.” and select “Apply to files only”.
ix. Confirm the changes.
x. 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 we should be able to install plugins and themes going forward.
3. Insufficient disk space in the server
Although it seems unlikely, the error "Installation failed, could not create directory." might be caused by insufficient disk space in the server.
It is a common issue if we are using shared hosting.
Here, we ensure that we have enough space for the new files to be installed.
Also, we should not store our backups in the same folder as our server, as we are risking our reserves with this method.
Instead, use a cloud backup service like Dropbox.