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:
- Microsoft 2008 C++ Runtime (x86) - Required by PHP for x86 and x64 systems
- Microsoft 2008 C++ Runtime (x64) - Required by PHP for x64 systems
- Microsoft .NET Framework 2.0 Service Pack 2 - Required by FusionLeaf Studio.exe
Instructions to set up Nginx, MySQL, and PHP:
- Download the latest version of FusionLeaf Stack
- Extract FusionLeaf Stack to a folder
- Double click on FusionLeaf Studio.exe (complete control utility for all the software)
- Click Start
- If you are prompted with Firewall prompts, please click Allow or Unblock (there should be 3 of them)
- Click Browser -> http://localhost
- 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:
- From FusionLeaf Studio.exe, click Automation -> PHP -> PEAR -> Install
- Type: local -> Press Enter
- Type: yes -> Press Enter twice
- Click Automation -> PHP -> PHPUnit -> Install
- Press Enter
- 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:
- From FusionLeaf Studio.exe, click Automation -> FusionLeaf -> Remove CMS from Localhost folder
- 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:
- If you open your web browser to http://localhost, Nginx will traverse into the webroot\localhost folder and look for index.php
- If you open your web browser to http://www.fusionleaf.net, Nginx will traverse into the webroot\fusionleafnet\www 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:
- Navigate to the webroot\fusionleafnet folder
- Create a new folder: forum
- Write your web code or extract the MyBB code in the forum folder
- 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