Tech Blogging‎ > ‎

A Trip Into PHP Via Wordpress

posted Mar 20, 2012, 9:27 AM by Haris Hashim   [ updated Mar 24, 2012, 10:34 PM ]


After so long staying away from PHP. Here I am, revisiting the scripting language. Definitely it is not one of my favourite programming language. Last time played with it only to discover that there is no breakpoint and step by step debugging facility. Well after nearly 5 years, perhaps things have change!


For good or bad, this write-up is always a work in progress. To be modified from time to time subject to my fits and whims. Nor does it feature step that completely achieve anything. For those kind of expectation, there should be link that refer back to original material used in the making of this article.

One might ask what is the purpose then? Well sometime I just like to come back and see all those pretty pictures. The whole article also sort of act like a note to my self in the future. After all, most of the stuff that I do have this nature of do and destroy. So as not to clutter the hard disk or even the mind. 

In short, document while doing, delete after done. If there is a need, refer and retrace back the step in the future.

The Stack

Refer to How To Install WordPress Blog Locally On Your PC. which is the tutorial followed to accomplish the initial part of this article. Finish reading here first to get all the drama and action packed kungfu. Then you can go there :D !

For windows, the option is WAMP or XAMP. How do I choose? Well, the impulse is to download the one with sexy lady picture. Applied reverse psychology to the decision making process and I download WAMP! 

Guess my wife was right.  She told me that when I asked her to choose A or B and she choose A. Usually I will then do B. There! reverse psychology at the finest.

By the way what is this horrible Acronym of WAMP stand for. In fact it started with something that quite make sense. That is LAMP. Which stand for Linux Apache MYSQL PHP. Change Linux to Windows and suddenly it clicks!

The Trend 

At the WAMP download page. I noticed a trend of displaying lengthy form to be filled up by user before downloading.

Lengthy Form

It is not just the form. But the fact that filling up and submitting the form is not compulsory. One who do not read the instruction (many people!), will simply fill up the form and submit it. Thinking that it is compulsory to download. Click to enlarge above picture to see highlighted text in pink. Off course that is highlighted by me. The original form is very conspicuous, having small text and putting it near the end of line.

Do not fall for this trick since there is no need to fill the form. Just click the direct download link.

The Smooth Installation

After downloading the ~25MB files (surprisingly small!). Installation (i.e. deployment) of WAMP is a breeze. Until it present the following choice to me.

Gmail as SMTP Server

Initial reaction is just to accept the default value (localhost) and click it away. But off course localhost have no SMTP server. And previously while playing around with Bonita,  I have make use of GMail SMTP server for testing. GMail is nice because you can simply send email to multiple email address which actually received by 1 Gmail account. So for testing purposes there is no need to login and log out from so many account. Perhaps I will write more about how to accomplish this later.

WAMP is easy

Finishing the installation and choose the option to run WAMP before exiting. And it is running straight away by default and without much configuration. My last time installing AMP stack is not this easy and smooth. Hooray! By the way, the default configuration emphasized more on running things quickly instead of security.

For those who want to secure the installation, this tutorial will be useful. Installing and Securing WAMP Server. In my case, it is not so critical since I'm not planning to keep the installation beyond this write-up. 

Changing Default Root Password

However the following red colour irks me so much that I decided to change   mysql password.

Default Passw

So the adventure begins ...

Change Password

Which cause the PHPMyAdmin page no longger able to load. Make sense because we change the database password!

Password Error

The cure is to specify the just changed password into this file => <WAMP PATH>\apps\phpmyadmin3.4.10.1\

Set Password

Note to self: There must be a better way of doing this. For instance password hash instead of plain text. Or something about login cookies.

Deploying Wordpress

Creating database for WordPress turn out to be different. In the tutorial, MAMP is used (AMP for Mac?). Here is the step for WAMP

Create Database

The rest of the step is quite similar. I.e. download WordPress expand it into a folder (folder www in WAMP instead of htdocs) and configuring the database in wp-config-sample.php file. Do not forget to save the file as wp-config.php. The tutorial use default mysql root user. Better way of doing this is to create another database user and use it instead of root.

And here we have the install interface.

Wordpress Install

Followed by succesful confirmation and a login screen. 

Success Screen
Login Screen

Even by default, WordPress is stunning. Almost ... almost make me want to change to WordPress! 

Blog View

Would be nice to play with WordPress further. Alas, the purpose is to explore PHP development.


PHP originally stand for Personal Home Page. That really make it stand-up in the purpose of scripting language for web page. However, as time goes by it become more to the point of behaving as server site scripting language (if I am not making sense, just visit Wikipedia entry on PHP). At one point some Israelite software developer (hopefully not among the people who torment our Palestinian brother) change it into a recursive acronym. That is PHP Hypertext Processor. The reason this is a recursive acronym is that, attempting to further unravel the first part of acronym will lead us to the infinity and beyond. At which time we will know why the answer is 42.

Configuring Eclipse

To make PHP codes debugable in Eclipse, combination of PDT (PHP Development Tools) and a debugger is required. After searching on the web, two choice of debugger is widely mentioned. However, the installed WAMP already came with XDebug  2.1.2. So much the better since no need to choose and download.

So there I am trying to figure out PDT. Scouring the web for the Indigo repository URL for that particular package. It turns out the solution is much simpler than I thought. Since it is already part of Indigo but just need to be installed. In eclipse open up the Help menu, click on Install New Software and follow bellow instruction.

Install PDT

I can feel that this is the tricky part to make things work! Refer closely to step 7 of the following link Xdebug 2 Installation.

New PHP Project

To be continued...