Set up Nginx, MySQL, PHP, PEAR, PHPUnit on Windows Quickly and Easily with FusionLeaf Stack

If you’ve ever tried to set up a web stack on your Windows computer, you’ll know how much time, work, and troubleshooting is required to get each of the pieces to work together correctly. I’ve got a single package that includes all the latest software. This tutorial will show you how to get the following software running happily on your computer with very little effort:

  • Nginx (web server)
  • MySQL (database engine)
  • PHP language
  • PEAR (PHP Extension and Application Repository)
  • PHPUnit (PHP Testing Framework)

Requirements:

Instructions to set up Nginx, MySQL, and PHP:

  1. Download the latest version of FusionLeaf Stack
  2. Extract FusionLeaf Stack to a folder
  3. Double click on FusionLeaf Studio.exe (complete control utility for all the software)
  4. Click Start
  5. If you are prompted with Firewall prompts, please click Allow or Unblock (there should be 3 of them)
  6. Click Browser -> http://localhost
  7. You should now see the FusionLeaf CMS configuration screen

At this point, Nginx, MySQL, and PHP can be controlled using FusionLeaf Studio. When you click the Start button, all the software runs in the background according to the settings you can specify in the Advanced tab. You can also view the Running Configurations in the View menu and edit the Startup Configurations in the Edit menu.

Instructions to set up PEAR and PHPUnit:

  1. From FusionLeaf Studio.exe, click Automation -> PHP -> PEAR -> Install
  2. Type: local -> Press Enter
  3. Type: yes -> Press Enter twice
  4. Click Automation -> PHP -> PHPUnit -> Install
  5. Press Enter
  6. PEAR and PHPUnit are now installed

DONE! Nginx, MySQL, PHP, PEAR, and PHPUnit are now all set up on Windows and an be controlled through FusionLeaf Studio. If you want to get more in-depth, keep reading.

Now how do you go about building a website? You can either use the FusionLeaf CMS which is included by default or you can use the menu items to remove FusionLeaf CMS and use another PHP application like Drupal, WordPress, SQL Buddy, MyBB, etc.

Remove FusionLeaf CMS:

  1. From FusionLeaf Studio.exe, click Automation -> FusionLeaf -> Remove CMS from Localhost folder
  2. Press OK

Click Open Folder -> Web Root (www). You should now see two folders (fusionleaf, localhost) and a file (404.htm). This directory is the web root used by Nginx to display websites. Nginx uses a special configuration designed by the FusionLeaf Team so websites can be added without restarting or modifying the Nginx.

For example:

  1. If you open your web browser to http://localhost, Nginx will traverse into the webrootlocalhost folder and look for index.php
  2. If you open your web browser to http://www.fusionleaf.net, Nginx will traverse into the webrootfusionleafnetwww folder and look for index.php

Example 2 above only works if you add the following to your hosts file (C:windowssystem32driversetchosts):

127.0.0.1 fusionleaf.net
127.0.0.1 www.fusionleaf.net

The FusionLeaf Team created the dynamic Nginx configuration so subdomains could be easily added or modified on the fly.

If you want to add the subdomain, forum.fusionleaf.net, you would:

  1. Navigate to the webrootfusionleafnet folder
  2. Create a new folder: forum
  3. Write your web code or extract the MyBB code in the forum folder
  4. Open your web browser to http://forum.fusionleaf.net

No configuration changes need to be made to Nginx for the new forum subdomain.

If you want to allow another PHP application to connect to the MySQL database, use the following settings:

  • Database Name: test
  • Username: root
  • Password: (blank)

Note: I recommend you use PHP Buddy to change the default password to a more complex password if the web application will be public facing.

That’s a brief tutorial. If you have any questions, feel free to post them in the comments section. Thanks!

More in-depth instructions can be found here: http://code.google.com/p/fusionleaf/wiki/stack_instructions

Leave a Reply