Understanding WordPress, PHP, MySQL and Local Servers

So guys I decided to get my hands dirty with PHP. I realized though, that unlike HTML, PHP is a server based language and you cannot go onto coding straight away. You first need a server with PHP support to interpret it. Why PHP? Because just like other programming languages, PHP needs an interpreter. PHP is available at php.net. But can we just stick to installing PHP and start coding? No. We need a server. The concept of virtualization is not new out there. You can run virtual CD/DVD drives, and even virtual operating systems. Similarly, we have virtual servers, which install on your PC and simulate a real server. The most famous one out there is Apache.

For a newbie though, I won’t recommend using Apache, since its setup is pretty long and overly complicated. Plus, you will need to setup PHP and MySQL separately. The best option here is XAMPP. It itself is a distribution of Apache and contains all necessary tools that you will need in learning PHP. XAMPP stands for: X Apache MySQL PHP PERL. Once you install XAMPP, you have installed all of these. XAMPP contains a control panel to easily start/stop any of these services.

PHP and MySQL closely tie up when it comes to sending and receiving info on the web. PHP is the language. MySQL is the database containing the info that you can query/modify/create with PHP.

Now moving onto WordPress. You can blog with WordPress in two ways. One is to create an account on WordPress.com and start blogging straight away. However, if you want to have all the WordPress functionality on your own server, and you want to create a WordPress blog on your own domain, you can download WordPress software from WordPress.org. This software installs on your server very easily (Google up the famous five minute install of WordPress).

WordPress is built on PHP. If you are a programmer already, I would like to elaborate upon this. In programming, you have functions. In order to call a function, you have to make sure that it is actually defined somewhere in your program’s source files. If you call a function my_xyz_function(); but you have not defined it anywhere in your program, the compiler will give you an error. Similarly, WordPress uses PHP functions to transmit/receive its data. Data in this case being posts/pages/theme options/settings/etc. Then it stores all this data in a MySQL database.

While installing WordPress, you will be asked to modify a file called wp-config.php. This file contains the name of the database to use, the username with which to access this database, and of course the password to access this database.

If you are a geek, you can use MySQL commands to create a database and a user. But if you want to do things the modern way, phpMyAdmin is the option. It is bundled along with your XAMPP installation. After you have installed and started XAMPP, point your browser to http://localhost/.
You will see the home page. Find out phpMyAdmin in the navigation. Then use it to create a database and username/password.

When it comes to functionality, phpMyAdmin and WordPress can be compared in a sense that both provide a graphical interface to modify the SQL database, but at different level. phpMyAdmin will allow you to create tables, rows and columns in the database while WordPress will just ask you to Publish a post and it will automatically adjust its features (like title, body, date, time) into rows and columns on the database.

Thanks for the read.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s