Be Kind To Your Customers

I recently read an article in the phpBB forums where one user was very disappointed in how mods are applied to phpBB forums. I don’t blame him. They tend to be a very time consuming process where you follow instructions on searching for code fragments in various files and then either change them or add PHP code to them. Its something that requires the knowledge of at least an intermediate forum administrator or a PHP programmer to confidently accomplish.

The unfortunate thing was the response that this confused user was given. He was told that either he didn’t need the plugin or he wasn’t qualified to be managing a phpBB forum. Calling a potential customer an idiot is not the way to solve their problem or to build loyalty.

Looking back at the message threads, the section where he was criticized was deleted. Apparently, someone high ranking in the phpBB community deleted the offending messages.

Whether the mod system in phpBB is good or bad is irrelevant. You should not attack your customers when they are having problems using your software. If you take the time to help them, they may continue using your product in spite of their difficulties. When they feel that you don’t care about them, they won’t care about your software and will switch to your competitor.

Be kind to your customers. They are the ones who pay your bills. :)

Updating PostgreSQL With yum

One of the easiest way to install software on Red Hat, Fedora, or CentOS Linux distributions is through yum. Its faster to use than GUI installers and it just requires entering the following command:

yum -y install postgresql postgresql-server php-pgsql

The versions of PostgreSQL that can be updated are 7.3 to 8.3 and is available for Fedora (versions 7 and 8), Red Hat Enterprise Linux (versions 3, 4, and 5), and CentOS (versions 3, 4, and 5). PostreSQL is available on the 32-bit and 64-bit x-86 architectures.

Before running this command, you need to add configuration settings to the yum repository, which can be found at /etc/yum.conf or alternately save the settings in a file in the /etc/yum.repos.d folder (i.e. name the settings for Fedora as fedora.repo).

Configuration File for Fedora

# Please change the PostgreSQL major release number , if you need.
[pgdg82] name=PostgreSQL $releasever – $basearch
baseurl=http://yum.pgsqlrpms.org/8.2/fedora/fedora-$releasever-$basearch
enabled=1
gpgcheck=0
#gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora

Configuration File for Red Hat and CentOS

# Please change the PostgreSQL major release number , if you need.
[pgdg82] name=PostgreSQL 8.2 $releasever – $basearch
baseurl=http://yum.pgsqlrpms.org/8.2/redhat/rhel-$releasever-$basearch
enabled=1
gpgcheck=0
#gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora

Starting PostgreSQL

Once the PostgreSQL is installed, you need to configure the operating system to automatically start it when the system is booted. This can be done through the Services command in the GUI, or at the command line with:

/sbin/chkconfig postgresql on
/sbin/service postgresql start

Testing the DBMS

You can check if the software was correctly installed by running it with the following commands:

su – postgres
psql template1

Setting Permissions

The access configuration file in /var/lib/pgsql/data/pg_hba.conf should be set to use “trust” instead of “identity” as follows:

local all all trust

You’ll need to restart the database service after making this change by:

/sbin/service postgresql restart

Transferring WordPress MU to Another Server

Yesterday, we looked at how to transfer WordPress to another server. The multi-user version of this software, WordPress MU, is a bit more involved in switching servers. The database settings still need to be changed, but now you need to change the IP of each blog on the server. Every blog has a unique set of tables in the database and they are named wp_number_, e.g. a table can be named wp_10_categories.

Copy the WordPress Files

Like the standalone alone version of WordPress, you need to copy the program files to the new server. Again, SSH is the preferred and secure way of doing this.

Configure the Database and Base Folder

The wp_config.php file contains the configuration settings for the database and the location of the folder with the WordPress MU program files. Create a new MySQL database and record the database name, the username and password for the database, and host name in the appropriate area below in the config file. Also, set the location of the folder where there program files are in the $base variable. If they are in the root folder, then just use ‘/’. Make the changes where the text is bold.

define(‘DB_NAME’, ‘wordpressmu‘); // The name of the database
define(‘DB_USER’, ‘root‘); // Your MySQL username
define(‘DB_PASSWORD’, ‘password‘); // …and password
define(‘DB_HOST’, ‘localhost‘); // 99% chance you won’t need to change this value
$base = ‘/wordpressmu/‘;

Change the IP for the Administration Site

The administrative section of the WordPress MU needs to be configured. There are 3 tables where information needs to be changed as shown below.

wp_site Table:
Change the domain to your server IP and change path to the location of the WordPress MU program files.

wp_sitemeta Table:
Change meta_value in the site_name record to your IP.

wp_blogs Table:
Change the domain of every blog listed to the new IP. The path needs to correctly point to the individual blogs. The path in the first record will be the same as the $base variable set in wp_config.php. The blogs should have a path similar to /base/blog_1.

Change the IP’s in Each Blog

This is the fun part. Since there are multiple blogs, you need to change the IP in each blog to the new address. The only table that gets modified is wp_options. There are 3 records that get changed: the option_value in siteurl, home, and fileupload_url. Modify these values to your server’s IP and the base folder (if appropriate).

That’s all there is to it! You would be better off automating this process if a large number of blogs were active. A PHP script could go into each blog’s wp_options table and then change the IP.

Transferring WordPress to Another Server

Switching servers for your WordPress site is much more involved than copying files from one server to the other. The IP of the new server needs to be set along with writing new settings for the MySQL database.

Copy the WordPress Files

The first thing you need to do is copy the WordPress files to the new server. The fastest way to do this is to the download the entire site locally to your computer and then upload the files to the new server, preferably by SSH for increased security but plain FTP could be used if that’s the only option available.

Configure the Database

A MySQL database needs to be created on the new server. The information you need to take note of is the database name, the username and password for the database, and host name. You need to edit the wp-config.php file with your new database settings. The items which are to be modified are highlighted bold below:

define(‘DB_NAME’, ‘wordpress‘); // The name of the database
define(‘DB_USER’, ‘root‘); // Your MySQL username
define(‘DB_PASSWORD’, ‘password‘); // …and password
define(‘DB_HOST’, ‘localhost‘); // 99% chance you won’t need to change this value

Change the IP

You need to change the IP to your new server in two fields in the wp_options table in blog’s database. The fields that need to be changed is the option_name field in both  the home and siteurl record. Enter the IP of your new server here starting with http://. If the blog is in a subfolder, include it here as well. For example, the siteurl could be http://202.73.208.34/MyBlog. This address defines your blog at the IP of 202.73.208.34 at the MyBlog subfolder. You don’t need a trailing backslash with this address.

If you not sure what the IP of your new server is, the ShowIP plugin for Firefox can give you this information. There is also the option of getting this information from your webmaster.

Tomorrow we’ll look at how to transfer WordPress MU to another server.

Review: Learning Joomla! 1.5 Extension Development

Joomla is by far the most powerful open source CMS available today. An increasing number of web developers are beginning to realize the benefits of building dynamic web sites using a CMS over the traditional way of creating static web pages. A CMS is a more reliable solution because the software is constantly being improved and new features added. This rarely occurs on most web sites that are online today.

Joomla Is Great Software, But …

Joomla is, in itself, a complete solution suitable for the majority of web sites. However, there are instances where the software doesn’t provide the functionality needed for a task. An example of this is the use of content generated from a custom database. A customer may require a web site for posting information about cars for sale. The database will need to store information about the car, such as make, model, year, features, a description, and photographs. An option for users to add comments about the car may also need to be implemented. The text fields should be searchable and car listings sorted by choosing an appropriate field.

While the default Joomla software may be able to accommodate these requirements through a creaive use of what’s available, it would not be an elegant solution and it would most certainly be an awkward for the user. The only viable solution would be to write custom code for manipulating this database. This can be done as a separate application outside of Joomla, but it would be far better to integrate with the CMS so that it can be maintained internally.

Building a Better Mouse Trap

This is where Joseph LeBlanc’s book, Learning Joomla! 1.5 Extension Development: Creating Modules, Components, and Plugins with PHP from Packt Publishing, comes in. He provides an easy to follow tutorial on extending Joomla with custom software. You can learn all of this through the Joomla web site, but the documentation there is scattered and difficult to follow, even for intermediate software developers. LeBlanc teaches Joomla with easy to follow examples that will have you writing custom applications by the time you complete the book.

He covers all aspects of programming, from creating and registering modules, developing the back end and user seen part of components, and plugin development. LeBlanc also gives an overview of the MVC architecture used in Joomla which can be quite confusing at first for people who never used it before, but the book explains it very clearly. He completes the book by showing how to package the custom code that you created for distribution to other Joomla users. This is important if you intend to make money with your software. You can’t expect your users to manually install components and register modules in the database.

Before You Begin

There are several requirements for getting the most out of this book. The first is a knowledge of PHP programming. Although the book covers advanced topics, a high degree of PHP knowledge is not required. You can learn all the PHP that will be needed for this book in a weekend of study.

Its also important to know enough MySQL to work with it. You need to know at least how to add information to tables using a GUI tool like phpMyAdmin.

The final and most important requirement is to have Joomla 1.5 installed. The tutorials are designed specifically for this version and should not be attempted with the 1.0 versions. The latest version of Joomla 1.5 is at the fourth release candidate stage and is stable enough to handle these tutorials. You can run the tutorials on Linux or Windows. I typically build Joomla applications on Windows and then deploy them on Linux servers.

An important thing to have while reading the book is the source code and errata (corrections to the book). Not using the errata will halt your progress while trying to figure out why certain things aren’t working. Both of these can be downloaded from the Packt web site.

Making Joomla Sing

When you complete this book, you will have the knowledge to build advanced Joomla applications. What previously was thought to be impossible and difficult to do now becomes possible and attainable. Every Joomla web site developer must read and understand this text if they want to be more than mediocre in their field. The cost of the book is low, and the knowledge attained from it is valued beyond measure.