BNN.ca down

I just noticed that bnn.ca, Canada’s business news network website was down 11/04/2013, Monday morning. For those who does not know what bnn is, it is the biggest business news channel after CNBC and caters to the viewers in Canada. It is run by one of the biggest telecommunication provider, Bell. Their home page was loading with error which was biggest embarrassment as this should have been caught before going to users.
bnn.ca error page

Installing Hadoop Using Apache Ambari and Amazon EC2 – Part 1

In order to run hadoop with Amazon EC2, I used Apache Ambari installation wizard to install Hadoop. According to its documentation, Apache Ambari provides an end-to-end management and monitoring application for Apache Hadoop. Also Ambari provides a graphical user interface (GUI) to deploy and operate a complete Hadoop stack, manage configuration changes, monitor services, and create alerts for all the nodes in your cluster from a central point.
My configuration for Apache Ambari looks like below using six Amazon AMI 64bit instances:
– m1.medium ambarimaster , we will call it p1_mar24
– m1.large hdpmaster1, we will call it p2_mar24
– m1.large hdpmaster2, we will call it p3_mar24
– m1.medium hdpslave1, we will call it p4_mar24
– m1.medium hdpslave2, we will call it p5_mar24
– m1.medium hdpslave3, we will call it p6_mar24
Here is how it looks like:

Now let’s configure everything step-by-step:
1) Connect to your first EC2 instance using ssh. I used Cygwin terminal client on my windows 7 machine.
First I downloaded my key file from Amazon EC2 configuration as pankaj_east_hadoop_20130324.pem. Then I copied that key file in my cygwin terminal home directory that I wanted to work on, which is /home/pankaj/20130324.

$ pwd
/home/pankaj/20130324
$ ls -ltra
total 4
-r-------- 1 pankaj mkgroup 1696 Mar 24 14:19 pankaj_east_hadoop_20130324.pem
drwxr-xr-x+ 1 pankaj mkgroup 0 Mar 24 14:41 ..
drwx------+ 1 pankaj mkgroup 0 Mar 24 14:56 .ssh
drwxr-xr-x+ 1 pankaj mkgroup 0 Mar 24 15:04 .

Once this is done, open new Cygwin terminal window. Go to directory /home/pankaj/20130324 and launch ssh using following command.
ssh -i pankaj_east_hadoop_20130324.pem ec2-user@ec2-174-129-88-73.compute-1.amazonaws.com
This command will fail initially as below.

$ ssh -i pankaj_east_hadoop_20130324.pem ec2-user@ec2-174-129-88-73.compute-1.amazonaws.com
The authenticity of host 'ec2-174-129-88-73.compute-1.amazonaws.com (174.129.88.73)' can't be established.
RSA key fingerprint is eb:e8:f8:35:23:f1:31:cf:29:82:82:fa:eb:4a:3d:b3.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'ec2-174-129-88-73.compute-1.amazonaws.com,174.129.88.73' (RSA) to the list of known hosts.
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: UNPROTECTED PRIVATE KEY FILE! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0755 for 'pankaj_east_hadoop_20130324.pem' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
bad permissions: ignore key: pankaj_east_hadoop_20130324.pem
Permission denied (publickey).

The reason is permission issue on your pem file. So run following command:

$chmod 400 pankaj_east_hadoop_20130324.pem

This will remove permission issues and allow you to connect to remote linux instance.

$ ssh -i pankaj_east_hadoop_20130324.pem ec2-user@ec2-174-129-88-73.compute-1.amazonaws.com

__| __|_ )
_| ( / Amazon Linux AMI
___|\___|___|

https://aws.amazon.com/amazon-linux-ami/2012.09-release-notes/

There are 13 security update(s) out of 24 total update(s) available
Run "sudo yum update" to apply all updates.
[ec2-user@ip-10-62-97-105 ~]$

Now you are connected to the EC2 instance as ec2-user. You can use” sudo su” command to run any command as root user if needed.
This instance will be used as our Ambari server host.
Now you generate public and private SSH keys on this Ambari Server host as below:

[ec2-user@ip-10-62-97-105 ~]$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/ec2-user/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/ec2-user/.ssh/id_rsa.
Your public key has been saved in /home/ec2-user/.ssh/id_rsa.pub.
The key fingerprint is:
2e:14:e4:2d:d2:5b:2f:fa:0b:9d:f1:47:71:bf:00:47 ec2-user@ip-10-62-97-105
The key's randomart image is:
+--[ RSA 2048]----+
| . E |
| + . . |
| . = o .... |
| . = . oo . |
| o S . .. .|
| . + = . . .|
| + + . . . |
| + . |
| o. |
+-----------------+
[ec2-user@ip-10-62-97-105 ~]$ ls -ltra
total 24
-rw-r--r-- 1 ec2-user ec2-user 124 May 22 2012 .bashrc
-rw-r--r-- 1 ec2-user ec2-user 176 May 22 2012 .bash_profile
-rw-r--r-- 1 ec2-user ec2-user 18 May 22 2012 .bash_logout
drwxr-xr-x 3 root root 4096 Feb 15 23:51 ..
drwx------ 3 ec2-user ec2-user 4096 Mar 24 18:28 .
drwx------ 2 ec2-user ec2-user 4096 Mar 24 18:47 .ssh
[ec2-user@ip-10-62-97-105 ~]$ cd .ssh
[ec2-user@ip-10-62-97-105 .ssh]$ ls -ltra
total 20
-rw------- 1 ec2-user ec2-user 409 Mar 24 18:28 authorized_keys
drwx------ 3 ec2-user ec2-user 4096 Mar 24 18:28 ..
-rw-r--r-- 1 ec2-user ec2-user 406 Mar 24 18:47 id_rsa.pub
-rw------- 1 ec2-user ec2-user 1671 Mar 24 18:47 id_rsa
drwx------ 2 ec2-user ec2-user 4096 Mar 24 18:47 .
[ec2-user@ip-10-62-97-105 .ssh]$

Now download “id_rsa.pub” file from “.ssh” directory of your home folder to your laptop or desktop using following command in separate Cygwin terminal window.

$pwd
/home/pankaj/20130324
$scp -i pankaj_east_hadoop_20130324.pem ec2-user@ec2-174-129-88-73.compute-1.amazonaws.com:/home/ec2-user/.ssh/id_rsa.pub .
id_rsa.pub 100% 406 0.4KB/s 00:00
$ ls
id_rsa.pub pankaj_east_hadoop_20130324.pem

Now we will upload the downloaded public key file “id_rsa.pub” to our remaining instances one by one using following command (we need to change instance name though).

$ scp -i pankaj_east_hadoop_20130324.pem ./id_rsa.pub ec2-user@ec2-204-236-208-203.compute-1.amazonaws.com:/home/ec2-user/.ssh/
id_rsa.pub 100% 406 0.4KB/s 00:00

———————————————————————————————————————————–
Now let’s go to our second instance using ssh on new Cygwin terminal window and check “.ssh” directory as below:

$ ssh -i pankaj_east_hadoop_20130324.pem ec2-user@ec2-204-236-208-203.compute-1.amazonaws.com
The authenticity of host 'ec2-204-236-208-203.compute-1.amazonaws.com (204.236.208.203)' can't be established.
RSA key fingerprint is 16:cf:09:4f:f2:0b:d2:8c:76:66:5c:76:33:eb:d0:df.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'ec2-204-236-208-203.compute-1.amazonaws.com,204.236.208.203' (RSA) to the list of known hosts.

__| __|_ )
_| ( / Amazon Linux AMI
___|\___|___|

https://aws.amazon.com/amazon-linux-ami/2012.09-release-notes/

There are 13 security update(s) out of 24 total update(s) available
Run "sudo yum update" to apply all updates.
[ec2-user@ip-10-118-74-223 ~]$ pwd
/home/ec2-user
[ec2-user@ip-10-118-74-223 ~]$ cd .ssh
[ec2-user@ip-10-118-74-223 .ssh]$ ls -ltra
total 16
drwx------ 3 ec2-user ec2-user 4096 Mar 24 18:28 ..
drwx------ 2 ec2-user ec2-user 4096 Mar 24 19:13 .
-rw-r--r-- 1 ec2-user ec2-user 406 Mar 24 19:13 id_rsa.pub
[ec2-user@ip-10-118-74-223 .ssh]$ cat id_rsa.pub >> authorized_keys
[ec2-user@ip-10-118-74-223 .ssh]$ chmod 640 authorized_keys
[ec2-user@ip-10-118-74-223 .ssh]$ chmod 640 id_rsa.pub

——————————————————————————————————————————————
Once above configuration is done on second instance, go the Cygwin terminal window for the first instance.

[ec2-user@ip-10-62-97-105 .ssh]$ cd ..
[ec2-user@ip-10-62-97-105 ~]$ chmod 700 .ssh
[ec2-user@ip-10-62-97-105 ~]$ cd .ssh
[ec2-user@ip-10-62-97-105 .ssh]$ ls -lta
total 24
drwx------ 2 ec2-user ec2-user 4096 Mar 24 19:15 .
-rw-r--r-- 1 ec2-user ec2-user 884 Mar 24 19:15 known_hosts
-rw------- 1 ec2-user ec2-user 815 Mar 24 18:50 authorized_keys
-rw------- 1 ec2-user ec2-user 1671 Mar 24 18:47 id_rsa
-rw-r--r-- 1 ec2-user ec2-user 406 Mar 24 18:47 id_rsa.pub
drwx------ 3 ec2-user ec2-user 4096 Mar 24 18:28 ..
[ec2-user@ip-10-62-97-105 .ssh]$ chmod 640 id_rsa.pub
[ec2-user@ip-10-62-97-105 .ssh]$ chmod 640 authorized_keys
[ec2-user@ip-10-62-97-105 .ssh]$ ls -ltra
total 24
drwx------ 3 ec2-user ec2-user 4096 Mar 24 18:28 ..
-rw-r----- 1 ec2-user ec2-user 406 Mar 24 18:47 id_rsa.pub
-rw------- 1 ec2-user ec2-user 1671 Mar 24 18:47 id_rsa
-rw-r----- 1 ec2-user ec2-user 815 Mar 24 18:50 authorized_keys
-rw-r--r-- 1 ec2-user ec2-user 884 Mar 24 19:15 known_hosts
drwx------ 2 ec2-user ec2-user 4096 Mar 24 19:15 .
[ec2-user@ip-10-62-97-105 ~]$ ssh ec2-user@ec2-204-236-208-203.compute-1.amazonaws.com
Last login: Sun Mar 24 19:11:27 2013 from bas1-malton23-2925222199.dsl.bell.ca

__| __|_ )
_| ( / Amazon Linux AMI
___|\___|___|

https://aws.amazon.com/amazon-linux-ami/2012.09-release-notes/

There are 13 security update(s) out of 24 total update(s) available
Run "sudo yum update" to apply all updates.
[ec2-user@ip-10-118-74-223 ~]$

Now you are connected to second instance from first instance without providing password.
Similar configuration can be done for all other instances.

I will add more detail on further installation in part 2.
Credits: Adam Muise from Toronto Hadoop User Group. He works as Solutions Engineer at Hortonworks.

Linux: color of files on ls command

Today, I just want to put basic information regarding Linux files and that is color coding of files when user runs ls command.
When you run ls command, you see executable files in different colors, image files in different colors and so does the directories. The color coding of different types of files is located in a configuration file /etc/DIR_COLORS for Linux. A side note: this is in my centOS server.
Colors on my CentOS server are as below

  • Executable files: Green
  • Directory: Blue
  • Image files(jpg, gif, bmp, png, tif): Magenta
  • Symbolic links: Cyan
  • Pipe: Yellow
  • Socket: Magenta
  • Orphaned symbolic links: Blinking Bold white with red background
  • Block device driver: Bold yellow foreground, with black background
  • Missing links along with files they point to: Blinking Bold white with red background
  • Archives or compressed files(like tar,gz,zip,rpm): Red

You can change them if you understand /etc/DIR_COLORS file. They are in the format of (file type attribute codes: text color codes:Background color codes)
File type attribute codes are as below:
00=none
01=bold
04=underscore
05=blink
07=reverse
08=concealed
Text color codes are as below:
30=black
31=red
32=green
33=yellow
34=blue
35=magenta
36=cyan
37=white
And finally, background color codes are:
40=black (default)
41=red
42=green
43=yellow
44=blue
45=magenta
46=cyan
47=white

The example definition for DIR file type which is of Bold Blue color, look for the entry: DIR 01;34
If you change the file than you have to logout and log back in to see the change.

Step-by-Step guide to WordPress Optimization using W3 Total Cache

This article about WordPress optimization is mostly written for developers who know how to create website with WordPress but not very well-versed with other tricks to optimize WordPress for speedy delivery of the content of their website. But anyone can use some of these tricks to improve their non-WordPress websites. I am using my own website pthakkar.com for this blog as I am going through the same pain of optimizing my own website. So lets start.
If you profile a web page with Google Page Speed, it calculates the page’s performance by using number of different rules. These rules are general front-end best practices we can apply at any stage of web development. If you are interested in understanding these rules, you can find at https://developers.google.com/speed/docs/insights/rules — you can refer to these pages at any time. It gives us specific tips and suggestions for how we can best implement the rules and incorporate them into our development process.

When I created my website pthakkar.com with wordpress, it was not optimized at all as you can see from my test run for Google Page Speed. It got an overall PageSpeed Score of 54 (out of 100) which was way too low.

Google Page Speed Overview of PThakkar.com

Google Page Speed Overview of PThakkar.com

So I started step by step process to take Page Speed score above 90. Page Speed evaluates performance from the client point of view, typically measured as the page load time. The best practices involves many steps that affect page load time, including resolving DNS names, setting up TCP connections, transmitting HTTP requests, downloading resources, fetching resources from cache, parsing and executing scripts, and rendering objects on the page and they are grouped in six different categories by Google.
Optimizing caching - keeping your application’s data and logic off the network altogether
Minimizing round-trip times - reducing the number of serial request-response cycles
Minimizing request overhead - reducing upload size
Minimizing payload size - reducing the size of responses, downloads, and cached pages
Optimizing browser rendering - improving the browser’s layout of a page
Optimizing for mobile - tuning a site for the mobile networks and mobile devices

All of the above rules are bit complex for normal WordPress users who does not have experience in performance optimization. So many developers from WordPress community have created plugins to do various optimization using WordPress interfaces. I will list these plugins one by one with advantages and disadvantages of each of them and we will use the best one to optimize my website pthakkar.com. After applying all the optimization techniques, we will compare Google Page Speed score to see how much improvement each plugin did in terms of Google Page Speed score. some of these optimization tricks require some php programming knowledge.
Optimization by tweaking the Configuration File
My WordPress website required to make database calls to locate the site URL. We can greatly reduce database calls just to locate the site URL by defining the site URL in the WordPress configuration file, wp-config.php , as below:
define(‘WP_HOME’, ‘http://pthakkar.com’);
define(‘WP_SITEURL’, ‘htp://pthakkar.com’);

After tweaking the Configuration file, I wanted to see what was the Google Page Speed score and but it still stayed same so I decided to find some plug-ins which might help me in making my website faster so I searched through all available WordPress plug-ins and I found two that were most recommended  and the most downloaded, W3 Total Cache and WP Super Cache. So I decided to understand the differences between two and found that W3 Total Cache is far more powerful although tough to configure. If you need more information, please read a blog from tentblogger.

After understanding what W3 Total Cache plugin can do, I installed it and started configuring it. It provided various option for using cache so I tried to understand different caching options and found two of them very compelling, APC or Alternative PHP Cache and MemCache. After reading pros and cons of both of them, I thought APC would be best option for me as I am running single blog on virtual server so I tried installing APC but for PHP 5.3, it was not a simple job as my server was a bare-bone linux distro. It did not have APC, nor any development tools like “c” compiler. So I decided to install all development tools on my CentOS server. Using following command you can find out what php packages are installed on your server.

#yum list installed | grep php
php53.i386            5.3.3-13.el5_8                   installed
php53-cli.i386        5.3.3-13.el5_8                   installed
php53-common.i386     5.3.3-13.el5_8                   installed
php53-devel.i386      5.3.3-13.el5_8                   installed
php53-gd.i386         5.3.3-13.el5_8                   installed
php53-mysql.i386      5.3.3-13.el5_8                   installed
php53-pdo.i386        5.3.3-13.el5_8                   installed

I needed php53-devel and pcre-devel for my work as I needed phpize command which required php53-devel. I used following command to install both of them.

#yum install php-devel pcre-devel

Then, I needed to compile a package, I needed a C compiler (like gcc) and make. The easiest way to install all the needed development tools was using groupinstall.

#yum groupinstall "Development Tools"

Now I needed to download APC package so I went to my home directory and downloaded and expanded the package using following commands.

#cd ~
#wget http://pecl.php.net/get/APC-3.1.9.tgz
#tar -zxvf APC-3.1.9.tgz

To set up APC, we needed to go to the expanded directory.

#cd APC-3.1.9

Once in the directory, running phpize command would give output like below;

#phpize
Configuring for:
PHP Api Version:         20090626
Zend Module Api No:      20090626
Zend Extension Api No:   220090626

Once we had this, we needed to find the php-config file using following command:

#whereis php-config
php-config: /usr/bin/php-config /usr/share/man/man1/php-config.1.gz

In my case I found php-config file in ‘/usr/bin’ and used it for the next command ‘configure.

./configure --enable-apc --enable-mmap --with-apxs --with-php-config=/usr/bin/php-config

Basically, this command tells OS to compile APC as a dynamically loadable module or DSO. You pass the –with-apxs option to the configure script. If you know the location of the Apache apxs file, you can supply that to the switch with –with-apxs=/usr/local/apache/apxs.
Click on apxs – APache eXtenSion tool if you need to know more about apxs. Darrell Brogdon has given good explanation about –with-apxs switch.
Once you have run configure command, run following command.

#make
#make install

Now, if you have an /etc/php.d/ directory on your CentOS server, create a file called apc.ini in your /etc/php.d directory which will have all your configuration settings and if it already exists, you can just edit the existing one. If your CentOS server doesn’t have an /etc/php.d directory, find your php.ini file and add these configuration settings to it. Normally php.ini file is located in /etc.
You can use following code as an example for apc.ini file. It is with lots of comments to give you better understanding.

; Enable the extension module
extension = apc.so

; To get better explanation of options for the APC module, (at the time of writing version = 3.1.9)
; See http://www.php.net/manual/en/apc.configuration.php

; Set apc.enabled to 0 to disable APC.
apc.enabled=1
; The number of shared memory segments to allocate for the compiler cache.
apc.shm_segments=1
; The size of each shared memory segment, in MB. You can use G for GB.
apc.shm_size=64M
; A "hint" about the number of distinct source files that will be included or
; requested on your web server. Set to zero or omit if you're not sure;
apc.num_files_hint=1024
; Just like num_files_hint, a "hint" about the number of distinct user cache
; variables to store.  Set to zero or omit if you're not sure;
apc.user_entries_hint=4096
; The number of seconds a cache entry is allowed to idle in a slot in case this
; cache entry slot is needed by another entry.
apc.ttl=7200
; use the SAPI request start time for TTL
apc.use_request_time=1
; The number of seconds a user cache entry is allowed to idle in a slot in case
; this cache entry slot is needed by another entry.
apc.user_ttl=7200
; The number of seconds that a cache entry may remain on the garbage-collection list.
apc.gc_ttl=3600
; On by default, but can be set to off and used in conjunction with positive
; apc.filters so that files are only cached if matched by a positive filter.
apc.cache_by_default=1
; A comma-separated list of POSIX extended regular expressions.
apc.filters
; If compiled with MMAP support by using --enable-mmap this is the mktemp-style file_mask to pass to the mmap module for determining whether your 
; mmap'ed memory region is going to be file-backed or shared memory backed.
apc.mmap_file_mask=/tmp/apc.XXXXXX
; file_update_protection setting delays caching brand new files, value in second(s).
apc.file_update_protection=2
; This setting enables APC for the CLI version of PHP (Mostly for testing and debugging). Possible values; 1 for ON, 0 for OFF.
apc.enable_cli=0
; Prevent files larger than this value from getting cached
apc.max_file_size=1M
; Whether to stat the main script file and the fullpath includes. If this setting is off, APC will not check, which usually means that 
; to force APC to recheck files, the web server will have to be restarted or the cache will have to be manually cleared. 
; On a production server where the script files rarely change, a significant performance boost can be achieved by changing its value to 0.
apc.stat=1
; Vertification with ctime will avoid problems caused by programs such as svn or rsync by making
; sure inodes havn't changed since the last stat. APC will normally only check mtime.
apc.stat_ctime=0
; Whether to canonicalize paths in stat=0 mode or fall back to stat behaviour
apc.canonicalize=0
; With write_lock enabled, only one process at a time will try to compile an
; uncached script while the other processes will run uncached
apc.write_lock=1
; Logs any scripts that were automatically excluded from being cached due to early/late binding issues.
apc.report_autofilter=0
;This setting is deprecated, and replaced with apc.write_lock, so it is set to zero.
apc.slam_defense=0

Once this is done, restart your apache server.

#service httpd restart

For more information about APC, you can copy the ~/APC-3.1.9/apc.php file in your web root, and then open it in browser. If you can see server stats in that page, you have successfully installed APC on CentOS.
Once APC cache was installed, I needed to configure W3 Total Cache to use APC.
W3 Total Cache Page Cache setting
W3 Total Cache Minify Setting
W3 Total Cache Object Cache Setting
W3 Total Cache Browser Cache Setting
I haven’t used Content Delivery Network so my CDN setting is empty.
W3 Total Cache CDN Setting
W3 Total Cache Varnish Setting
W3 Total Cache Miscellaneous Setting
W3 Total Cache Minify Tab general Setting
W3 Total Cache Minify Tab html-xml Setting
W3 Total Cache Minify Tab JS Setting
W3 Total Cache Minify Tab CSS Setting
BrowserCache Tab HtmlXml Setting
BrowserCache Tab CSS-JS Setting
BrowserCache Tab Media-Other Setting
Once I did above settings in W3 Total Cache, Google Page Speed for my blog pthakkar.com increased to 97 as per my last check.
Google Page Speed After Setting

How to upgrade php from php5.1 to php 5.3 on CentOS

Today I am starting my first blog on “How to upgrade php from php5.1 to php 5.3 on my CentOS server”.
In order to upgrade php from php5.1 to php 5.3 do following:
1) # php -v
PHP 5.1.6 (cli) (built: Jun 27 20XX 12:25:37)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies

2) run following command:
# yum list installed | grep php | cut -d’ ‘ -f1
php.i386
php-cli.i386
php-common.i386

3) Now run following command:
#yum remove php php-cli php-common

This will ask you to remove above named packages. Packages are the ones which we got in (2).
Press ‘y’ when prompted. This will remove old packages.

4) Now run php -v again
# php -v

Nothing will come up.

5) Now run following command:

#yum install php53 php53-cli php53-common php53-devel php53-gd
This will prompt you to install following 5 packages:

php53.i386
php53-cli.i386
php53-common.i386
php53-devel.i386
php53-gd.i386

Press ‘y’ when prompted which will install above packages.

6) run php -v to see what version you have
# php -v
PHP 5.3.3 (cli) (built: Jun 27 2012 12:25:37)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies

7) now restart your Apache server:
#service httpd restart

8) now open your preffered browser and point it to your website:
You will see following message:
Your PHP installation appears to be missing the MySQL extension which is required by WordPress.

9) It means that you do not have mysql installed or not started the mysqld demon
if you don’t have mysql server installed, do following:
#yum install -y mysql mysql-server
Now ensure that MySQL and MySQL server are installed

10) Now install php-mysql
#yum install php53-mysql
This prompt you to install php53-mysql package and its necessary dependancies which in my case was php53-pdo.i386
It will prompt you to press ‘y’ or ‘N’.
Press ‘y’ when prompted which will install above packages.

11) Now ensure that PHP and the PHP MySQL components are installed using following command:
# yum list installed | grep php | cut -d’ ‘ -f1
php53.i386
php53-cli.i386
php53-common.i386
php53-devel.i386
php53-gd.i386
php53-mysql.i386
php53-pdo.i386

12) Restart Apache by
#service httpd restart

You will be good to go.

There are few good resources on this:

Upgrade PHP 5.1/5.2 to 5.3 on CentOS By Chris Jean

Step by step WordPress installation video on CentOS 5.6 by Joseph Palumbo