How to set up WordPress on your local computer.

Blogging and web publishing for the impatient.
Post Reply
KBleivik
Site Admin
Posts: 184
Joined: Tue Sep 29, 2009 6:25 pm
Location: Moss Norway
Contact:

How to set up WordPress on your local computer.

Post by KBleivik »

1. Background
WordPress http://wordpress.org/ is one of the most popular blogging platforms and many large companies use it for their business blogs. You can sign up for a WordPress account on http://wordpress.com and host your blog on that site or you can install the code on your web server. WordPress was co-developed by Matt Mullenweg and Mike Little http://wordpress.tv/2010/03/09/mullenwe ... interview/.

The main difference between having your blog on WordPress.com versus downloading the software from WordPress.org and hosting it yourself, is the level of control. If your blog is on WordPress.com, you have less control over plugins, themes, and other details of the blog because everything is managed and made worry-free by the WordPress.com service.

If you will host the site on your own server, it is as simple as downloading the code and use a ftp tool to upload the code to your server and configure the platform. You can do that even without downloading the code to your computer using WordPressDirect http://www.wpdirect.com/. Read more here: http://www.web3logistics.com/#new-domai ... in-minutes.

During a manual installation of WordPress, you have to edit (see below) the wp-config-sample.php file and save it as a wp-config.php. If you put your site on line, you should, for security purposes, put some unique phrases into the unique keys. You can create these keys here: https://api.wordpress.org/secret-key/1.1/salt/ and replace that with the code in the configuration file. For more information read: http://codex.wordpress.org/Editing_wp-config.php under the heading: Security Keys.

If those are one of your preferred options, you can leave this post and read more about that option on the page that is loaded by clicking one or more of the above links or on the WordPress codex page: http://codex.wordpress.org/Main_Page But before you leave, as a minimum read the second and third quote below. If you intend to make a WordPress powered eCommerce site, also read the first quote in section 4. below. An obvious advantage of having WordPress installed on your computer is that you can develop your site without internet connection. Personally I have the WAMP, XAMPP and BitNami platforms installed on my laptop, so I can develop applications independent of electricity and internet access as long as I have bettery capacity on my laptop. BitNami uses the PostgreSQL database plattform instead of MySQL that is now owned by Oracle. PostgreSQL is not bought up by a large company so far, and in my and many other developers view, it is the best open databaseplattform. Most articles and books however seem to use MySQL if a databaseplatform is used. There should not be major problems hooking WordPress into the PostgreSQL databaseplattform. The installation of BitNami on your local computer or laptop is explained here: http://www.oopschool.com/phpBB3/viewtop ... f=11&t=174. BitNami is run as a service on my laptop, so it is automatically started when I turn on my laptop. I can only run one of the servers at a time, so I have to shut down the BitNami service: Start + All Programs + BitNami Wappstack + BitNami Wappstack Service + Stop BitNami Wappstack Service before I use XAMPP or WAMP. The server that is running is used when I point my browser at http://localhost. These test servers can of course be used to develop any CMS system localy as long as php and MySQL / PostgreSQL are used. If configured correctly, there will be no conflicts.

2. Setting up a development server on your local computer.
In this example we will use the well known XAMPP package for windows. We have explained how to install that package in point 1.3 here http://www.oopschool.com/phpBB3/viewtop ... f=11&t=174. So we assume that you have XAMPP installed on your computer and that you have configured MySQL as explained in that thread. You can of course also install the WAMP server http://www.wampserver.com/en/ that is used with the WordPress eCommerce book mentioned in section 4. below. This server is even easier to install than XAMPP,
WampServer installs automatically (installer), and its usage is very intuitive. You will be able to tune your server without even touching the setting files.
so we don't explain how it is done here. If you have a Machintosh computer, there is a similar MAMP server http://www.mamp.info/.

If you have administrator rights to you computer, It is as easy as installing any other software. Coose the defaults and let WAMP install a start page for you and point your browser at http://localhost/ when you are finished. From the WAMP start page you'll be able to easily launch phpMyAdmin. You can also launch phpMyAdmin from the WAMP icon in the taskbar (a little green icon at the bottom right of my laptops screen). phpMyAdmin will allow you to easily create a database and the database user account required for installing WordPress or any other CMS system.

3. Download and install WordPreess on your local computer.
1. Create a MySQL database for your WordPress installation. On the phpMyAdmin home page (http://localhost/phpmyadmin/), locate Create new database and enter a name e.g wordpress, for your database in the input box. Click Create.
2. Download the latest stable release of WordPress from http://wordpress.org/download/ and unzip it to the htdocs folder in your XAMPP directory. This should be at c:\xampp\htdocs.
3. In the wordpress folder, open the wp-config-sample.php file using Windows Notepad or any other text editor. Edit the configuration details for the MySQL database we created earlier. These should be:
  • DB_NAME = 'wordpress'
  • DB_USER = 'root'
  • DB_PASSWORD = 'yourpassword' (This is the MySQL password you set for the 'root').
You can leave the other configuration settings as they are.
4. Save the file as wp-config.php.
5. Point your web browser to http://localhost/wordpress/ and you will see the familiar WordPress installation screen. Enter your blog title, email address (Note that the email functions in WordPress won't work with your local server. However, do ensure that you don't lose or forget your password as WordPress won't be able to email a reminder to you!).
6. Click Install WordPress. You now have a fully functional copy of WordPress on your own computer.

Recommended book: http://www.packtpub.com/wordpress-busin ... ggers/book
If you are considering making big changes to your blog, particularly ones that require editing the WordPress source files, it's worth considering setting up a development environment on your local computer. This has a number of benefits. First, if you mess up and cause irreparable damage to the WordPress files, you haven't broken your live blog. Second, you don't have to take your blog offline while you're playing around 'under the hood'. Third, you don't have to keep FTPing files to your remote server to view the changes.

Cut from the above mentioned book.

Other WordPress books from Packt Publishing: http://www.packtpub.com/books/wordpress, especially

http://www.packtpub.com/wordpress-3-complete/book

http://www.packtpub.com/wordpress-30-jquery/book

Note that WordPress Mu (multiuser) has merged with WordPress 3.* so the older WordPress Mu platform is now deprecated. No need to install that platform if you need a multiuser version of WordPress.

If you intend to use WP multiuser, that is another reason to install your own test / development server.
Setting up and running a multi-site installation is more complex than a single-site install. Reading this page should help you to decide if you really need a multi-site install, and what might be involved with creating one. If the instructions on this page make no sense to you, be sure to test things on a development site first, rather than your live site
Source: http://codex.wordpress.org/Create_A_Network

Also notet from the same article that
Server Requirements

Since this feature requires extra server setup and more technical ability, please check with your webhost and ask if they support the use of this feature. It is not recommended to try this on shared hosting.
Since we adhere to the DRY (Don't Repeat Yourself) and minimalism principle, our philosopy is:

"The top of laciness is to do everything correct the first time." So think ahead and ask yourself whether you need a server for your (multi)blog platform.

See also:
http://codex.wordpress.org/Migrating_Mu ... _Multisite

http://wpmu.org/wordpress-multisite-ref ... odex-page/

http://www.webdesigncompany.net/wordpre ... ite-setup/

http://www.youtube.com/watch?v=ndLEVwBA ... r_embedded and related videos.

4. WordPress eCommerce.
Setting up a development server is especially important if you want to make a WordPress powered eCommerce site.
Setting up an e-commerce site is much different from a personal website or blog. Having a testing platform is especially important once we deploy the initial site. Without a testing ground, one little accident or mistake can make your site non-functional, and a broken e-commerce site is of little use to anyone. I implore you not to ignore this warning, and yes, it can happen to you, even through no fault of your own. Perhaps a newly installed plugin disagreed explosively with an existing plugin. Perhaps a WordPress update went awry. No matter what the issue, test all changes and updates before rolling them out to the production server.
Source: http://www.packtpub.com/wordpress-2-9-e-commerce/book page 20.

Install WordPress in the htdocs folder and the WordPress eCommerce plugin: http://getshopped.org/ in <your WordPress install>/wp-content/plugins/<name of plugin>/ subfolder. See the plugin section below if you are in doubt. We recommend that you buy the Packt Publishing eCommerce book if you want to turn your WordPress powered site into an eCommerce site.

This book explains how to use the http://getshopped.org/ eCommerce plugin. There are a lot of other eCommerce related plugins. You get an overview in your dashboard by clicking the plugin link, enter the search term eCommerce and hit search. You have to search for WP e-Commerce to locate the eCommerce plugin that is used in that book.

Related links:
http://wordpress.org/extend/plugins/wp-e-commerce/

http://wordpress.org/support/topic/upda ... ropshop-20

http://wordpress.org/support/topic/upda ... mmerce-350

http://www.shopify.com/

Litterature: http://www.packtpub.com/wordpress-2-9-e-commerce/book

5. Theme switch, tweaks and design
It is very easy to install and activate a new theme. In the dashboard click Appearance + Install Themes and search for themes in different ways available on that page. Once you find a theme you like, install and activate it and point your browser at http://localhost/wordpress/ to see it in action on your test server. Note that some themes miss some functionality. As an example I had a lot of trouble with a theme that did not have a 404.php custom error page. My custom 404.htm error page did not function after I changed the perma links from the default. First I had to change my root .htacces file, so it contains this

Code: Select all

# BEGIN WordPress
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteBase /blog/
#RewriteBase / DOES NOT FUNCTION EITHER
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
</IfModule>
# END WordPress
# The following code did not function after writing in the above wordpress code.
# '404 Not Found' error
# ErrorDocument 404 /404.htm

code.

Then I had to write my own custom 404.php error page as explained here:

http://codex.wordpress.org/Creating_an_Error_404_Page

Note, that if you change the message string in the first argument of the

Code: Select all

<?php _e(   
function in the default 404.php file to a long string, don't forget to enclose it in ' ' (single quotes). I kept the second argument of the function 'twentyten' unchanged.

Then everything was fine.

A god place to start if you want to make your own themes by tweaking minimalistic existing themes is:
http://www.plaintxt.org/

You get an overview of more than thousand themes here:
http://wordpress.org/extend/themes/

If you need to design your own themes from scratch, search:

wordpress theme design

The full path to your WordPress themes is: <your WordPress install>/wp-content/themes/<name of theme>/. You can of course load any theme in your preferred editor (some editors are listed here: http://www.oopschool.com/phpBB3/viewtop ... f=17&t=176 ) and modify and then save it. You can also use the inbuilt editor that you load from the Appearance menu in your Dashboard, that can be used for simple modifications. Read more here:

http://codex.wordpress.org/Theme_Development

if you intend to develop your own themes.

Popular themes are listed here:
http://wordpress.org/extend/themes/browse/popular/

6. Plugins and related resources
There are a lot of WordPress plugins available and more are added each day. One very important plugin is the WP-DB-Backup: http://bit.ly/db-backup. That allows you to back up your WordPress database. Don't overlook this plugin as the last thing you want is to have your server hacked and no database backup to restore it. Read more here: http://wordpress.org/extend/plugins/wp-db-backup/

Blog comment spam can be very frustrating. You can easily remove the ability to write comments on your post. If you prefer to allow comments, you should use the http://akismet.com/ or a similar http://www.polepositionmarketing.com/li ... -spamfree/ spam killer. As your competence grow, you will start editing themes in the inbuilt or an external editor. Making your own teams is limited by your ability to write CSS. To make your own WordPress plugins, you need to know server (php) and browser (JavaScript) scripting. Navigate to:
<your WordPress install>/wp-content/plugins/<name of plugin>/.

Generally a plugin is located in the <your WordPress install>/wp-content/plugins/<name of plugin>/ folder. By default, the above mentioned akismet plugin is installed on my computer. If you look at the content of that plugin, you will note that it contains some php files, a JavaScript, a CSS and some other including a readme file. If you understand CSS, JS and PHP, you can see how that plugin is written. WordPress Plugin Development – Relate Posts as a Series – Part 1/2:
http://www.1stwebdesigner.com/css/wordp ... ts-part-1/ is a simple example of how you create a WordPress plugin.

Also read from the mouth of the horse:

http://codex.wordpress.org/Writing_a_Plugin

if you intend to make your own plugins. Here:

http://wordpress.org/extend/plugins/

is a list of available plugins. While I write these words, there are 14 354 plugins that are listed on the page. If your already know php, look at the code of a plugin that catch your interest.

As a final example, let us say that you want to implement a simple game on your WordPress site. Also note that WordPress can be modified to make ordinary sites. It need not be a blog. If you want to put a simple game application on your site, the soultion may already be there. A rude rule of thumb says that if you are looking for a php solution there is a 99% chance that there is a solution on the internet already. Your search abilities limit your options. May be we can one day say the same about WP plugins, or at least with 75 % probability of finding what you are looking for by intelligent queries: http://www.surftoolbar.com/

So, if I Google: wp "game plugin"

I get 179 000 hits in may 2011, where the firs hit is this: http://www.dimensionex.net/en/wordpress ... plugin.htm that I have not tested.

If you search for game on the http://wordpress.org/extend/plugins/ page, I get 208 hits in may 2011. If you Google: wp "chess plugin" you get more than 2000 hits. A search for chess on the WP plugin page, gives 13 hits in may 2011.

Here http://wpmu.org/11-wordpress-game-plugi ... un-factor/ is a list of 11 Wp Game plugins.

A last word of warning. Generally you should be more careful with plugins that you find on search engine result pages than on the WordPress plugin page.

Some useful links:
http://wordpress.org/extend/plugins/browse/popular/

http://wordpress.org/extend/plugins/all ... -seo-pack/

http://wordpress.org/extend/plugins/easytube/

http://wordpress.org/extend/plugins/pag ... tallation/

Litterature: http://www.wrox.com/WileyCDA/WroxTitle/ ... 75307.html

7. WordPress on mobile platforms
Matt Mullenweg runs the site http://automattic.com/ and he is still highly involved in the WordPress project. A quick scan of the home page shows that some of the focus is now on mobile solutions. The general place to look for WordPress mobile apps is here: http://wordpress.org/extend/mobile/.

As an example, you want to transform your blog into and iPhone application and you locate the WPTouch: http://wordpress.org/extend/plugins/wptouch/ theme that does the job. The information is available at your fingertips. Also note:
Awesome iPad theme support is now available in WPtouch Pro 2.1!!!

For more information visit http://www.bravenewcode.com/wptouch-pro

If you look for a mobile plugin, you can start by looking at plugins with the mobile tag in the WordPress Plugins Repository:
http://wordpress.org/extend/plugins/tags/mobile

The general solution is to go to the WordPress themes http://wordpress.org/extend/themes/ and / or the plugin http://wordpress.org/extend/plugins/ page and make the relevant query. As an example, the KW mobile lists 350 plugins and 7 themes. At the bottom of the theme list, there is a message saying: You may also try your search at Google, that loads this

site:http://wordpress.org/extend/themes/ mobile

query if you click the link. As many other web masters have discovered, GoogleBOT may index new content on a popular site within minutes, sometimes, even before you have finished editing a post or article. So using the above Google query, can give you more hits than the on site search tool itself.

8. WordPress and jQuery
If you browse to the <your WordPress install>/wp-includes/js/ folder, you will note that there is a subfolder named jquery where jQuery is installed.
jQuery and several other JavaScript libraries and plugins have been bundled and are available through WordPress' Script API through a function called wp_enqueue_script:
http://codex.wordpress.org/Function_Ref ... eue_script.

There is an altenativ way to use jQuery, namely through Google Code's Code Distribution Network (CDN) and that may be a better solutions since it can save bandwith and it is easy to get the most current version of jQuery. To include jQuery from Google Code's CDN, you must deregister jQuery and then register through Google's CDN.

jQuery is one of the most popular JavaScript libraries. As an example, jQuery can be used to easily integrate AJAX functionality into your WordPress site. In a nutshell, using a library or a framework in you php / JavaScript driven sites, can dramtically increase your productivity, since it can abstract away e.g. the need to hard code low level functionality like browser sniffing. Read more about JavaScript, jQuery and AJAX here:
http://www.oopschool.com/phpBB3/viewtop ... f=32&t=187.

If you Google: wp "jquery plugins"

you get more than 300 000 hits. If you execute the same query at the http://wordpress.org/extend/plugins/ page, you get 1000+ hits.

9. Some useful links

http://gmpg.org/xfn/

http://gravatar.com/

http://codex.wordpress.org/Using_Permalinks

http://www.tutorio.com/tutorial/enable- ... -on-apache

http://www.helicontech.com/isapi_rewrite/

10. Example WordPress sites

http://headkeys.com/most+popular+wordpress+blogs

http://botd.wordpress.com/

http://www.bestpsdtohtml.com/35-amazing ... wordpress/

11. Keep yourself up to date on WordPress development
WordPress is growing so fast as a development platform, that it is easy to drown in new information. A simple strategy to keep your self up to date is:
  1. Read about new functionality in major upgrades on the WordPress site itself.
  2. Visit the news page: http://wordpress.org/news/ and the related list of releases page http://wordpress.org/news/category/releases/
  3. Read about new functionality in major upgrades on the WordPress site itself.
  4. Scan and read posts of interest on the WordPress froums: http://wordpress.org/support/
As an example, assume you are interested in iPhone, iPad, themes for mobile platforms generally. In addition you are also interested in SEO, eCommerce, spam plugins etc. You can of course search on the WordPress site, but you can also do a search from your WordPress DashBoard. So what do you do? Reread this post if you did not get how that is done. Hint: Go to your WordPreess DashBoard and ...

Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests