Unable to write to and update wp-config.php when exporting
ATTENTION: THIS DOCUMENT IS SUBJECT TO CHANGE AS WE LEARN MORE ABOUT THE CAUSE BEHIND THIS ERROR
Due to some of ways Windows handles file security, when exporting to create an archive, you might receive the following: Error - Unable to write to and update c:\Users\Username\AppData\Local\Temp\DesktopSErverTemp\wp-config.php.
We have learned that Windows, for unknown reasons, sets the files in the root of your WordPress installation as a System file. This renders it impossible for DesktopServer to write or modify the file. In order to quickly set the proper attributes, follow these instructions:
- In Windows, do a search for cmd.exe (In Windows <10, this is done by clicking the Start Button --> type cmd.exe. In Windows 10(+), enter cmd.exe in the Cortana window)
- RIGHT-CLICK on cmd.exe and run as an Administrator
- Navigate to the directory in which your website is located (Default Settings is c:\Users\<yourname>\Documents\Websites\<websitename.dev>). Example: cd c:\users\username\Documents\Websites\websitename.dev --> enter
- Issue the following command: attrib -s *.*
You should now be able to export your file without issue.
If you are having a difficult time using the Command Prompt, this alternate method will work as well:
- In your favorite code editor (Sublime, Coda, etc), open the wp-config.php file that is in the root of your website's WordPress installation. On Windows, DesktopServer's default is c:\Users\Username\Documents\Websites\domain.dev.
- Copy the full contents of this file and paste it to a new file within your text editor.
- Close the original wp-config.php file and delete it from your WordPress root directory
- Delete all other FILES from the root directory, leaving only the subdirectories. (DO NOT DELETE WP-ADMIN, WP-CONTENT OR WP-INCLUDES)
- The files you should delete are: .htaccess, index.php, license.txt, readme.html, wp-activate.php, wp-blog-header.php, wp-comments-post.php, wp-config-sample.php, wp-cron.php, wp-links-opml.php, wp-load.php, wp-login.php, wp-mail.php, wp-settings.php, wp-signup.php, wp-trackback.php and xmlrpc.php.
- In File Explorer, go to your c:\xampplite\blueprints folder and double-click on the blueprint you used to create the site. Many times, this might be the latest version of WordPress. From there, select the files that are listed above and either right-click --> copy or ctrl-c (for copy)
- In the root of your WordPress installation, paste these files by either right-click --> paste or ctrl-v (for paste)
- Back in your text editor, save the new file you created which contains the information from the original wp-config. You will want to save it in the root of your WordPress install as wp-config.php.
You should now be able to create your export without issue