Home > Articles > Home & Office Computing

This chapter is from the book

This chapter is from the book

Hosting WordPress Yourself

You can install the WordPress software on any computer with web server software installed, even if that computer has no permanent connection to the Internet. That means you could even use that old computer with the dial-up modem (or none at all) that has been gathering dust in your basement. Why would you want to have WordPress installed on your own computer? How would people read your blog if it wasn't connected to the Internet? We can think of at least four good reasons to install WordPress on your system—even if your "real" WordPress blog was hosted somewhere else, be it WordPress.com or at your own host:

  • You are an angry person and view blog posts as a way of venting steam. You want a place to tell your boss what you really think of him without threatening your career. Plus, you like the WordPress visual editor and don't need a full-blown, feature-rich web design tool to write.
  • You have been on WordPress.com for a while and want to see whether you can install the WordPress software yourself before committing to buying a domain name and a year's worth of hosting fees.
  • You are considering changing themes and adding plug-ins, and you want to test things out before going live on the Web.
  • You want to create new WordPress themes and plug-ins and don't want to upload your files to the Web each time you modify one character in the code.

In practical terms, you don't need a reason to give the install a try. With enough time, disk space, and bandwidth, you can do this. With an average high-speed Internet connection, you can complete all of these tasks—downloading and installing an Apache web server, a MySQL database, and WordPress—in about a half hour. We're here to help.

In this section, we'll install a web server on a Windows system and get you ready for the WordPress installation. We'll also show you how to edit the WordPress configuration file manually.

Installing a Test Web Server and MySQL Database

If you are running the Windows operating system (no matter the version), you need to download several applications to successfully run WordPress on your computer: That includes a web server application, the MySQL database, and the WordPress software. If you want to develop plug-ins, you also need the PHP scripting language.

The good news is that the cost of all this software is $0. Yes, that's right; it's free. Another piece of good news is that software developers have packaged the server app and database in a single download for Windows, so there's only one thing to install. The bad news is that you have to invest some time and effort to get it all running.

There are several packages of what is called the WAMP (Windows Apache MySQL and PHP/Perl) Stack available for download. We have had the best experience with XAMPP from the Apache Friends. The X takes the place of the underlying operating system—Windows, Linux, and Macintosh OS X. In this section, we show you how to install and configure XAMPP in Windows to prepare for your WordPress installation. The process in other operating systems should be similar, if not exactly the same.

  1. Download XAMPP from http://apachefriends.org/en/xampp.html.
  2. Install XAMPP by double-clicking on the downloaded file. At the end of the installation, a command-line shell will appear, and the install program will ask you some questions. Unless you know to do differently, accept the defaults.
  3. When the final menu comes up, select Start XAMPP Control Panel.
  4. Start the Apache and MySQL services by clicking the Svc check box next to each module (see Figure 11.20). You'll be asked to confirm each service start.
    Figure 11.20

    Figure 11.20 Start the Apache Web Server and MySQL database services in Windows through the XAMPP Control Panel.

  5. Start the Apache server by clicking the Start button associated with it. Windows Vista and Windows 7 users might see a User Account Control dialog box asking whether you really want to install this application. Click Yes. When it starts, the Control Panel will say it's running, and the Admin button will be active.
  6. Start MySQL the same way. The shell-like status window at the bottom of the Control Panel will also indicate that each service started.
  7. Open a browser and type http://localhost/xampp in the address bar. If Apache is running, you'll first be asked to define your language, and then (if you select English) the screen will look like Figure 11.21.
    Figure 11.21

    Figure 11.21 A successful configuration of Apache through XAMPP!

  8. Open phpMyAdmin to create and configure the database. Go back to the XAMPP Control Panel. Click Admin next to MySQL to launch phpMyAdmin, or click phpMyAdmin in the Tools section from the XAMPP admin page shown in Figure 11.21. This application serves as a graphical front end to the MySQL command-line administrative tool. It's written in the PHP scripting language, as is WordPress. The remaining steps should mirror the database creation steps in the earlier section "Preparing for the Five-Minute Hosted WordPress Installation."
  9. Go to the Privileges tab. Click Add a New User.
  10. In the User Name field, type WordPress (or some other name; see the earlier tip on database user naming). Under Host, use Local. Type a password or use Generate Password (for a more secure, if less memorable, password).
  11. Under Database for User, click Create Database with Same Name and Grant All Privileges, as shown in Figure 11.22. Scroll to the bottom and click the Go button. phpMyAdmin generates the appropriate MySQL commands and displays them under the phrase You Have Added a New User.
    Figure 11.22

    Figure 11.22 Set up the WordPress database from your browser with phpMyAdmin.

  12. Click the Databases tab, and you will see WordPress on the list of existing databases. Click the link to open the database.
  13. Click the Privileges tab to see the list of "Users Having Access to WordPress." Your WordPress user should have All Privileges, and Grant should say Yes, as shown in Figure 11.23. If this is not correct, click the Action box at the end of the row and make sure every database-related privilege box is checked. Scroll to the bottom of the page and click Go when you're finished.
    Figure 11.23

    Figure 11.23 Make sure your WordPress user has all privileges, including Grant, to your database.

  14. Close phpMyAdmin.

Now that you have the web server and database configured, all you need is a fresh copy of WordPress. Download the latest version of WordPress at http://wordpress.org/download and extract it to the XAMPP\htdocs folder.

Editing the WordPress Configuration File

Now the real fun begins. When we configured WordPress on a separate host, we used the WordPress online form. This time, we'll get our hands dirty editing the raw configuration file.

You'll need to open a text editor, such as Notepad, to edit the WordPress configuration file. Be sure you use a text editor, and not a word processor, like OpenOffice Writer or Microsoft Word. Word processors add formatting codes and assorted characters that will confuse your web server and WordPress when it tries to figure out what your configuration choices are. Web servers look for plain text, and you should deliver it to them.

But first, go to Windows Explorer and locate the sample. If you followed the instructions in this chapter, this file should be located at C:\XAMPP\htdocs\WordPress\wp-config-sample.php. Yes, this is a PHP code file, but don't panic. There's not much you need to do here because the comments included in the file are easy to understand. Besides, if you do get confused, we're here to help.

Before you do anything else, click File, Save As to remove the text "sample" from the filename. Save the file as wp-config.php. That way, in the unlikely event something goes wrong, you will always have the sample to return to.

The first section of this file allows WordPress to communicate with the database you've just created. The section should look like this:

/** The name of the database for WordPress */
define('DB_NAME', 'putyourdbnamehere');

/** MySQL database username */
define('DB_USER', 'usernamehere');

/** MySQL database password */
define('DB_PASSWORD', 'yourpasswordhere');

/** MySQL hostname */
define('DB_HOST', 'localhost');

/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8');

/** The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', '');

There are but a few lines to edit in this section:

  • Where it says putyourdbnamehere, replace it with the name of your database (wordpress). Make sure the name is inside the quotation marks; otherwise, it won't work.
  • Where it says usernamehere, replace it with the username you entered in step 10 from the preceding section (which should be the same as the name of the database).
  • Where it says yourpasswordhere, replace it with the password you entered in step 10 from the preceding section.
  • Confirm that the DB_HOST line points to localhost. If it does, don't change it.

The last two items can usually be ignored. DB_CHARSET and DB_COLLATE relate to the character set used by the database. Unless you are using Cyrillic or Asian-language characters, leave these lines at the default settings.

The Authentication Unique Keys section of the configuration file is optional but can help secure your installation. Setting these keys makes it much harder for anyone bent on cracking your blog to steal your login information, and you don't need to remember the contents. This section looks like this:

* Authentication Unique Keys.
 *
 * Change these to different unique phrases!
 * You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/ WordPress.org secret-key service}
 * You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
 *
 * @since 2.6.0
 */
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');
/**#@-*/

At the top of the section, you'll see a link to the WordPress Secret Key service. Copy this address (http://api.wordpress.org/secret-key/1.1/) into your browser, and you'll see four highly secure keys generated for you and you alone. Copy all four lines and paste them back into this section of the wp-config file, replacing the default lines that ask you to put your unique phrase here.

The WordPress Database Table Prefix section exists for those who want to produce multiple blogs from this database. If that's you, WordPress needs to be able to differentiate this blog from your other blogs. It does this by creating separate database tables for each blog. We recommend using wp_ blogname as the identifying table prefix. Your hosting company might also have a recommendation on how to handle the Table Prefix. The section looks like this:

* WordPress Database Table prefix.
  *
  * You can have multiple installations in one database if you give each a unique
  * prefix. Only numbers, letters, and underscores please!
  */
 $table_prefix  = 'wp_';

The last section of the configuration file to worry about is the Localized Language section. This defaults to English; if you want to blog in another language, visit http://codex.wordpress.org/WordPress_in_Your_Language for information on how to set up WordPress in many languages. (That's 64 languages, as of this writing.)

* WordPress Localized Language, defaults to English.
  *
  * Change this to localize WordPress.  A corresponding MO file for the chosen
  * language must be installed to wp-content/languages. For example, install
  * de.mo to wp-content/languages and set WPLANG to 'de' to enable German
  * language support.
  */
 define ('WPLANG', '');

As the creators of wp-config-sample tell you, "That's all, stop editing! Happy blogging!" Save the file again. The hard work is done, and it's time to run the famous five-minute installation, as described earlier in this chapter in "The Five-Minute Hosted WordPress Installation" section.

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020