one melo a day

moon indicating dark mode
sun indicating light mode

DSM 6 Adventures: Restoring WordPress

April 14, 2016

In my previous post I described the obstacles I encountered after updating to DSM 6. This post is supposed to be a quick summary of the steps I took to get this blog up and running again. If you have ran into WordPress issues due to the DSM 6 upgrade and hope to solve them by following these steps, please check my last post first and make sure that you actually have the same problem I described.

Backup, Delete, Install, Restore

Well, the heading says it all, really. I wasn’t able to fix the installation after it got downgraded and altered by the DSM 6 Update. So instead I moved the entire WordPress folder to a backup location and downloaded the latest WordPress version (4.4.2 at that time). The idea was to get the required parts from the old, backed up installation and transfer them to the newly downloaded one. So the first step was to copy my database connection details from the old wp-config.php file and paste them into the wp-config.php file of my new installation. I needed only these parameters: DB_NAMEDB_USERDB_PASSWORD and DB_HOST. This way the new installation is able to connect to the existing database, that contains things like the posts and comments, which thankfully did not get lost or corrupted during the DSM 6 update. My next step was to grab the etc folder at the root of my backed up WordPress installation and to copy it to the new installation. It contains Synology specific things and to be honest I do not fully understand what it does, but testing showed that it did not do any harm. While I was at it, I copied the following files from the old installation’s root to the new WordPress installation’s root directory: .htaccess disabled.html enabled pingbackIsOpend syno-misc.php The .htaccess file is especially important to me and worth a note. Without it, all links to my posts just led to a 404 page. Furthermore I changed my permalink format for my posts at the end of last year, so this file also contains a nifty redirect rule that allowed me to change the permalink format without breaking old links to my posts. This tool from Yoast proved to be very helpful to achieve this: Yoast permalink helper. However, for this .htaccess file to still take effect I needed to make sure that Synology’s WebStation is using Apache as a web back end, which is now one of two options since they introduced Nginx with DSM 6. Luckily the web back end is configurable in the Web Station UI and you can choose between Nginx or Apache. Next stop was the wp-content folder. I started with the theme by simply copying my theme folder from the old installation’s wp-content/themes path and pasting it to the new installation into the corresponding directory. Then I copy-pasted the entire mu-plugins folder from the backed up wp-content path. Finally I copy-pasted all folders from wp-content/plugins. This way I got my theme the way I customized it and all my fully configured plugins back. After all these steps I moved the new and ready to go WordPress folder to my web folder and there it was back up: My WordPress blog in all its glory!

Fixing WordPress Updates

There was still one problem: When accessing the WordPress dashboard and checking for updates, I was still not able to install any of them. After connecting to the DiskStation through SSH and looking around I noticed that the permissions of the WordPress folder were wrong. I changed the user and group ownership of the WordPress folder to http with this command:  sudo chown http:http -R /volume1/web/wordpress Now I am able to install theme and plugin updates and to update WordPress itself all from the WordPress dashboard with the click of a button, just how I like it!

Lessons learned

I am happy to have this blog back up and running again and definitely learned my lesson. In the future I will back up my WordPress folder and the database itself before applying any WordPress update through Synology’s Package Center or doing a DSM update.

The Journey continues

This post will be followed by two more, describing what I did to get Piwik and Tomcat 7 working again after the DSM 6 update, since they were also negatively affected by it. In case you too had issues with these packages when updating to DSM 6, stay tuned. It might be helpful. Did you have any other troubles with WordPress after updating DSM? Did you find other solutions to restore WordPress? What precautions do you take before installing updates to keep your blog up? Feel free to share in the comments section!