Skip to main content

Installing NGINX with PHP and MySQL

My OS: Windows 7 Home Premuim 64bit

Software Installed:

  1. NGINX 0.9.5 for Windows
  2. PHP:
  3. MySQL: mysql-5.5.9-winx64.msi
NGINX Installation
  1. Unzip into C:\nginx
  2. Change the nginx.conf in C:\nginx\conf as per instructions at
  3. See my nginx.conf file here.
Note that in this example, it is assumed that PHP is installed in C:\nginx\php (unzipped into this folder) and MySQl is installed in C:\Program Files\MySQL

PHP Installation
  1. After downloading the zip version of PHP (V6, threadsafe, zip), unzip into C:\nginx\php\
  2. Rename php.ini-production to php.ini
  3. Make changes to this file as given in at but do not expect the line numbers given to match exactly. Activate the extensions extension=php_mysql.dll and extension_dir  = "ext"

MySQL Installation

  1. After downloading the latest VC6 version, run the installer and follow the directions provided at
  2. Set the root password and note it somewhere. You will need it to manage the server.
  3. To manage the MySQL server, I would advice you use the mysql.exe console program in the bin directory of the MySQL installation folder. MySQL Administrator was a good GUI tool to administer MySQl but has been discontinued. MySQlL Workbench is a very messy tool that I guess you could figure out how to use if you have the time. I don’t. MySQL.exe is a command line tool. See tutorial at: In my case, I created a database called coursesb, created a table in this database and then used the LOAD INFILE command to load MS Excel data saved as a CSV file (comma delimited). Example:
Note the CSV file’s location is given as an absolute path.

My table creation was achieved with the following:
title VARCHAR(100) NOT NULL,

Environmental Variables

Both the location of PHP and MySQL are added to the PATH variable. In my case the paths included are: C:\nginx\php;C:\Program Files\MySQL\MySQL Server 5.5\bin

Starting and Stopping NGINX, PHP and MySQL

In my installation, the following are used to start the servers. They are in C:\nginx where the “RunHiddenConsole.exe” is also located(download from: ). The VBS scripts prevent the console window from showing. RunHiddenConsole.exe is also supposed to do the same but doesn’t seem to work. The actual file to run is “start.vbs” You can create a shortcut on your desktop or START menu.

Table : start.bat
ECHO Starting PHP FastCGI...
RunHiddenConsole.exe C:\nginx\php\php-cgi.exe -b
ECHO Starting nginx...
ECHO Starting MySQL...
RunHiddenConsole.exe "C:\Program Files\MySQL\MySQL Server 5.5\bin\mysqld" --defaults-file="C:\Program Files\MySQL\MySQL Server 5.5\my.ini"

Table : start.vbs
Dim sh
Set sh = WScript.CreateObject("WScript.Shell") "start.bat", 0
Set sh = Nothing

Table : stop.bat

nginx -s quit
net stop MySQL
taskkill /f /IM php-cgi.exe

Table : stop.vbs
Dim sh
Set sh = WScript.CreateObject("WScript.Shell") "stop.bat", 0
Set sh = Nothing

MySQL should already be running as a service that starts with Windows. The stop.bat scripts should stop MySQL server. Note that you should see php-cgi.exe in memory. NGINX used FastCGI implemented by php-cgi.exe

Test PHP

To test PHP, create the following PHP file and load it using the URL http://localhost/text.php

Test.php is shown below:

Table : test.php


Output of test.php:


Popular posts from this blog

How to Install RIOT Plugin for GIMP

How to Install RIOT Plugin for GIMP:: Since this article was first written a stand-alone version of RIOT has been made available Download the plugin from the download link titled "RIOT as plug-in for other applications"   Launch the Riot-plugin.exe file by double clicking.The installer installs all the files including Riot.exe, Riot.dll, and FreeImage.dll in the location where you installed GIMP  If GIMP is open, close it and re-launch it.To optimise an image, open it then save with menu File-&gt;Save for web with RIOT  You can set the target file size by selecting "Compress to size" button  on bottom right corner of optimised image pane and providing the size in kilobytes. Alternatively you can use a slider provided to allow you to change the quality while showing you a preview of the resulting image.


Acer Aspire V5-471 Solution to "Operating System Not Found" After Changing From UEFI to BIOS

If you deliberately or accidentally change an Acer Aspire V5-471 (probably other Acers as well) boot setting from UEFI to BIOS, then you may be in for a shock when you try to start the laptop.

You may get the message Operating System Not Found on the top left corner of your screen or something similar.

Ideally you can press F2 during booting and get into booting settings and change them but in my case F2 does not work! Nothing works - neither a bootable DVD, bootable USB drive or whatever else you throw at it to try to get the machine to wake from coma.

You could spend a year searching various forums. You will learn very little. Some will call you dumb for messing up your BIOS settings.

The answer came from a very smart guy from Nakuru, Kenya called Weru (it means Savannah as in Savannah Institute for Business and Informatics). Open the machine's casing. Pull out the motherboard. Remove the BIOS button battery.

In the laptop motherboard above, the battery in the round whitish obj…

How to Stream Live With Your Smartphone

Using Larix Broadcaster , you can stream live video and audio from a smartphone running Android, IOS or Windows. The steps are:
Download and install Larix from the link above.Configure LarixTest with the streaming server provided by whomever is hosting your live streamWhen requested, start sending your stream.
Before giving details explanations of how to configure Larix, its important to note one of two things about the stream:
Many people may be watching worldwide and its important to test and then, during the live stream, ensure only acceptable video and audio are sent to the server. The Larix website illustrates the connection between your phone, server and the viewer devices. Clear video requires planning your shot - from which direction? is the lighting good? will bright lights interfere? Is there traffic noise or other interference.Maintain your smartphone in  landscape orientationIf more than one person are to stream to the same server, be on standby and start your stream promptly…