5 quick fixes for ‘failed to write file to disk WordPress error’
You try to make an urgent update to your site, but it fails. Nothing can be more annoying for website owners than getting errors during site management.
Majority websites are based on CMS software. WordPress is one commonly configured CMS for websites. It comes with its share of errors too.
In our role as Outsourced Tech Support services for web hosts, WordPress errors are a commonly resolved issue for customers who report website issues.
Today, we’ll see what causes ‘failed to write file to disk WordPress error’ in WordPress sites and how we fix it.
‘Failed to write file to disk WordPress error’ – When do you see it?
This error usually happens when WordPress site owners try to upload images or files to their site using the WordPress admin area interface.
One of these error messages can show up:
WordPress failed to write to disk WordPress has failed to upload due to an error failed to write file to disk Unable to create directory wp-content/uploads/2018/10. Is its parent directory writable by the server?
Today, we’ll see the common causes for this upload error and how we fix them.
Causes for ‘Failed to write file to disk WordPress error’
In our experience handling failure to write errors, we’ll see the major causes we’ve come across.
1. Incorrect folder or file permissions
For every site to work fine, the files and folders in it should have the correct ownership and permissions. Whenever the webserver does not have enough permissions to write to the upload folder, it will give ‘Failed to write file to disk’ error.
In certain scenarios, some plugins for backup and restore, improper server migrations, WordPress update or human errors can also lead to such permission issues.
2. Temporary folder errors
WordPress runs on PHP. When files are uploaded, they are first saved to a temporary folder, before uploading to the website folder.
The location of this temporary folder is defined in the PHP and related configuration files. This temporary folder can get filled up due to huge uploads or upload process getting disrupted in between.
If this folder is full or have permission issues, the uploaded file cannot be saved and will throw errors. Wrong path to the temporary folder in the configuration file can also lead to write errors.
3. Quota limit exceeded
Every user has a quota allotted to their account in the server. In shared hosting, the users are billed based on the storage allotted to them.
Many website owners choose low storage plans for their sites, inorder to save costs. But this storage can get easily filled up, especially when there are subdomains and huge uploads.
When a user reaches his quota limit, he cannot upload anymore files to the account. That is when he sees “failed to write file to disk” error in his WordPress site.
4. File system errors
Lack of disk space in the entire server can lead to write errors in sites. We have seen cases where the / folder or /tmp folder in servers getting filled up due to various reasons.
In some servers, we have also seen the hard disk going bad and turning into read-only mode, which prevents any write operations and throws up errors for sites and services.
How we fix ‘Failed to write file to disk WordPress error’
1. File permissions
The first thing we check is the folder and file permissions of the WordPress installation of the site. The folder ‘wp-content’ is the one that contains the uploaded files.
For WordPress uploads to work fine, this folder and subfolders have to be assigned 755 permissions and files need 644. This can be done via FTP, File manager or command line via SSH.
To avoid permission issues that arise during account migrations over servers, we follow an extensive checklist and do pre-migration and post-migration checks.
2. Temporary directory settings
If folder permissions are fine, we examine the WordPress site logs and see what else is the issue. We examine the settings and confirm that the temporary directory is set fine.
The permissions and ownership for this temporary folder is verified to be correct. If the temporary folder exceeds its size limit, we clear it and remove files that maybe present due to incomplete uploads.
3. Quota checks
The disk quota and usage of the user is examined and confirmed to be within limits. In cases where the disk quota is found to be exceeded, we scan and find out what is using up the space.
If unwanted files or trash is consuming the space, we clear and create space. Otherwise, we initiate plan upgrade for the site and allot more storage to the account.
4. File system checks
We examine the file system disk space utilisation and ensure that there is no lack of space. To rule out other hard disk errors, we verify the server logs in detail.
For servers we manage, we get notifications whenever a disk issue occurs, and our 24/7 team of engineers promptly resolves such issues to ensure websites are not affected.
5. Plugins or hacks
In rare cases, it is also possible that some WordPress plugins or any hack attempt by malicious users can affect the folder permissions and cause write errors. A wrong format of filename is also noted to cause issues at time.
In the servers we manage, we conduct periodic audits and security scans to prevent such hack attempts or malicious software from affecting website functionality.
WordPress errors are a commonly encountered category of website errors. Today we saw why ‘failed to write file to disk WordPress error’ happens in websites and how our Dedicated Hosting Engineers prevent it.