Page 1 of 2

What are you using to back up your WordPress site?

Posted: Wed Aug 01, 2018 6:08 pm
by patty1
I did a simple Export from the WP admin menu recently, but I don't think that captures all the settings I've changed via the Appearance > Customize menus in my theme. The plugin WPBackItUp was recommended to me, but when I ran it, I got an error about not being able to create a .zip file. Then I tried UpdraftPlus, but I think it's having the same problem.

Do I need to ask Sonic to provide zip functionality on their WP server (which may not be something that Sonic support is interested in doing), or do I need to find a different plugin, or what? Would appreciate hearing from people who are able to do full backups (including custom settings) of their WP sites hosted at Sonic.

Re: What are you using to back up your WordPress site?

Posted: Thu Aug 02, 2018 10:36 am
by tikvah
I own Dreamweaver which has built in FTP. I don't use it to build my WP sites because I don't need to, but I use it for the parts of my websites that aren't part of WP. Every-so-often, I just do a full download/sync. It takes a while the first time because it grabs all the non-content files. But you can set it to just grab folders with content. I mean you really don't need to backup any WP files as they will also be available to install again. It just can be hard to figure out exactly which folders might have things you need. I'd go for WP-Content and not worry about getting extra stuff.

If I didn't own Dreamweaver, I'd use any FTP program. Setting up the FTP takes a bit of work, but Sonic has instructions on it (you need the specific server names. etc). Some FTP programs are free and some are shareware that cost a couple of bucks. Worth it. Fetch was the standard shareware program for Macs for a long time. Not sure about now, or what works for other systems.

I figure that Sonic has full backups in case of something catastrophic to their servers. Or backups to restore files lost due to an error on their end. But yes, I need to have copies of my own stuff in case of an error on my end.

Wordpress used to email me copies of all my posts (I should figure out how to do that again). I filed those away as backups. I also have local copies of all my graphics.

Once something is on my computer, it gets backed up at home on my Apple Time Machine and in the cloud at BackBlaze.

Re: What are you using to back up your WordPress site?

Posted: Thu Aug 02, 2018 10:52 am
by patty1
Hi, Tikvah. Yes, Fetch is still the go-to FTP program for Macs. But from my understanding, a WordPress website is a combination of files stored on the user's home directory and files in a server database. Are you saying that you have FTP access to the latter? I've only been able to FTP files from my own web directory. And I can't figure out where customizations are kept. For example, I just made some changes to the appearance of my site last night, but there are no modification dates in my web directory more recent than a few days ago. From what I've read, there are one-click backup and restore options for WordPress sites that someone find all the relevant files.

Re: What are you using to back up your WordPress site?

Posted: Thu Aug 02, 2018 11:52 am
by tikvah
Some of the WP files will be at root and not accessible to you and me. But others (like themes, plugins, and a lot of files I don't know what they do exactly) are in our personal directories. They take up a fair bit of space...okay, looking it up. Not that bad, about 53 MB. It's been a while since I backed up this way. Thanks for the reminder! Gonna do it again now.

Re: What are you using to back up your WordPress site?

Posted: Thu Aug 02, 2018 11:54 am
by tikvah
Uploaded graphics are here:
wp-content: uploads (then by year)

wp-content also has themes and plugins.

And ugh, I'm not finding posts. That's not good.

Re: What are you using to back up your WordPress site?

Posted: Thu Aug 02, 2018 12:37 pm
by goetsch
Back when I was tasked with the care and feeding of several WordPress sites, I used a belt-and-suspenders approach to grab all the pieces for a backup:

1. copy all the files from the web directory
2. do a mysqldump for the database
3. run wget to grab all the visible pages

Rather than using FTP, I ran this all in scripts on the server and never downloaded anything unless I needed to work on it. When the files and database had been processed, I zipped this good stuff all together, and then kept the five newest versions of the backup, rolling the oldest one off as I added a new one. These were fairly low-volume sites, so I ran this about once a week. No matter how badly I screwed things up, I was able to put the pieces back together. YMMV.

Re: What are you using to back up your WordPress site?

Posted: Thu Aug 02, 2018 4:58 pm
by patty1
Goetsch, are you saying that users can access Sonic's WP server to make a backup of it? I don't care about images or pages; those either got uploaded to my website from my Mac and are thus already in my care, or are in the xml file that I exported from WordPress. I'm trying to figure out where my customization options are stored so I can back up and restore those.

I accidentally clicked the Reset button in my theme customization window the other day, thinking that I was on my test site rather than my live website. Oops. It took me about half an hour to restore my customized settings. I'd prefer an easier way to handle that situation in the future, although of course not screwing things up in the first place would be even better. :-)

Re: What are you using to back up your WordPress site?

Posted: Thu Aug 02, 2018 5:25 pm
by goetsch
I don't know whether this applies to sites created with the "Install Wordpress" tool (Member Tools > Web Sites / Domain Names > Website Add-Ons > Install Wordpress), but if you installed WordPress "manually" (create the database, install Wordpress, hook 'em together), you can use phpMyAdmin (Member Tools > Databases > Manage [name of database] > Administer Database (phpMyAdmin)) or just run mysqldump from the command prompt to export the entire contents of the Wordpress database.

Re: What are you using to back up your WordPress site?

Posted: Thu Aug 02, 2018 5:37 pm
by patty1
Thanks, I had Sonic install WP, so I don't have access to the SQL database.

Is that where theme customizations are stored?

Re: What are you using to back up your WordPress site?

Posted: Mon Aug 06, 2018 4:26 pm
by drew.phillips
patty1 wrote:
Thanks, I had Sonic install WP, so I don't have access to the SQL database.

Is that where theme customizations are stored?


While the auto-installed WordPress database is hidden from phpMyAdmin, you can still access it from shell using the credentials and information from the wp-config.php file (DB_HOST, DB_NAME, DB_USER, DB_PASSWORD). You can connect directly using the mysql client on shell.sonic.net, or use those values in backup scripts that run from shell.sonic.net to run mysqldump.

If you edit theme PHP files directly in the Theme Editor, this generally modifies the theme files in wp-content/themes. Customizations made through theme administration panels would be stored in the database.

Posts, pages, users, menus, and meta-data about media uploads are all stored in the database.

Thus to have a full WordPress site backup, it's imperative to backup both the database *and* files on the server and keep them together as a single backup.

Here is a shell script I use to back up a WP site on Sonic's hosting. I make no guarantees of it's reliability and modifications or troubleshooting is beyond the scope of our support but it's a starting point for power users.

You can run it from shell.sonic.net by hand or regularly as a cron job. "domain.com" must be changed to the domain you want to back up and the DB values up top changed to those found in your wp-config.php file.

It will create the directory "wordpress_backups" in your home directory and keep them there. It works by creating mysqldump of the WP database, and then backs up all the WP files and folders into a .tar.gz file. Backups older than 14 days will be deleted automatically.

Code: Select all

#!/bin/bash

# MySQL database configurations
DB_USER="username_oc_2"
DB_PASS="db password here"
DB_NAME="username_oc_2"


# Where backups are kept
BACKUP_DIR="$HOME/wordpress_backups"

if [ ! -d "$BACKUP_DIR" ] ; then
        # Create backup directory if it does not exist
        mkdir "$BACKUP_DIR"
fi

# get date & time for backup file name
date=`date +%Y%m%d-%H%I%S`

# export wordpress mysql database to file
mysqldump -h b.custsql.sonic.net -u $DB_USER -p"$DB_PASS" $DB_NAME > "$BACKUP_DIR/wordpress-$date.sql"

if [ $? != 0 ] ; then
        echo "Wordpress MySQL backup failed!"
        exit 2
fi

# backup wordpress files, themes, plugins, media
tar cfz "$BACKUP_DIR/wordpress-$date.tar.gz" $HOME/public_html/otheremail.org

if [ $? != 0 ] ; then
        echo "Failed to archive WordPress files!"
        exit 2
fi

# delete backups older than 14 days; "-name" ensureswe only our backups are deleted
find "$BACKUP_DIR" -maxdepth 1 -name "wordpress-*" -type f -mtime +14 -delete -print

exit 0


To run it, you would save this to a file in your home directory on shell.sonic.net (e.g. backup_wordpress.sh), give it execute permissions (chmod +x backup_wordpress.sh) and then run it as "./backup_wordpress.sh"

It's just a robust as a backup plugin, if not more, but if getting that set up sounds confusing, a plugin is probably the best way to go. There should be some that can create backups without needing the "zip" extension built in. Restoring from that backup simply involves extracting and overwriting all the files, and importing the SQL dump which will erase all the old info from the database and replace it with the backup.