Most of my website work has involved Linux servers. On a few occasions, however, I’ve been lucky enough to deal with a WordPress Windows installation. A common problem I’ve run in to with the WordPress IIS combination is the all-too-frustrating Update Failed Could Not Create Directory WordPress issue.
The setup I was dealing with was WordPress on an Azure VM running Windows Server 2016 and IIS 10. The WordPress IIS combo isn’t inherently difficult – IIS as a web server plays nicely in my experience. Not as nicely as Apache or NGINX but nice enough. That’s why I was confused when I recently tried to update a WordPress plugin and it failed with the seemingly clear error message of:
An error occurred while updating Yoast SEO Premium: Could not create directory. wordpress-seo-premium/admin/config-ui
The error sounds simple enough – usually that’s a permissions issue. WordPress must not have the proper permissions to create this directory. So I went to the folder and set the correct permissions and the update still failed.
Next attempt at resolving my Could Not Create Directory WordPress problem: check the length of the folder path. As you may recall, Windows used to have this problem with limiting the length of folder and file paths in the file system to somewhere around 260 characters. So I counted the character and the total was less than 200 – nowhere near the magic 260 character limit. Little did I know, I was actually getting very close to solving the problem.
After going through a bunch of iterations where I changed a few factors and tried the upgrade again (all attempts failed), I noticed something…the name of the file being downloaded from Yoast.com was like 7,000 characters long. Which would put me slightly over the 260-character file system limit. At this point I was certain this was not a WordPress IIS issue but more likely a WordPress Windows issue – since 260 characters is a limitation of the Windows Operating System and not IIS.
After Googling “character limit windows file system” I started to feel a little better. As it turns out, Windows Server 2016 (and Windows 10, for that matter) are no longer stuck in the 260-character file system limitation. The trick is, you have to turn the limit OFF. Windows ships with the limit turned ON. How do you do it? You’ll need to edit your registry. If you don’t know how to do this, please visit a site that clearly explains the procedures and risks of doing so. There are risks and you should be very cautious when editing your registry. You’ve been warned!
Here’s the registry key to edit:
Change LongPathsEnabled from 0 to 1.
After restarting IIS, update was successful and all was well again.
There are other ways to address this issue. See this page on MSDN for alternatives.
Products from Amazon.com
Price: $34.43Was: $50.00
Price: Check on Amazon