A real project: Making BlogNorway.com

Blogging and web publishing for the impatient.
KBleivik
Site Admin
Posts: 178
Joined: Tue Sep 29, 2009 6:25 pm
Location: Moss Norway
Contact:

A real project: Making BlogNorway.com

Postby KBleivik » Wed May 18, 2011 9:10 am

This project starts today, may 18 2011. This post will be updated and edited when new functionality is added.

1. Goal.

To make a multiuser blogplatform for invited companies that is backed up on my local computer.

2. Development server installation and configuration

WordPress running locally on the XAMPP http://www.apachefriends.org/en/xampp.html for Windows server. Installing and configuring XAMPP and MySQL on a local Windows computer is explained in further detail under the heading XAMPP for Windows in this post: viewtopic.php?f=11&t=174. So we assume that you have installed and configured XAMPP and MySQL as explained there.

3. Installing WordPress locally on XAMPP

We assume that the Apache and MySQL are running. If not, start both in your XAMPP control panel. If you get the following error:
Error establishing a database connection

most probably your database configuration as described above is incorrect or your wordpress configuration explained below is incorrect. Be sure to use the information that you used when you configured your MySQL database above when you make your WordPress configuration file as explained below.

I installed the XAMPP package in C:\xampp and wordpress http://wordpress.org/ in C:\xampp\htdocs\blognorway. After installing the WordPress files in the blognorway subfolder and pointing my webbrowser at http://localhost/blognorway/, I get the following message:

There doesn't seem to be a wp-config.php file. I need this before we can get started. Need more help? We got it. You can create a wp-config.php file through a web interface, but this doesn't work for all server setups. The safest way is to manually create the file.

So a local database and configuration file is created as explained in further detail here: viewtopic.php?f=18&t=177. After finishing that process and pointing my webbrowser at http://localhost/blognorway/, I am redirected to the local WordPress installation page http://localhost/wordpress/wp-admin/install.php that you may know if you have ever installed WordPress on your webserver.

4. Remote installation

I use NetBeans PHP for the project, so I set up a new project BlogNorway located in the local folder C:\xampp\htdocs\blognorway.

Read more under the heading NetBeans for PHP viewtopic.php?f=11&t=174

I cannot use the identical configuration for the local and the remote database. For security reasons, I also user a different database password. In order to configure WordPress on the remote server, I have to rename wp-config.php to wp-config-local.php. That version is for security reasons deleted on the remote server, but kept locally. So when I upload WordpPress from the blognorway subfolder to the site on the remote server, there is not a file with the name wp-config.php. If you know how this file should look like on the remote server, you can of course write it locally. For security purposes don't forget to modify the Authentification as explained under the background heading: viewtopic.php?f=18&t=177

Now on the NetBeans:
Run + Set Project Configuration + Customize + Run Configuration menu, I have configured the loacal and remote settings. In addition the remote settings are tested and found OK.
Connection Suceeded


Now I have made a BlogNorway database on my webserver, so I can transfer the files from the blognorway subfolder on my local computer to the webserver. Since there is no wp-config.php file on the remote server, but only the files that I downloaded from WordPress,org, I have to repeat the WordPress installation on the web server supplying the remote information that is needed to configure WordPress on the remote server.

That is how I thought it should function. But during the file transfer, I got a lot of errors like:

425 Could not open data connection to port *****: Connection timed out


550 Can't change directory to /www/blognorway.com/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img: No such file or directory


So my experince so far is that this is done much faster with Adobe DreamWeaver, where I can upload the whole site in one task, and the necessary directories are created. So I switched to dreamweaver on my stationary computer and transferred the whole site with the file transfer arrow. There was no timeout or any other errors, so now the code is online at

http://www.blognorway.com/

Since I need an indentical copy on my laptop I download the code to C:\xampp\htdocs\blognorway and then overwrite wp-config.php with the content in wp-config-local.php so I can use MySQL on my laptop for the blog. Using phpMyAdmin, it should be easy to dump the database from the webserver onto my laptop and import it using the local version of phpMyAdmin. There is a free ftp program for windows, http://filezilla-project.org/ that I may try the next time. http://www.smartftp.com/ is not free, but you get a life time license for less than USD 100. It has a feature to back up and synchronize local and remote files. It can be tried free for 30 days. That is another option I may look at. See also: http://rsync.samba.org/ If DreamWeaver is best, I stay with that IDE.

5. Backing up the remote site
We now have a local backup of the blog and the database on our laptop that are replicated on the internet as often as possible. In addition there are different ways to backup the remote site.

5.1. In the cPanel of the hoster.
At my hoster there is an option to backup the whole site so it can be reinstalled on another web server. In addition the are options in phpMyAdmin to export the database in different formats e.g. as a flat sql file that can be compressed or not. From this file it is easy to recreate the database via the import function in phpMyAdmin.

5.2. In the WordPress dashboard.
There are a lot of WordPress plugins available and more are added each day. One very important plugin is the WP-DB-Backup: http://bit.ly/db-backup. That allows you to back up your WordPress database. Don't overlook this plugin as the last thing you want is to have your server hacked and no database backup to restore it. Read more here: http://wordpress.org/extend/plugins/wp-db-backup/

6. Replicating the site on the laptop
As explained above, I had no problem uploading the site to the remote sever with DreamWeaver on my home computer. But, I don't have DreamWeaver installed on my laptop, so I had to use another ftp service. I decided to try filezilla. Once I had connected to the remote server, the files on the remote server was listed in the right window. In the left window I navigated to the c:\xampp\htdocs folder. Since I had done a lot of work on the remote server installing a lot of plugins, and some themes, I downloaded these to the relevant folders c:\xampp\htdocs\blognorway\wp-content\plugins and c:\xampp\htdocs\blognorway\wp-content\themes. I downloaded the files by dragging them from the right to the left window in filezilla. The file transfer started and there were no problems and the service was much faster than the NetBeans ftp service. When I looked at the files after the file transfer, everything seems Ok. So I think filezilla can be used with both Eclipse and NetBeans.

The database on the remote server can be syncronized with the local database using the syncronize menu in phpMyAdmin, but since your webserver is behind a firewall that restricts remote access to the ports used by MySQL and PostgreSQL. If you need to make a remote database connection, there are two options that can be set up with your hoster if he allows you to viewtopic.php?f=18&t=196&p=231#p231:
  1. An exception can be added for your IP address to the firewall to let you through. This solution will only work if you're connecting from a location with a static IP. Once a firewall exception is set up, you can use your domain name as the hostname for the MySQL server.
  2. If your account includes SSH access you can set up an SSH tunnel to connect to the server.
The remote database must be set as the source and the local database as the target. The target database will be completely syncronized with the soruce data base, leaving the source database intact.

Another option is to use the wp-db-backup plugin on the remote server. First you have to install and activate it, and go to tools + Backup in the DashBoard and download and at the same time unzip the file using http://www.7-zip.org/ that is installed on my laptop. The corresponding sql file is stored in E:\wp\BlogNorway\Backup\May23-2011 on my laptop.

The database is updated via the import function in phpMyAdmin on the XAMPP page. The rest is writing in (controlling) the correct password in C:\xampp\phpMyAdmin\config.inc.php and the correct configuration information in the C:\xampp\htdocs\blognorway.com\wp-config.php file or you will get a database error:
Error establishing a database connection

There may be easier ways to replicate the site on the laptop, but it is fairly fast and easy if it is done as above. The replication should be done as often as I find necessary depending on how much is done on the site daily, weekly or monthly.

7. More formally backing up your site

Why this heading while this is covered above? No it is not. This is in case your house burn, an earch quake destroy it and something happen to your hosters server. I know the probability is very low, but as millions and millions of WordPress driven sites are put on the internet yearly and a complete business may depend on an eCommerce driven WordPress site, I am sure that some people that read this section may thank me in the future. Yesterday, may 23 2011, our biggest tele company, Telenor, experienced two such events happening at the same time, and half of Norway was suddenly shut down from their service. They had to admit on Norwegian televsion that they would keep a backup of the backup in the future. So, even if you have a site on a remote server in another country and you, like me, have a backup on my laptop and my computer in the same building, it is wise to keep a backup in another house, by a family member, a friend or a company that offer a backup service. Here is an example of a free alternative:
So here are a couple steps I recommend to others and do for my clients.
1. make sure they have a G-mail account dedicated to the website storage if not create one.
2. setup the backup plugin to send the backups to the Gmail account and never delete them since Google provides such a large storage space and has become pretty reliable its an excellent place to have an offsite storage of database.
3. If concerned you may lose data stored at Gmail then from time to time for email it to yourself at another email address or simply download them to your local machine.

Source: http://www.webproworld.com/webmaster-fo ... post568351

It should not be difficult to find professional or other free backup services online. A big WordPress site is seldom more than 100 Mb in size. Today, with CD's having Gb storage capacity, it can be enough to put critical updates of your site on a Cd in another house. If you have a person that you rely on, you can also arrange with him / her that (s)he backs up your site and you his / hers.

So here we go to make that backup of the backup. The database is the most critical part of your site, whose content you will never be able to re-create. It has to be backed up frequently. Ask yourself when you have added content to your site that you can not afford to loose. Then take a backup of the database as we have explained above, via the wp-db-backup plugin: http://wordpress.org/extend/plugins/wp-db-backup or via the export option in phpMyAdmin at your hoster. Today, serious hosters, offer software (e.g. in the cPanel) that backs up your whole site. This is a nice feature if you decide to move your site to another server http://codex.wordpress.org/Moving_WordPress or for backing up the files and folders. Check if a full site backup will also back up the database.

The wp-db-backup is nice, because it allows you to schedule backups daily, weekly, or monthly. It is much easier to schedule a backup to take place once a month or week automatically (by a friend), even if you update only sporadically. It is a good rule of thumb to have a regularly scheduled backup running no matter how rarely the site is updated.

In addition to your database, there are other irreplaceable files that make up your WordPress website. These include:
  • The theme you are using
  • The plugins you've installed and activated
  • The files you've uploaded
WordPress stores all of these things in the same folder named wp-content/. Every time you change your theme and install a new plugin, you should make sure that you have a backup of these files / folders. After that, you don't need to back them up regularly because they won't change.

However, the files you upload are a collection that changes over time as you add more files. If you add a photo with each blog post, then that collection changes as frequently as your post. You should be sure to create a backup of the wp-content/uploads/ folder pretty regularly, which you can easily do via a ftp service like filezilla mentioned above. If you have a ftp program like SmartFtp http://www.smartftp.com/ with a synchronize feature, then you won't have to constantly re-download older files. You simply synchronize the files on the remote and the local site. For more permanet backups, keep a Cd of these files and folders in another house.

A last word of warning. The WordPress system is constantly upgraded, so there is no gurantee that a plulign like wp-db-backup will work seamless with future versions of WordPress, so take a look at the backup, at least critical backups. Some files can also have been damaged or corrupted during the backup. Also take a fast look at the sql dump of the database. Last but not least don't forget to stay updated on new software like new WordPress backup plugins. But again, they can be corrupt and contain malware. You can never be careful enough on the internet. For example, imagine you used a backup tool that contain code that destroy the backup and itself on a certain date in the future. Then your backup of the backup is not good enough. Professional companies can in such cases most often recreate the backup, but it is not free. So be sceptical to WordPress plugins / themes that you find via a search engine and is not listed on the WordPress site. The message here is also that you should not rely on a single plugin, but on different backup tools, like those in the cPanel of your hoster for more critical backups. Generally they are safer than WordPress plugins developed by third parties and whose code you don't understand or have the time to qualify.

Example: putting backup in the search field on the WordPress plugin site:

http://wordpress.org/extend/plugins/

give 370 results may 24 2011. Look at the rating, and see if you can find new plugins that seem promising.

WARNING: The upgrade process will affect all files and folders included in the main WordPress installation. This includes all the core files used to run WordPress, two plugins (Akismet and Hello Dolly) and one theme (Twenty Ten). If you have made any modifications to those files, your changes will be lost.

Source: http://codex.wordpress.org/Updating_WordPress

You should read that page as a minimum before you upgrade your installation to a new one. It is especially important if you are new to WordPress.

And from the Upgrading WordPress Extended page:

http://codex.wordpress.org/Upgrading_WordPress_Extended

Note
Delete the old WordPress files on your site, but DO NOT DELETE
  • wp-config.php file;
  • wp-content folder; Special Exception: the wp-content/cache and the wp-content/plugins/widgets folders should be deleted.
  • wp-images folder;
  • wp-includes/languages/ folder--if you are using a language file do not delete that folder;
  • .htaccess file--if you have added custom rules to your .htaccess, do not delete it;
  • robots.txt file--if your blog lives in the root of your site (ie. the blog is the site) and you have created such a file, do not delete it.

Related links:
http://wordpress.org/extend/plugins/maintenance-mode/

http://codex.wordpress.org/Plugins/Plugin_Compatibility

http://wordpress.org/extend/plugins/wor ... c-upgrade/

8. Moving your site to a new server or changing the URL of your site
Before doing this you should of course back up your site as explained above. That is critical if something goes wrong. The Moving WordPress page:

http://codex.wordpress.org/Moving_WordPress

is a must reading. Note that there is also a WP Migrate DB plugin

http://wordpress.org/extend/plugins/wp-migrate-db/

If that plugin is not used, and you wan't to change the URL of your site, open the SQL file that you downloaded in a text editor, search for your old URL to replace it with the new one and save the changes.

Finally observe, that what is today a plugin may be incorporated in the WordPress platform in the future.

Return to “WordPress”

Who is online

Users browsing this forum: No registered users and 1 guest