New Website

I've made a new website, as lynx.io is dead. You can find it here: http://macr.ae/—it's similar in format to lynx.io, but has better articles, and they're all written by me.

JavaScript disabled

While it will still mostly work, a lot of this site's functionality relies on JavaScript - please enable it for the best experience.

How to set up a PHP/MySQL Server on Windows

In this tutorial I will describe the process of configuring a PHP and MySQL server on a Windows computer with running the Apache Web Server version 2.2. This configuration is ideal for developing websites on your own computer, without the need for a server.

There are many other methods to achieve this, and it is not limited to running on Windows or Apache, however this is most common configuration for developers. There are many other guides available on the internet describing setting up PHP and MySQL on other configurations.

The procedure for installation will be:

Prerequisites

You will need the following to be able to follow this tutorial successfully:

Installing MySQL

  1. The first step it to install MySQL onto your computer. To start run the file with the extension .msi
  2. Choose the typical installation option and click “Next”
  3. Now click the “Install” button
  4. Wait for the installation to complete, then opt to not register with the MySQL website
  5. Ensure that the option to start the MySQL Config Wizard is selected and click “Finish”.
  6. The MySQL Config Wizard will now open; press “Next” to proceed
  7. Select “Detailed Configuration” and click “Next”
  8. Now select “Developer Machine” if this is for developers, or “Server Machine” for servers, then press “Next”
  9. Select “Multifunctional Database” then click “Next”
  10. If “InnoDB Tablespace Settings” appears just click “Next”
  11. Select “Decision Support (DSS) / OLAP” and click “Next”
  12. Ensure that both “Enable TCP/IP Networking” and “Enable strict mode” are both selected, then click “Next”
  13. Select “Standard Character Set” for Western scripts (eg English, French, German) or “Bes t Support for Multilingualism” if you want to support different scripts (eg Arabic). Then click “Next”
  14. Ensure that “Install as Windows Service” is ticked then press “Next”
  15. This page is the security of the MySQL server. It is best to change the password for the root account, but make a note of it because it impossible to recover. Ensure that “enable root access from remote machines” is NOT ticked and “create an anonymous account” is also NOT ticked. Then click “Next”
  16. Now press “Execute”

You have now successfully installed MySQL.

Installing PHP

  1. Run the PHP installer file
  2. Click “Next” on the welcome page
  3. Agree to the license agreement and click “Next”
  4. The default installation directory is fine, but you can change it here. When you’re happy with it, click “Next”
  5. Select “Apache 2.2.x Module” from the list of Web Servers, then click “Next”
  6. Click “Browse…” to navigate to the Apache Configuration Directory (by default C:\Program Files\Apache Software Foundation\Apache2.2\conf ), then click “Next”
  7. The default settings for the items to install are fine, but if you wish to install extras, such as PHP manual, extra extensions, you can do so here. Once you’re happy, click “Next”
  8. If you wish to review any settings, now click “Back”. If you’re happy, click “Next”
  9. The PHP installer will now install everything which takes one or two minutes on a modern computer
  10. Once complete you should see the following page. Click “Finish” to exit the installer.

Finalising & Testing

PHP & MySQL have both now been installed; however everything isn’t quite finished yet. You should now:

  1. Restart the Apache service. You can do this either:
    • Through the Start Menu: navigate to All Programs, Apache, Restart
    • Through the Services application: Start, Run, type “services.msc”, find Apache2.2, right click and select “Restart”
    • Restarting your computer
  2. Test that it has installed correctly
    • Do this by creating a page called test.php with the following text:
      <?php phpinfo(); ?>
      Then, open a web browser, browse to test.php on your server and request the page. You should see a page detailing your PHP configuration.
  3. Remember to re-enable your anti-virus if you disabled it

PHP & MySQL should now be successfully set up on your computer! Have fun with developing interactive web applications!

Further Reading

Detailed instruction on the installation of MySQL, along with screenshots, can be found at:

http://dev.mysql.com/doc/refman/5.1/en/windows-install-wizard.html

http://dev.mysql.com/doc/refman/5.1/en/mysql-config-wizard-starting.html

About Sam Haines:

Sam Haines is a web developer and has been making websites and experimenting with various web technologies for the past five years.

You can view more articles by this author here.

Tags: server php mysql install

Comments

No comments; leave one below.

says:

Add comment

 

You can use markdown in comments (press "m" for a cheatsheet).

Enable JavaScript to post a comment

Markdown Cheat Sheet

# This is an <h1> tag
## This an <h2> tag
###### This is an <h6> tag

Inline markup: _this text is italic_, **this is bold**, and `code()`.

[Link text](link URL "Optional title")
[Google](http://google.com/ "Google!")

![Alt text](image URL)

![This is a fish](images/fish.jpg)

1. Ordered list item 1
2. Ordered list item 2

* Unordered list item 1
* Unordered list item 2
* Item 2a
* Item 2b

And some code:

// Code is indented by one tab
echo 'Hello world!';

Horizontal rules are done using four or more hyphens:

----

> This is a blockquote

This is an <h1> tag

This an <h2> tag

This is an <h6> tag

Inline markup: this text is italic, this is bold, and code().

Link text Google

This is a fish

  1. Ordered list item 1
  2. Ordered list item 2
  • Unordered list item 1
  • Unordered list item 2
    • Item 2a
    • Item 2b

And some code:

// Code is indented by one tab
echo 'Hello world!';

Horizontal rules are done using four or more hyphens:


This is a blockquote

Toggle MarkDown / HTML (t), full reference or close this