ICT Support & Solution


Coderdojo – Edited Version

As a few people are aware, there was a problem with Apache on Windows Operating Systems. This is apparently due to Windows not including Visual Studio C++ Redistribution for Visual Studio 2012, which can be downloaded here . Choose the download button and choose 32bit (x86) or 64bit (x64) depending on your system and then try the httpd.exe. -k  install cmd.

Creating a Local Environment

This page will show you how to create a local environment to run PHP and MySQL driven websites right from your own PC and allow you to share your site across your network.

A good example for creating a local web environment is using wordpress locally. There are no long uploads, waiting around until something has completed, before moving on to the next step. Its all done right on your machine and easy to check for errors, without crashing your site.

This is for Windows 10 .

First we need to install the server code so the webpages can be queried.

Download Apache http://www.apachelounge.com/download/ choose either 32bit or 64bit depending what your machine is running.

Now we need to download PHP, which is the code that sits inside the website and does the querying.

PHP http://windows.php.net/download/ choose version 5 as its well supported and probably the most popular version. If you need support with your code in the future, plenty of coders will be willing to help. I’ve had a lot of help from http://codewalkers.com

Then get the database software MySQL so the data can be collected and stored and fetched when ever the PHP code calls for it. http://dev.mysql.com/downloads/mysql/

I’m afraid that not everything is completed yet. There are a few fiddly bits we have to change before we can start writing our website.

Once you’ve downloaded the PHP zip file, you’ll need to expand it, copy the files out, create a new folder called PHP on your C:/ drive and paste the contents you’ve copied into the PHP folder.

You’ll now need to access the Apache24 folder on your C:/ drive and find the conf folder and find http.conf to edit using notepad.

Scroll to the bottom of the httpd.conf file and type these lines of code at the end to configure the path to the php.ini file:

LoadModule php5_module “c:/php/php5apache2_4.dll”
AddHandler application\x-httpd-php .php
PHPIniDir “C:\php”

Now save the http.conf file you’ve edited by clicking Save.

Don’t close the httpd.conf file just yet. You still have a few more changes to make so your Apache server will work correctly.

Hit the CTRL and F key on your keyboard so your find box appears and type:


You may run into problems finding these entries using the notepads find tool. Use the UP and DOWN the page option to boost the search

Let Notepad find the line of code and you should see index.html after DirectorIndex. Change the html to php so it looks like this:


This will tell the server to use the index.php document as its first port of call when loading your site once you’ve built it.

Now open the find box again and type:


Change the www.example.com:80 to localhost

Now save the file and close it.

Now to tell your computer to install Apache. You will need administration rights for this next piece. Search your programs for the command terminal, by typing cmd in your operating systems search tool. Before you open it, right-click and choose “open as administrator” or word to that effect.

When the cmd window appears, type:

c:\Apache24\bin\httpd k install

You should see a box appear asking about firewall. Accept these for your local network.

The cmd line will now execute and start to test your system for reliability.

You may be required to add your Apache24 to your systems environments.

  • Right click you window button (bottom left of the screen) and choose systems.
  • Choose Advanced System setting from the left of the window.
  • Make sure the Advanced tab is selected on the window that opens and choose Environment Variable.
  •  Scroll through the System Variables until you find Path
  • Double click Path and hit the New button on the right of the widow that opens
  • add these lines
    • C:\php
    • C:\Apache24
    • C:\Apache24\bin
  • Click OK, OK and OK again to return to the Systems window.

Now lets check if this has successfully got our server running by returning to the cmd window and typing:

c:\Apache24\bin\httpd -s

You should see a list of items all running on your systems looking like this:

virtualhost configuration:
ServerRoot: “C:\Apache24”
Main DocumentRoot: “C:\Apache24\ht docs”
Main ErrorLog: “C:\Apache24\logs\errors.log”


If you only see a list of Help strings, then there’s something wrong. It’s either the wrong version of C++ Visual Studio Redistribution or you might have other dedicated HTTP software running. If the latter, then there are going to be problems. You’ll need to stop Apache using cmd and typing:

cd C:/Apache24/bin [press enter]

httpd.exe -k stop

Then try starting Apache again with:

httpd.exe -k start

If it throws up words like forbidden and access permisions, you’ve got something blocking the ports so try changing directoy back to system32 typing:

cd C:/Windows/System32 [press enter]

net stop W3SVC

Which will stop any IIS6/7 applications running on the same port. Then try typing

net stop http /y [press enter]

sc config http start=disabled [press enter]

cd C:/Apache24/bin [press enter]

httpd.exe -k start [press enter]

Now we have to do a bit more configuration to tell PHP what we want it to do. Browse to your C:\ drive folder and open the PHP folder and find the file php.ini-development

Right-click file and chose rename and  change the name of the file to:


Open the php.ini file and find these lines of code, using the notepads find tool:

; extensionDir = “ext”

and remove the ; before it.

Do the same for:

; extension=php_mysql.dll
; extension=php_mysqli.dll

so they look like this

extensionDir = “ext”

Now go back to cmd and we need to go back to start in our root directory by typing:

.. cd

Do this twice and you’ll see the the curser drop back from c:\windows\system> to c:\

Now to the change directory to the php folder by typing:

cd php

so your line should look like this:


We’re going to list all the modules that php has configured, so type:

php -m

This will list all of the modules if everything is installed properly.

It would be good to restart your system to make sure all of the services start to run correctly before you begin using your new environment.

When your systems does its boot recycle, open your favourite web browser and type:


and you should see a page listing an index.html file.

Now you need to find where these files are being stored.

Go to your C:\Apache24\htdocs folder ad you will see the index file that is displayed on your localhost page.

That’s great! but where is the php and why can’t we see it?

You will need to create it and place the file the directory C:\Apache24\htdocs for it to work

Right-click anywhere on the C:\Apache24\htdocs window and chose New and Text Document  and when the file is created, change the name to:


right-click and choose edit, with notepad and type:

<?php phpinfo() ?>

save the document and return to your web browser to refresh it so the info.php file is seen in the list.

Click on the info.php link and the info for your php config installation should appear on the page.

OK – Looking good! (Thats if your info.php file is visible) This tells us that php is running ok and php need Apache to make it run so it also tells us Apache is running too!

Now to install MySQL for the database.

Find the package you downloaded earlier. It should be called:


Double-click to open it and choose Custom from the options and chose Next.

From the options on the left, tap on the [+] symbol next to MySQL Server until you see the options for x86(32bit) and x64(64bit) software and choose the right one for your machine and drag it, or select it and taping on the arrow button to move the option to the empty window on the right, but don’t chose Next yet. Find the Advanced link below the box on the right and chose it.

To prevent security and permissions issues, change the Install Directory (top box) from:

C:\Program Files\MySQL\MySQL Server 5.7


C:\MySQL\MySQL Server 5.7

by removing the \Program Files\ then click OK and chose Next and Execute.

You will now have MySQL installed on your system and now we have to set up a database.

Now for the juicy bit! Starting to write the code!

Well, I’m starving right now so need food, so I’m going to get some. If you want to know more about building php sites, find me at @mcrcoderdojo http://mcrcoderdojo.org.uk on Sunday or the next Wythydojo @wythydojo http://wythydojo.co.uk

Follow me: @cwjsupport