Friday, December 21, 2012

Installing WordPress locally on Windows

Problem:

I have always been a dot it yourself kinda guy, and this is no different. I'm sure there are a lot of other blog posts on installing WordPress, but I wanted to share my own experience and resources for future reference.
This isn't an actual "problem" but depending on our current system state, this can take from a couple of hours to a couple of days. The process I'm following (not "recommending"), is a manual procedure where we can do things ourselves, check each step issues and requirements, and also, being able to individually upgrade or configure each different application without it being bundled and stuck to static versioning from applications such as XAMPP, WAMP, or Web Matrix, which I would only consider for basic users.

First, lets compare WordPress. There's the hosted free version (with lots of design limitations) and there is the on-premise version. We are using the second since we're going to install it on a machine of our own. For full limitations, check out this interesting article.


Solution:

1) Install PHP
http://www.hauser-wenz.de/s9y/index.php?/archives/280-Installing-PHP-on-Windows-7.html
http://www.sitepoint.com/how-to-install-php-on-windows/
http://www.sitepoint.com/install-php53-windows/

a) this means going to your windows components in control panel, and make sure Internet Information Services (IIS) and CGI modules are installed.

b) for each site in IIS, go to Module Mappings and add a new Module Mapping (requested path: php, executable: php-cgi.exe, module: FastCGIModule, name:PHP)

c) download and install PHP.
From what I've checked, here's the version relationship:



     VC6   VC9
Thread Safe Apache.org ApacheLounge
Non Thread Safe Apache.org IIS/CGI

d) make php.ini edits
this is where usually we rename a base/sample configuration file to the final version and configure parts of it left for us to customize, that are mandatory. I changed "php.ini-production" to "php.ini"

- enable extensions (uncomment extension_dir = "ext")
- enable MySQL (uncommenting "extension=php_mysql.dll" will bypass error "php MySQL extensions are required by WordPress")
- configure smtp (I actually use sendmail, http://www.glob.com.au/sendmail/)

e) download xdebug and add xdebug entries to php.ini to enable debugging with a PHP IDE such as NetBeans (free, powerful PHP/MySQL editor)


[xdebug]
xdebug.remote_enable=1
xdebug.remote_host="localhost"
xdebug.remote_port=9000
xdebug.remote_handler="dbgp"
zend_extension = c:\php\xdebug\php_xdebug-2.2.1-5.4-vc9-nts.dll



2) Install MySQL

a) download and install some version of MySQL

b) add a user (I prefer using 127.0.0.1 due to IIS bindings)

create user 'username'@'hostname' identified by 'password';


c) add a database and permissions for the previous user


CREATE DATABASE database;

GRANT ALL PRIVILEGES ON database.* TO "username"@"hostname" IDENTIFIED BY "password";

FLUSH PRIVILEGES;



3) Install WordPress

a) rename and edit wp-config-sample.php to wp-config.php

b) edit your database name, user name, password and host address

c) for the area with all the keys, we can get generated code/keys from

https://api.wordpress.org/secret-key/1.1/salt/

d) for the hostname, 127.0.0.1 seems to bypass error "authentication error. please confirm username, password, and host"

e) install WordPress using the url, such as http://localhost/wp-admin/install.php

d) add "index.php" to IIS default documents, so that it opens automatically when navigating to http://localhost, or IIS will throw 404 for not findind any documents, and directory browsing is disabled

And after a few eventual error screens figured out, we should finally see this good looking page:




See related article, "Installing WordPress locally on Mac OS".

No comments:

Post a Comment