How to Set Up a Blog Site With WordPress on a Localhost

I do not like the “all-in-one” XAMPP package which offers Apache, MySQL, PHP and other tools in the one application.

It is quite hard to customize or optimize each component individually or fix any issue that may arise.

It is also difficult to discover the root cause an individual component may have when they are all bundled in one package.

Therefore, I came up with this tutorial to show you how to install Apache, MySQL and PHP separately and customize each of them to best suit your needs.

I can assure you that there will be no help available on the internet showing you how to install each of them separately as good as this tutorial! Other tutorials always leave out a little piece of configuration here and there resulting in a failed installation.

I installed each component on my local PC and documented each step in this article.

These steps will work on Windows operating system.

I’ll write another tutorial on Ubuntu Linux in the near future if there’s interest from you my dear readers.

If you have any question about these steps or experience difficulty when setting it up, feel free to ask. You will find my contact details via the link to my website in the resource box at the end of this article.

1. MySQL setup:

Download the latest version of MySQL Community Server at mysql.com

Version 5.1.42 is the current version of MySQL at the time of this writing.

My downloaded file is mysql-5.1.42-win32.msi

Run the MSI file and use the following settings:

* Typical Setup Type

* Check “Configure the MySQL Server now” and “Register the MySQL Server now”

* Check “Detailed Configuration”

* Check “Developer Machine”

* Check “Multifunctional Database”

* Accept default setting for “InnoDB Tablespace Settings”

* Check “Decision Support (DSS)/OLAP”

* Check “Enable TCP/IP Networking” and “Enable Strict Mode”. Leave the port number at 3306.

* Check “Standard Character Set”

* Check “Install As Windows Service” and “Launch the MySQL Server automatically”.

* Check “Include Bin Directory in Windows PATH”. This option will let you run MySQL from the command line. It’s very helpful.

* Enter a new root password and do NOT check “Enable root access from remote machines” and “Create An Anonymous Account” since these two options will create security loophole.

* Click “Execute” and it will install MySQL on your local machine.

Start MySQL and create a new database for your WordPress installation. You should provide an appropriate name for your database. In this tutorial, I name the database as “WordPress” and the admin user as “wpadmin”. Change it to whatever you like.

Open your terminal (MS DOS or cygwin) and execute the following commands:

$ mysql -u root -p

Enter password: ********

mysql> create database WordPress;

Query OK, 1 row affected (0.03 sec)

mysql> grant all on WordPress.* to wpadmin @localhost identified by ‘changeme’;

Query OK, 0 rows affected (0.03 sec)

mysql> flush privileges;

Query OK, 0 rows affected (0.02 sec)

mysql> exit

Bye

2. Apache setup:

Download Apache 2.2 at apache.org

My downloaded file is httpd-2.2.15-win32-x86-no_ssl.msi

Run the MSI file and use the following settings:

* Network Domain: localhost

* Server Name: localhost

* Administrator’s Email Address: youremail @email.com

* Make sure “for All Users” is checked.

* Typical Setup Type

* Hit “Install” and it will setup Apache on your local machine.

After the installation completes, go to Control Panel -> Administrative Tools -> Services, look for the “Apache2.2” service and double-click it.

From here you can stop the service and change the startup type to “Manual”

Configure Apache:

Open and modify the httpd.conf at C:Program FilesApache Software FoundationApache2.2conf as below:

Uncomment the following line:

LoadModule rewrite_module modules/mod_rewrite.so

Add:

LoadModule php5_module “C:/php/php5apache2_2.dll”

Search for

<directory files software foundation></directory>

Replace:

AllowOverride None

With:

AllowOverride All

Add index.php to DirectoryIndex as below:

DirectoryIndex index.php index.html

Find

<ifmodule mime_module></ifmodule> and add:

AddType application/x-httpd-php.php.phtml

Add this line to the end of httpd.conf

PHPIniDir “C:/php”

Restart Apache to make the updated configuration effective.

3. PHP setup:

Download PHP 5.2.13 at php.net

My downloaded file is php-5.2.13-Win32.zip

Unzip the downloaded bundle to C:php

Copy C:phplibmysql.dll to C:WINDOWSsystem32

Copy C:phpphp.ini-recommended and rename it as php.ini

Open and modify the newly copied C:phpphp.ini

Uncomment:

extension_dir = “ext”

extension=php_gd2.dll (this is used for CAPTCHA)

extension=php_mysql.dll

extension=php_mysqli.dll

Add:

date.timezone = “Australia/Melbourne”

4. WordPress setup:

Download the latest version of WordPress at WordPress.org

At the time of this writing, it is version 3.0.1

Download and unzip WordPress-3.0.1.zip to C:Program FilesApache Software FoundationApache2.2htdocs

Go to C:/Program Files/Apache Software Foundation/Apache2.2/htdocs/WordPress

Rename wp-config-sample.php to wp-config.php

Update wp-config.php at C:/Program Files/Apache Software Foundation/Apache2.2/htdocs/WordPress with the following settings:

define(‘DB_NAME’, ‘WordPress’);

define(‘DB_USER’, ‘wpadmin’);

define(‘DB_PASSWORD’, ‘changeme’);

define(‘DB_HOST’, ‘localhost’);

Click the following link to generate secret keys api.WordPress.org/secret-key/1.1/salt and replace the following values with the generated keys from that link.

define(‘AUTH_KEY’, ‘put your unique phrase here’);

define(‘SECURE_AUTH_KEY’, ‘put your unique phrase here’);

define(‘LOGGED_IN_KEY’, ‘put your unique phrase here’);

define(‘NONCE_KEY’, ‘put your unique phrase here’);

Make sure the Apache server is still running. If not, start it up.

Open your favourite browser at:

localhost/WordPress/wp-admin/install.php

Follow the instructions displayed on the screen to complete the installation of WordPress.

You May Also Like