Installing the PHP environment - spaceshiptrooper [Style]


Hello guys and welcome to my tutorial!

Sorry I didn’t get a chance to write this tutorial a lot sooner. I’ve been sick for a bit and I’ve been pretty busy with starting spring classes and all. I’ve been also slacking on writing the tutorial so bare with me if some parts don’t really make sense. Where it doesn’t make sense, please post and ask questions. I can reply to them.

What is the reason behind this and why not do a screen cast?

So I decided to do a written tutorial instead of a screen cast video. The reason being is because I am a very picky person when it comes to recording. That means everything must be perfect. I don’t like random noises being in the background. This could be a family member screaming across the room or a neighbor mowing their lawn or even a car passing by. I really want my videos to be as professional as can be. So the only thing I actually want in the audio is either my voice or the static playing in the background. This to me is because other noises can distract the viewer from actually watching the video. It can also even be hard for the viewer to concentrate on what words I am using and saying. So I decided to do a written tutorial instead.


This tutorial assumes that you have a clean (newly installed) installation of your preferred OS. Even if it isn’t a clean installation, you can still do this on an OS that does not have the PHP environment already installed and if it does, you might want to check whether you want to keep the current PHP environment or proceed to using this tutorial. Nevertheless, I am NOT responsible for any loss data if you choose to continue so please be sure to ALWAYS backup your work.

This tutorial also assumes that you are using the latest versions of your preferred OS.

So let’s get started.

Table of Contents:

  1. Linux
  1. Windows


This is the snippet we will be using to test out if we can connect to our database or not.

The data structure.

-- Table structure for table `users`

CREATE TABLE `users` (
  `id` int(11) NOT NULL,
  `name` text

-- Dumping data for table `users`

INSERT INTO `users` (`id`, `name`) VALUES
(1, 'spaceshiptrooper'),
(2, 'Admin'),
(3, 'Demo');

-- Indexes for dumped tables

-- Indexes for table `users`

-- AUTO_INCREMENT for dumped tables

-- AUTO_INCREMENT for table `users`

The index.php file.

define('HOST', 'localhost');
define('USERNAME', 'root');
define('PASSWORD', 'root');
define('DATABASE', 'test');

$mysqli = new mysqli(HOST, USERNAME, PASSWORD, DATABASE);
if($mysqli->connect_errno) {

    die('Do not put anything in here including any mysql errors!!!!');


$sql = "SELECT id, name FROM users";
$prepare = $mysqli->prepare($sql);

if($prepare->num_rows) {
    $prepare->bind_result($id, $name);

    while($prepare->fetch()) {
            <td><?php print($id); ?></td>
            <td><?php print($name); ?></td>
} else {

    print('No data');


For the Mods

@Mittineague @ralphm @cpradio

Umm, so there’s some information over load. Can I just split my tutorial into 2 different topics? I didn’t know that it would be this terrifying just looking at how much parts I had to do because it went over 10 K words just for the Linux tutorial part alone.

EDIT: This thread has been replaced by a newer one I’ve re-created. Please go to if you want the newer edition. They are all in videos now and they are all in playlists based on the operating system so it should be pretty straightforward.


02-10-2017 by cpradio: Added Table of Contents


Linux Part 1


As I have said above, we should be using an up-to-date version of our preferred OS either x.04 or x.10. I have tested this out on Ubuntu 15.10, PHP 7 no longer has a valid regex while installing its repo. This will no longer work for Ubuntu 15.10 and maybe Ubuntu 15.04, Ubuntu 14.04, and Ubuntu 14.10. Again, please use Ubuntu 16.04 or Ubuntu 16.10 for this tutorial.

Linux (Ubuntu 16.04)

Prepping your system

1.) Update your system by typing in the command line

sudo apt-get -y update

The -y flag simply just puts “yes” in the command so that we don’t get prompt with questions. Without the -y flag, Linux will sometimes ask you if you want to continue with the installation and it will also halt until you type in y (yes) or n (no) in the command line. Typing our letter beforehand will avoid the questions and it’ll get us to where we actually want to go (updating). Updating your system basically just updates whatever changes you have made to your system such as adding a repository or creating aliases in your .bashrc file and such.

2.) Once you have updated your system, you can either do an optional upgrade or you can skip this step and go to step 3. For those who want to do the upgrade, follow this step and type in the command line

sudo apt-get -y upgrade

This one however, might actually prompt you a message saying that something failed and for you to use --force-yes instead of -y. If it does prompt you that message, just type in the command line

sudo apt-get --force-yes upgrade

Once it upgrades, you might also have to type in another command to remove all the packages that aren’t needed anymore. You can just type in the command line

sudo apt-get -y autoremove

If this one prompts you a same message saying something failed, just replace -y with --force-yes again.

All we’re basically doing is upgrading packages that are on older versions that might have newer versions available and remove old packages that aren’t needed anymore for your current version of Ubuntu.

3.) Let’s configure our domain names first. If you wish to have a local domain name cut off from the outside world and something that you can only see, you can modify your hosts file. I prefer using instead of localhost. Sometimes, certain softwares would like for you to have an actual domain name, not a localhost one. So I just use This domain name actually exists. At one point, it pointed towards one of Google’s DNS servers. No one really knows who the registrant is, but as of today, actually does not work anymore. It points to a blank DNS server so we’re just going to use it for our personal use. We’re not really stealing the domain name since we aren’t actually owning that domain name. All we’re going to do is point that domain name towards our local IP Address. This in turn turns a real domain name into a local domain name.

So open up a file explorer and browse to the folder /etc/ and browse way down. You’ll see the file hosts. It’s not a folder, it’s a file. Open it with your favorite Text Editor or gedit. Once the hosts file is opened, you’ll see 2 lines, one pointing to and the other pointing to The is basically our local IP Address. Any domain name you want to use as a local domain name can be pointed here. Also, when opening the hostsfile, make sure you have read, write, and execute permission on that file or when using your favoriteText Editor. If you are using gedit`, you might want to open a new terminal and typing in

sudo gedit

Reason why you need to do this is because when using gedit, you will be using the read-only version. You don’t have root permission to write to the hosts file. So in order to get root permission to edit any file using gedit, you’ll need to do it via the terminal. From there, a new gedit will open up with the correct permissions. You’ll also need to re-browse back to the /etc/ folder and look for hosts again.

4.) Add in your desired domain names into the hosts file and save the file. For me, it’s going to be as the main domain;,, and as the sub-domains. As their names say in the domain. will be used for phpMyAdmin, will be used for our samples or basically to make sure that the sub-domains work. And is basically for our test projects. Your hosts file should look something similar to the below picture. Save the hosts file to /etc/ and close it out.

Installing Apache

1.) Now, once we have our desired domain names you want to install Apache. So let’s do that. Type in the command line

sudo apt-get -y install apache2

After you have successfully installed Apache, let’s test it out to make sure it works. Well, just the main domain since all of the sub-domains will most likely point back to the main domain since we haven’t actually configured them to point to their own respective folders. So open up your favorite web browser and type in your local domain you added to the hosts file. Mine is If you did everything correctly, your web page should look something similar to the picture below.

2.) Before we start, I would like to also point out that we are re-opening our current terminal and then opening up another new one. Basically, we don’t want to lose our work so we open up a new terminal on the side and use that terminal as a side terminal so we can do 2 things at once (not recommended, but if you want to follow along, then do so, if not, ignore the first few pictures below). Next, we need to modify the 000-default.conf file. This will allow us to point our domains to their respective folders. So using gedit (with root permissions) again, browse to /etc/apache2/sites-available/ and open up 000-default.conf. There should be an entry there already by default. Let’s modify it since that’ll be our main domain entry. The ServerName line has been commented out. Let’s uncomment it and replace with (or the main domain you added to the hosts file). For me though, I prefer not to use www. as it is pretty annoying to me. So I’ll just leave that out, you don’t have to on your end. The lines will now read ServerName as shown below (or something different on your end depending on your local domain name).

You don’t have to add ServerAlias to this file, but I like to anyways. Again, I don’t like adding www. to my domains. So I’ll exempt that. Let’s continue. So next, let’s change webmaster@localhost to webmaster@your-domain-here. Mine will be These don’t really matter because these will only be shown to us if we get an error 500 for mis-configuring our .htaccess file or our 000-default.conf file. If you understand Apache well, I honestly don’t think the email is really needed. The email won’t really exist since we aren’t actually going to be creating a local mail server. We’re just installing PHP, Apache, MySQL, and optionally phpMyAdmin. So even though you change the email, you’re still the only one who knows about your configurations unless you point that email to an existing email that is owned by an IT personal who will be willing to help you. Other than that, I see no real use for the email.

3.) Now, this is important so it gets its own steps. You must point the directory to your desired location. For me personally, I like to separate my projects so the way I do it is creating directories based on their domains or sub-domains. If it’s the main domain, I create a directory called default. The reason why we do this is so that we don’t have all our projects bunched into 1 single directory which will cause a lot of confusion and a messy workspace. So we basically separate those projects into their own directories so that we can work with 1 project without looking for the files in /var/www/html while having a main domain pointing to /var/www/html.

So our main domain is first, we will type in


Now, you’ll have to do the same thing for all your sub-domains. This is simple. Just copy&paste and then replace or add a in front of the domains like below. ( will be pointed to /usr/share/phpMyAdmin because that is where we will be installing it to. We may also need to modify this part later on to have working.)

4.) Now restart Apache by typing into the command line

sudo systemctl restart apache2

5.) Create directories in /var/www/html based on the domain names and test to see if the sub-domains point to their own respective directories. If the sub-domain points to a 404 error page or you can’t create a new directory under /var/www/html, then you’ll most likely have to change the permissions on /var/www/. I like to change the permissions on /var/www/ and all of its sub-directories and files to 0777. This is because it’ll give us read, write, and execute permission for the author, the server, and other groups. But since we are doing this locally, you don’t have to worry about it. If you were doing it on a live server, I’d suggest changing permissions to 0755 which means; read, write, and execute for the author. Read-execute for both server and other groups. But since we are doing this locally and no one can actually touch our files unless they are on our network, it should be fine using 0777. You have to also grant this permission on all new directories that are created within /var/www/ after the 0777 permission has been put in place. So let’s do just that. Type this into the command line

sudo chmod -R 0777 /var/www/

The -R flag means recursively which means repeat the same action for all sub-directories and files under /var/www/. /var/www/ also gets 0777 as well since it’s the parent directory. If you couldn’t create new directories or files before, now is your chance. Let’s create the respective directories for our sub-domains. We will be excluding phpmyadmin as it will reside in /usr/share/.

6.) Once you have successfully set the permission for /var/www/ to 0777, you can then create your default directory and other directories as shown in the below pictures.

7.) Let’s move the old Apache index file to the sample folder. This in turn will give the old Apache index file and we will most likely create something new for the main domain.


1.) You really don’t have to do this, but I really like to hit that update button (in this case, update line). So I typically update every time I install or add something new to my system. Again, this is optional, but if you really want to follow a long, you can update your system if you want. Again, the command line is

sudo apt-get -y update

Installing PHP

1.) The first thing you’ll need to do is add a repository to your system. PHP 7 does NOT come default with your system or any new system. So you CANNOT just type in

sudo apt-get -y install php7

And having it work. That’s NOT how it works. You have to add the repository to your system, update your system and then you can use a command similar to the one above.

So let’s do that. Type into your command line

sudo add-apt-repository ppa:ondrej/php

This will grab the repository for PHP 7. If it prompts you to hit the “enter” key, do so.

2.) Next, let’s update our system. Without updating our system, like I mentioned in the first few steps under Prepping your system. You need to update your system in order for the repository to be updated and added to your system list. Without it being in your system, you cannot run the installation command on it. So let’s update our system by typing in

sudo apt-get -y update

Again, you should know what the -y flag stands for. We’ve used it multiple times above. So let’s not explain anymore. This one however is required if you want to successfully install PHP.

3.) You can finally now install PHP 7 as it is now available (we will be installing PHP 7.0 instead of PHP 7.1 because I made the mistake and typed in .0 instead of .1, but you can install PHP 7.1 if you want.). So in the command line, type in

For PHP 7.0

sudo apt-get -y install php7.0

For PHP 7.1

sudo apt-get -y install php7.1

4.) Next, we will install the mysqlnd extension. So we’ll need to type in

For PHP 7.0

sudo apt-get -y install php7.0-mysql

For PHP 7.1

sudo apt-get -y install php7.1-mysql

5.) We will now install mbstring as it is needed for PHPMyAdmin to work. So type in the command line

For PHP 7.0

sudo apt-get -y install php7.0-mbstring

For PHP 7.1

sudo apt-get -y install php7.1-mbstring

6.) Let’s install cURL now. If you don’t want this package, you can skip this step. This is for those who want cURL. Type in the command line

For PHP 7.0

sudo apt-get -y install php7.0-curl

For PHP 7.1

sudo apt-get -y install php7.1-curl

Update Your System

1.) We have probably went through 4 or 5 updates, but we must update if we want our PHP environment to work. Some updates are optional, but some aren’t.

sudo apt-get -y update


Linux Part 2

Installing MySQL Server

1.) We will now install the MySQL server so that we can use it to store our data. So type in the command line

sudo apt-get -y install mysql-server

2.) When a screen prompts open from the terminal that looks like the below picture, you can use any password as your default root user. But for me, it’s going to be root.

Too Much Update

1.) Sorry, but I must tell you that we are going to update your system again. Don’t you like that?


1.) I don’t know what I was doing here so you can follow along if you want. I believe I chmod once more because new files that are created don’t get the same exact permissions as their current parent. They receive permissions based on their parent parent directory. Since /var/www/html isn’t the “parent parent”, the permission the new file will most likely receive will be from /var/ which we SHOULD NEVER touch. I’ve done stupid mistakes and changing permission on /var/ was one of them so don’t chmod on /var/ if you don’t know what you are doing.

Creating Our Projects

1.) So for now, we’re just going to be doing something simple. We’re just going to output the PHP info to make sure that PHP is running correctly. So you can now right click and open the file without needing the terminal since we gave the directory read-write-execute permissions. So in your index.php file, type in


And then save it and close it out.

2.) Restart Apache again to make sure that it works. Well, technically, it should be working without the need to restart Apache, but let’s just do it in case something wrong happens. So let’s type in the command line

sudo systemctl restart apache2

3.) Browse back to your favorite web browser and refresh the page that you were on. It should of been at Once it has been refreshed, you should now see the PHP info or something similar to the picture below.

4.) Open up a new tab and type in to see if shows the old Apache file. If it does like the picture below, then it works. You have a working main domain and a working sub-domain. When a sub-domain doesn’t work, it will normally show the main domain contents ( in this case). This can either mean that you don’t have permission to that directory or the configurations are wrong. You might want to double check if that happens.

Installing PHPMyAdmin

1.) Open up a new tab and type in It will lead you to PHPMyAdmin’s official website.

2.) On the right hand side of your screen, you should be able to see 3 green buttons. It should read

Download x.x.x.x
Try Demo

Download x.x.x.x will vary depending on which version PHPMyAdmin is on. Currently as of this tutorial, it is on So click on Download x.x.x.x.

3.) We’re just going to right-click on the downloaded file and we’re going to open it from where it was downloaded to. For this tutorial, it’s going to be located in ~/Downloads or in your Downloads folder for your current logged in account on your local machine.

4.) Next, extract the folder. You can either extract the folder to a new folder or you can choose “Extract Here” from the context menu.

5.) Browse into the extracted folder and look for the file named and rename it to We’ll need to modify this file in order to have PHPMyAdmin working.

6.) Right-click on and open it with gedit. You don’t need the terminal for this one because you have permissions within your own Downloads folder.

7.) Switch back to your favorite web browser and open up a new tab. This time, go to and then search for the term phpmyadmin blowfish secret generator. The link should be the first one as shown on both pictures below.

8.) Click on the link. It should lead you to the website as shown in the pictures below. Scroll down until you see Copy The Output Below To Use For Your phpMyAdmin $cfg['blowfish_secret']:

9.) Copy the 44-character sequence and browse back to your gedit and then paste it inside of $cfg['blowfish_secret'] in your file.

10.) Scroll down to where you can see the lines that read // $cfg['Servers'][$i]['pmadb'] = 'phpmyadmin'; and uncomment from there until the end of // $cfg['Servers'][$i]['export_templates'] = 'pma__export_templates'; and then save the file and close out.

Don’t NEED To Do This Step

1.) For some reason, I keep restarting Apache and updating the system, but you don’t have to if you don’t want to. I am simply just doing my thing. But if you want to follow a long, you can if you want.

Installing PHPMyAdmin … Continued

11.) Open up the terminal if you don’t have it already opened and type in the command line

ls -l

We are basically listing all the contents within the current directory we are in. You shouldn’t be in the Downloads directory because we’re using the terminal. You should be in your Home directory in the terminal. On the file explorer however, you are in the Downloads directory. That much is clear.

12.) So having our terminal open, we should change the directory to the Downloads directory. So in the command line type in

cd Downloads

This however only works if you are within the Home directory of your current account on your local machine. If you are NOT in the Home directory of your current account on your local machine on the terminal, you can type in cd ~/Downloads to change directly into the Downloads folder from where ever you may be.

13.) We will now do another ls -l to list out what contents are in the Downloads directory.

14.) Using what we know from the above step (step 13), we know that our PHPMyAdmin folder is within this directory. So it is safe to say that we can now move the PHPMyAdmin directory to /usr/share. But we cannot move it manually because just like /var/, we don’t have permissions to /usr/ nor /usr/share/ so we’ll have to do this via the terminal with root permission. So in the command line type in

sudo mv phpMyAdmin /usr/share/

15.) Browse back to your favorite web browser again and open up another new tab. This time, type in the address bar It should work and look similar to the picture below.

16.) Log into your MySQL account. The default root username should always be root while the password is what you typed in earlier when we installed the MySQL server.

17.) Upon successfully logging into your root account on PHPMyAdmin, you should see something similar to the first picture below. However, it isn’t over yet. You still need to correct some errors if you want PHPMyAdmin to work.

18.) So again, open up another new tab and go to again. This time, search for the keyword phpmyadmin examples/create_tables.sql.

19.) It should always be the first result, but if you can’t find it. It’s on

20.) Next, click on the Raw button in the middle of the screen which should redirect you to the raw version of the file. Once you are there, highlight all and copy it.

21.) Browse back to on your other tabs and click on the SQL tab in the top middle of the screen or you can go to any SQL tab on any tables.

22.) Paste the raw create_tables.sql that you copied from into the SQL text area. Like the below pictures. And click on the Go button at the bottom right hand screen.

23.) Once you have successfully created the right tables that you need for PHPMyAdmin not to complain about, you can browse back to the PHPMyAdmin home page on to see if you need anything else.


So, I am kind of embarrassed to show you guys this part of the tutorial, but I’ll have to show you guys any how since we’re not yet finished with the tutorial. To finish off a good section, we must check to make sure that everything is working correctly. So I went off-screen and created a test database with a users table. I then gave it a few columns and I inserted data into it. I then tried to connect to my database using mysqli_*. Next, for some reason, it wouldn’t work. I didn’t look at the errors correctly so I thought I had installed PHP incorrectly because I installed PHP before I installed the MySQL server. But this was not the case. I later then found out I mis-spelled mysql and actually had it as myql.


Windows Part 1


The tutorial for Windows will actually be a lot longer than the tutorial for Linux and will contain more images than Linux. This is because Windows requires more steps.


Since PHP 7.1.1 is out now, you might want to download that one instead. If you cannot find PHP 7.1.0, that’s okay. This tutorial also works with updated files as well. Don’t worry about the version you currently see that are featured. The only difference you’ll see is that yours might be more up-to-date which is something you want. Unless the steps for this tutorial changes within the near future, the steps for installing PHP on Windows will most likely remain the same.

Windows (Windows 10 x32 bit)

Prepping your system

1.) So the first and foremost step that we should always do when installing PHP on a Windows system is to determine the architecture type. PHP, Apache, and many other softwares will be very picky on which architecture they get installed on. So we must always understand and know which architecture type we currently have installed. In order to do this, we must open up a file explorer first.

2.) Right-click on This PC or My Computer or This Computer on the menu at the left. And then at the way bottom of the context menu, there should be an option called Properties. Click on it.

3.) Your system specs should show up. Take note, I am using a x32 bit Operating System with a x86 bit Based Processor. This is my architecture type. Most people prefer x64 bit over x32 bit, but I find that using x32 bit for development is a lot easier than using x64 bit. It’s just a matter of preference. But do take note of that part because you’ll need it later on.

4.) Open up your favorite web browser and browse to We are using FireFox for this tutorial so the steps and options may vary for you.

5.) Scroll down about half way through the page, on the left hand side, you’ll find a couple of links that are for Visual C++ which are labeled with 2008, 2012, and 2015. You’ll need these in order to have PHP up and running. Basically, PHP needs something called runrc from those libraries in order for PHP to properly work on Windows. So for the 2008 one, click on the link that is for your architecture type. Remember, x32 bit is also x86 bit or it can also be x64 bit as well. But most likely, it’ll be x32 bit. For the 2012 and 2015 one, it’ll give you options to choose from within the link.

6.) I have them all opened on different tabs so I know which ones I haven’t downloaded and which ones I have. So switch the tab to the 2008 one and click on the Download button. Then click on the Save button when it prompts you where to save the file. By default, it should be stored in the Downloads directory unless you specified it to store in a different directory. If you have, please remember that your files will be stored there.

7.) Switch the tab again to the 2012 link. This time when you click on the Download button, it’ll prompt you a window which gives you selections to choose from to download your files. Select the appropriate one for your architecture by checking the checkbox and then clicking Next. Then click on the Save button when it prompts you where to save the file. Again, by default, it should be stored in the Downloads directory unless you specified it to store in a different directory. If you have, please remember that your files will be stored there.

8.) One last time, switch to the tab that has the 2015 link. Again, when you click on the Download button, it’ll prompt you a window similar to the 2012 one with selections. Choose the appropriate one for your architecture by clicking on the checkbox and then clicking Next. Again, click on the Save button when it prompts you where you want to save the file. I shouldn’t have to repeat this part again as I have said it twice above.

9.) Once you have all 3 files downloaded, you can either navigate to your Downloads folder in your File Explorer or click on the dropdown list from your Download history and it should show all 3 files. Just right-click on any one of those downloaded file and click on Open Containing Folder. It should open up the Downloads directory where the files are stored in. If you saved it into a different directory, you might want to open that location up since it isn’t the default Download location.

10.) Let’s install the 2008 one first so that we can do them in chronic logical order so that we don’t screw something up. When you have the 2008 Visual C++ program opened, it’ll greet you with an introduction message and at the bottom right, there should be 2 buttons (Next > and Cancel). Click on Next > if you want to continue. We all do I believe.

11.) Here, it lists the terms and what not. We really don’t need to read all of it unless you really want to. So we’ll just click on the checkbox and click on Install >. When you click on Install >, it’ll start installing the 2008 one. Once the installation is finished, just click on Finish and the program will close. If it doesn’t, close out of the 2008 one.

12.) Open up the 2012 Visual C++ one. Here it lists the terms and conditions. If you want to read it all, be my guest. If you want to install it, click on the checkbox and then click on Install. This one might actually require you to reboot your computer in order for it to take affect. You don’t have to reboot it just yet. You can install the 2015 one and then reboot it. If you want to reboot it right after the 2012 installation, you can do so. The reboot is optional up until after the 2015. We usually wait until we are finished installing all of the programs. If the requirement doesn’t really affect the installation process, we wait until everything is done and then reboot so we don’t have to reboot so much times. It saves time to reboot only when necessary. THIS REBOOT PROCCESS MAY NOT EVEN AFFECT YOU AT ALL. IT MAY NOT EVEN ASK YOU TO REBOOT. IF IT DOESN’T, DON’T WORRY ABOUT IT. YOU CAN REBOOT DURING THIS STEP IF YOU REALLY WANT TO. JUST ONLY DO IT IF THE PROGRAM ALERTS AND TELLS YOU TO. Once the installation is finished, click on Close and the program should close.

13.) Last, but not least. Open up the 2015 one. Again, the terms are listed on this one as well. If you really want to, you can read it. We’re just going to click on the checkbox and click on Install. Once the installation is finished, click on Close. The program should be closed.

14.) Now that we have our 3 programs installed, let’s reboot our computer. If the 2012 installation didn’t ask or alert you to reboot your computer, then you don’t have to. But if it did, then you’ll have to since it’s required. Since I cannot take snapshots of the reboot process, you all should know how it looks like. I don’t think I should have to put pictures in this step. REMEMBER TO SAVE YOUR WORK IF YOU ARE WORKING ON SOMETHING!!! I AM NOT RESPONSIBLE FOR ANY DATA THAT IS LOST!!!

15.) Once you’re computer is done rebooting (only if it’s required), open up your favorite web browser again. If it didn’t require you to reboot your computer, just type in the address bar This should lead you to the Apache Lounge website where you can download Apache from. Once we are in the Apache Lounge website, you can then click on the Downloads link at the left sidebar. This should lead to where we can download Apache.

16.) Once you are on the Downloads page, scroll a little down the page to where it says Apache 2.4 binaries VC14. Remember to download the correct one for your architecture type. Windows is very specific for the programs you use. You cannot run a x64 bit program on a x32 bit Operating System and vice versa. This tutorial is using a x32 bit Operating System so I’ll download the one that says Yours might be the win64 so BE CAREFUL which one you download.

17.) Again, browse to the Downloads directory. You can browse to it using the File Explorer or you can click on the Download history dropdown list and right-click on the Apache compressed file and then clicking on Open Containing Folder. And it should open the Downloads directory. Again, if you didn’t save the Apache file in your default Downloads directory, you’ll have to navigate to it.


Windows Part 2

18.) Click on or and browse into it. We’re just basically going to extract the Apache compressed file into our Downloads directory. So once we are in the compressed file, we’re going to click on the Extract option at the top of our File Explorer. It should bring down another option called Extract All. Extract it to the current location that it lists inside the text field. Simply, just leave it as what it has by default. By double clicking on Extract All, it should expand and become the toolbar if you click on any one of those options at the top such as File, Home, Share, View, and Extract. If you click on it once, it’ll bring down a toolbar that will disappear once you click out of it.

19.) Once you are done extracting the Apache directory, you can open up your favorite web browser again and browse back to and then download PHP. In this tutorial, we’re going to be using PHP 7.1 as it is the latest version of PHP. So scroll down a little bit to where you can see the download links. REMEMBER, there’s 2 different types for your architecture. There’s a Non Thread Safe and a Thread Safe. Non Thread Safe DOES NOT include a file that we need so REMEMBER to carefully download the THREAD SAFE one. Basically, the Non Thread Safe DOES NOT include php7apache2_4.dll which is what we need in order to load our PHP module. You’ll need to download the correct PHP for your architecture type. This means you’ll need to keep 2 things in mind, 1.) the PHP file you download needs to be the correct one for your architecture type and 2.) it has to be the Thread Safe. So once you have that all figured out, you can click on the Zip link for that appropriate one and save it to your Downloads directory. Then browse to the Downloads directory either by using the File Explorer or clicking on the dropdown list for your Downloads history. If you didn’t save it in your default Downloads directory, again, browse to where you downloaded it to using your File Explorer.

20.) Once you are in your Downloads directory, again, we’re going to extract the PHP compressed file into the Downloads directory. Same steps from the Apache one, we’re going to use for extracting our PHP compressed file. Again, we’re going to click on the Extract option at the top of our File Explorer and then click on Extract All. Then we’re going to leave the location to the default one in the text field again. This will be extracted to our Downloads directory.

21.) We are going to be doing something a little different from the Linux version of this tutorial. We’re going to create our development area first and then we’ll start installing everything. This means that this part of the tutorial will also be placed in the Prepping your system section instead of the Installing Apache section. So if you don’t already have your File Explorer opened. You’ll want to open it. This time, browse to the root of your C:/ drive. This is where we will be storing our development files. I recommend storing it in the root of our C:/ drive because it’s a lot easier to navigate to and it also is a better way for other accounts to access it. If you store the development environment in your own personal document directory or any other personal directory, it’ll be harder for other accounts to access since those accounts will be required to type in a password to access those directories. So this is why I recommend storing the development environment in the root of our C:/ drive to avoid any of these problems.

22.) Right-click on the blank area of our C:/ drive and from the context menu, there should be an option that reads New >. Click on it and then click on Folder. Basically, we’re going to create a new directory within our C:/ drive. Name that directory as dev. This is our development environment directory.

23.) Once you have created the dev directory, browse into it and we’re going to create 3 more directories. The first directory will be called logs. Basically, logs is where our error log is going to be stored. In Windows, everything we create or do has to be done manually. So if we don’t set our error logs, we’re not going to be able to debug anything. By default, Linux stores the error logs inside /var/logs/. So Linux users are lucky. Windows users however have to define it in the php.ini file which we’ll configure in the Installing PHP section. The second directory will be called progs. progs is going to be our programs directory. If you have installed the old PHP installer before, it would have stored it in C:/Program Files/PHP.x. But since the new way of installing PHP is by doing it manually, we’re going to be storing the programs inside the progs directory. This way, we can simply upgrade and downgrade as we wish. I’ll have a short video of an upgrade at the bottom of this post for you to watch and see how easy it is to upgrade. The same step can also be applied to downgrading as well. The third and final directory will be called www. www will be where we will store all of our development projects/ files in.

24.) Browse back to the root of your C:/ drive once you are finished creating the development environment. Now browse into the Windows directory from the root of your C:/ drive. And scroll way down to the System32 directory. Browse into the System32 directory. And scroll a little down or if you can see the directory called drivers, you can click on it. Once you are in the drivers directory, click on the etc directory. Within the etc directory, you should have a file called hosts. The hosts file is by default within the etc directory for both Windows and Linux. The only difference with Windows is that it is stored within multiple directories so you’ll have to go through a few directories to get to it. So in Windows, it’s C:/Windows/System32/drivers/etc/ while in Linux, it’s just /etc/.

25.) Once you have found the hosts file, you can either drag and drop the hosts file into your Desktop or you can copy&paste it there. For this tutorial, we’re going to drag and drop it. We have to copy it to our Desktop because by default, the hosts file CANNOT be modified or edited in the current location it is in. This is only with Windows. In Linux, you can modify the hosts file if you have root permissions. By dragging and dropping the hosts file to our Desktop, we are basically moving the hosts file there. If you cannot drop and drop the hosts file to the Desktop, just copy&paste it. So when we drag and drop the hosts file, Windows will prompt you a message box asking if you want to continue the process. It might also ask you to type in your password so do so if it does. Don’t close out of the File Explorer yet because we’re going to be moving the hosts file back or copying the modified hosts file into the etc directory.

26.) After we have moved or copied the hosts file to our Desktop, open up your favorite Text Editor. I am using Sublime Text 3, but you can use any Text Editor that suits you. Click on File in the top menu and then click on Open File.... Then click on the Desktop menu in the left sidebar. This is an easy way to browse back to your Desktop without actually typing it into the address bar. Our hosts file should appear in the selection. Double click on the hosts file to open it in our Text Editor.

27.) Once we have the hosts file opened, we’ll want to add in our local domain names. Our local domain names could actually exist or not even exist at all. Basically, we’re going to be pointing those domain names to our local IP Address. This means that if the domain that you pick does actually exist, whatever you do to it will not affect the actual domain itself. You’re not actually doing anything to that domain name and you don’t have the rights to it either. We’re just basically pointing the domain name to our local machine so that we can use a domain name to access our localhost environment. In this tutorial, we’re going to be using The actual does exist and it doesn’t point to any nameservers at the moment. Anything we do to will NOT do or change anything to whatever the actual has. Anything we do locally, no one can see. So say for example, we create a local website on the domain name The original author of will NOT see our local website nor have anything to do with it.

28.) So the first domain we will be adding in is This is our main domain. Our subdomains will have as its trailing domain name. So for example, we can have a subdomain name called The is our trailing domain name and the example part of the domain name is our subdomain name. Anything that is before the second period is our subdomain name. So if we only have one period, that’s our main domain name. So the other three domain names we’ll create are our subdomain names. Those will be,, and will most likely not be used. It’s just a sample subdomain to demonstrate that we can create as many subdomains as we want. We basically create subdomain names based on what the project or directory is about. is going to be using the PHPMyAdmin application. will be used for testing to see if the subdomain names work. So we’ll have to point those domain names to our local IP Address which is If you are done, you should have something similar to the picture below. You don’t necessarily have to use You can use any domain name that you’d like. We’re just using for this tutorial.

29.) Once you are done modifying the hosts file. Close out of it and then move or copy the modified hosts file to the etc directory. Again, if you moved the hosts file to the Desktop, you’ll need permission to move it back to the etc directory. I believe you also need permission to paste the modified hosts file into the etc directory as well so this step remains the same for both drag&drop and copy&paste.


Windows Part 3

Installing Apache

1.) Once we have our desired domain names, we’ll have to browse back to the Downloads directory. You can navigate to it either by clicking on Downloads in the left sidebar of the File Explorer or you can open up your favorite web browser and clicking on the Downloads history dropdown list and then right-clicking on a downloaded file and clicking on Open Containing Folder to open up the Downloads directory. Next, navigate into the Apache directory. It should be called httpd-2.4.25-win32-VC14. If not, you might be using the x64 bit one. So browse into httpd-2.4.25-win64-VC14. Once inside the Apache directory, you’ll see that there’s a directory called Apache24. Name that to just Apache as it’s going to be our Apache directory and it’ll be much easier to remember Apache and not Apache24.

2.) Cut and paste the Apache directory that you just renamed to the progs directory within our C:/ drive. The location is C:/dev/progs. You can copy&paste instead if you’d like.

3.) This step should be done in the Installing PHP section, but to save time, we’ll just do this all-in-one go. So browse back to the Downloads directory by clicking on Downloads at the left sidebar. This time, we’re going to rename the PHP directory from the Downloads directory instead of browsing into the PHP directory. So rename php-7.1.0-Win32-VC14-x86 to just PHP. If that isn’t yours, it could be php-7.1.0-Win32-VC14-x64.

4.) Again, cut and paste the PHP directory you just renamed to the progs directory within our C:/ drive. The location is still C:/dev/progs.

5.) You should now have both the Apache directory and the PHP directory within the progs directory as shown below.

6.) Now open up your favorite Text Editor again if it isn’t opened already. Click on File and then click on Open File... and browse to your Apache directory within the progs directory which should be within the dev directory inside the root of your C:/ drive. Once inside the Apache directory, browse to the conf directory and open up the httpd.conf file. You can also browse to the Apache directory and then the conf directory within your File Explorer and drag&drop the httpd.conf file into your Text Editor. This will simply open the httpd.conf file without needing to browse so much if you were already in the progs directory from Step #5.).

7.) If you are using Sublime Text like I am, you can hit CTRL+H to open up the Replace All command. We’re going to replace all lines that have c:/Apache24 since this isn’t the correct location that our Apache is stored in. The correct location is C:/dev/progs/Apache. You can also replace it with C:\dev\progs\Apache like I have there, but it doesn’t matter. For other Text Editors, you might want to figure out which controls are for opening up the Replace All command or you could navigate to it using the menu bar at the top of your Text Editor. If you cannot find the Replace All command, you might want to contact the author of that Text Editor or a forum that is active and ask for help finding the commands for that Text Editor. Or you can simply change Text Editors if you’d like.

8.) Browse down to where the lines read #LoadModule rewrite_module modules/ and uncomment it. You might want to uncomment this module if you want to use Apache’s Rewrite commands in your projects.

9.) On line 180 where there’s a double line break, type in LoadModule php7_module "C:\dev\progs\PHP\php7apache2_4.dll". In the picture below, I made a mistake which will come to bite me in the butt later on in the tutorial. And I fixed it after I debugged the error which pointed to this exact line. Mistakes will be made. Don’t copy the one in the picture since it’s not the correct one. Use the one above.

10.) After that, create a new line after the PHP 7 module and type in AddHandler application/x-httpd-php .php. This is the PHP handler. We need this in order for Apache to execute PHP as PHP and not output it as HTML text. If you don’t do this, PHP will not be processed as PHP and you will not get PHP to properly execute.

11.) Browse down to line 231 where it says

<Directory />
    AllowOverride none
    Require all denied

And replace AllowOverride none to AllowOverride All. On that same code, replace Require all denied to Require all granted. We’re basically allowing access to our Directory directories. Basically, if you don’t replace these lines, when you browse to, you’ll get thrown a 404 Error page. So to avoid this, you’ll want to replace these lines to allow you to access your directories.

12.) Now, browse down a little bit to where you can see DocumentRoot "C:\dev\progs\Apache/htdocs". Replace this with our default directory. This default directory will be pointed to our main domain which is So the default directory is C:\dev\www\default. We will also do this with the <Directory "..."> line underneath DocumentRoot as well.

13.) Scroll down some more and where it reads AllowOverride None, we want to replace that with AllowOverride All. Simply because it may also cause our default directory to output Error 404 when we should have everything set up.

14.) Again, scroll down some more and where it reads DirectoryIndex index.html, you’ll want to put in DirectoryIndex index.php index.html. This simply tells Apache to look for the index file index.php before it looks for index.html. Basically, if you are running a PHP project, you might want to do this because if you have both index.html and index.php inside the same folder, index.html will get used and parsed instead of index.php. So it’s best if you put index.php before index.html.

15.) Now, scroll down to line 506. It should read #Include conf/extra/httpd-vhosts.conf. Uncomment is because this is our virtual host that we have to modify in order for us to run our subdomains and main domains.

16.) Scroll to the way bottom of the file and create a new line break and add in PHPIniDir "C:\dev\progs\PHP". Basically, with this line we just add in the PHP ini directory. We basically need to have this line some where in the httpd.conf file because without this line, Apache will not load our extensions which isn’t what we want. I’ve tested the httpd.conf file without this line and it throws a Class not found error for mysqli_* if you want to use mysqli_*. I assume it also throws some more errors to other different functions of PHP. So having a httpd.conf file without this line will most likely not work at all.

17.) We are finally finished with the httpd.conf file. You can either close it or leave it up if you’d like. If you followed the steps and didn’t make the same mistake as I have in Step #9, you don’t have to keep httpd.conf opened. If you did exactly what the picture shows, you might want to keep httpd.conf opened until you can fix or debug any errors that happens.

18.) This time, open up the httpd-vhosts.conf file. To open it, you can either use the File Explorer or browse to it using your favorite Text Editor. I believe using the File Explorer and dragging & dropping the file to the Text Editor would be a much simpler idea because if you are still working in the same directory, it’s a lot easier to use the current location in the File Explorer instead of re-browsing back and forth from the C:/ Drive using the Text Editor’s File - Open menu options. So browse to C:\dev\progs\Apache\conf\extra or C:\ Drive > dev > progs > Apache > conf > extra and open up the httpd-vhosts.conf file.

19.) Once you have the httpd-vhosts.conf file open, it should by default have the following data in the file (shown in the picture below). All we’re going to do is use the first set starting from <Directory> to the end of the first </Directory>. We’re going to be putting our own into that set and then we’re going to be using that same code and replace it respectively for all of our subdomains and main domain.

20.) Replace ServerAdmin with your own local email. Don’t worry if the email doesn’t exist, we’re not sending legitimate email messages to that email. This is simply a placeholder for when we get 500 Errors. We’re also NOT creating a local email server so don’t ASSUME that is what we are doing. That is NOT what we are doing. We’re replacing the current ServerAdmin email to whatever junk email we want. Simply put, since we are the only developers currently on our local machine, the ServerAdmin email serves NO purpose to us. If we make a mistake configuring our Apache files, that’s all on us. The ServerAdmin email’s purpose on a live server is to allow users who don’t own nor have access to the Apache configurations to contact that administrator email so that they can go and fix the Apache files. Since we are the only developers on this local machine and have full access to the Apache files, there is NO point in putting an actual working email in this section.

21.) Replace DocumentRoot "c:/Apache24/docs/" with your main domain directory. The new replacement should be DocumentRoot "C:\dev\www\default".

22.) Replace ServerName with ServerName You don’t necessarily have to put in www. in front of, but if you want to, go for it. I dislike having www. in front of my domain names as it’s a generic placeholder and serves really no purpose other than having been taught to type that into the address bar when the World Wide Web first came out of its roots. There’s really no specialty in having www. or not having www. in front of the domain name. I guess it’s just a matter of preference. I don’t believe it really affects search engine optimization either so there’s really no point in my eyes to put www. in front of the domain name. But if you do want to however, you’ll have to add that into the hosts file and also add that into the httpd-vhosts.conf file and also httpd-ssl.conf file if you are using SSL which in this tutorial, we’re not going to do. Basically, if you want to have both www. and non-www, you’ll have to add both entries into the hosts file and have 2 entries of the same domain name and location in both httpd-vhosts.conf and in httpd-ssl.conf. I’d say just stick to using the non-www as it’s much easier to work with and you don’t have to add in so many entries. But if you want to add www. go for it. The same can also be said about ServerAlias. This really is just an alias for the domain name. So you can apply this step to the line ServerAlias.

23.) The ErrorLog and CustomLog don’t really have to be accessed all the time as these files relate specifically only to Apache. These files will show every error that happens when using an Apache file. If you configured a .htaccess file incorrectly, you can view these two error logs to debug where the problem persists. These two logs don’t really relate much to PHP and you’ll rarely use these two files unless you are messing with Apache. Other than that, all errors in PHP will be stored in our logs directory we created a while back. So you can simply leave the directory location and rename the part to your respective domain.


Windows Part 4

24.) Once you have done that for the main domain, it should look something similar to the first picture below. When you’re ok with what you have for the main domain, you’ll want to create three more entries with the same configurations. I recommend copying and pasting the configuration for the main domain and use that configuration for the other three entries. This makes it easier for you to save time. So do this for,, and All you really need to do is add in phpmyadmin. in front of when you are configuring the entries for their respective domain names if you copied&paste the configuration for For PHPMyAdmin, the directory name doesn’t matter. In Linux however, it does. You’ll receive a 404 Error page if you don’t have it correctly typed in. You may however want to keep it consistent so I would say name the directory as how it is spelled on the official website. It’s just a matter of preference for the naming conversions. Once you are finished with the three entries, you should have something similar to the last picture in this step.

25.) Now, the second to last step to actually have a working Apache is to actually install it. Yes, install it. We haven’t really installed it. We just basically configured it to our desired preference. We still need to install the Apache service. So to do so, click on your Start button on your Windows 10 machine. It should by default be at the left bottom of your screen. Once the Start button has been clicked, your Start menu should appear. Mine looks a little different because I changed the Settings to have a full screen view when the Start menu is opened. Don’t worry about this if yours doesn’t look like mine. Your Start menu should have a left sidebar. It should be a little smaller than the right panel tiles. Use the left sidebar and scroll way down to where it says Windows System. Click on Windows System and it should toggle another menu. The first option should be Command Prompt. Right-click on Command Prompt and hover your mouse over More >. Click on Run as administrator. If Run as administrator appears when you right click on Command Prompt and doesn’t have the More >, don’t worry about it. Just click on Run as administrator and it should prompt and ask you if you want to run it as an administrator. Click on Yes.

26.) Once Command Prompt is opened, type in the command line cd ../../dev/progs/Apache/bin. We’re basically going to change the current location (C:\Windows\system32\) to the bin directory within our Apache directory.

27.) Once we’re inside the bin directory within the Command Prompt, type in httpd -k install. This command will install the Apache service. This is also the step where it tells me that I screwed up. It complains and says that Errors reported here must be corrected before the service can be started. During this time, the service has already been installed, but cannot startup without correcting the errors first.

28.) If you followed the steps and not the picture, you should have no complaints in the Command Prompt other than the three directories not existing or the main directory not existing. This can be solved. You can skip this step and move onto Step #31. If you followed the pictures, you’re going to have to debug it like how I did in the pictures. So open up your favorite Text Editor and open up the httpd.conf file. I shouldn’t need to tell you where it’s located because we’ve been working on it for about 16 steps now. Scroll down to line #180 or whichever line number that it complains about. If you followed the steps up until now, it shouldn’t be any other line except line #180. This line is where we forgot to add in the 7 in php7apache2_4.dll. Currently, we have phpapache2_4.dll. So change it to php7apache2_4.dll and save it.

29.) Open up the Command Prompt again and type in the command httpd -k uninstall. We’re basically uninstalling the Apache service. I like to do this a lot instead of typing in httpd to startup the installed service because httpd should only be used to check if you have any errors. If you do have errors, you’re still going to have to correct them. So when you do httpd -k install and then httpd -k uninstall, when you install the new service, it’ll already display the same errors as if you were to do it with just httpd. I guess this is also a matter of preference. You can use httpd to check for errors or uninstall it and then re-install it.

30.) Next, type in httpd -k install again. This time, once the service is installed, it should only complain about the default directory not existing. This is okay. We’ll just have to create the directory. For this step, you don’t have to uninstall the service and reinstall. That is only for major errors that might need fixing.

31.) Once we know that the only errors that are displayed are either the three subdomain directories not existing or the main (default) directory not existing, all we have to really do now is create them in the www directory. So open up File Explorer and browse to C:/dev/www or C:/ Drive > dev > www. Right-click on any empty part of the File Explorer and from the context menu, hover on New > and then click on Folder. Rename the newly created folder to default. Do this with 2 more directories. Name them sample and test.

32.) When you have those three directories created, open Command Prompt again and type in the command line httpd. This should start up the Apache service and it’ll prompt you an alert message asking you if you want to allow access for this software. You can also click on the Private networks, such as my home or work network checkbox if you’d like. I checked it for this tutorial, but you don’t have to if you don’t want to. After you are done reading this alert message, you can then click on Allow access to allow Apache to run. In the last picture of this step, I accidentally pressed the enter key, but once you are finished with this step, you can actually close out of the Command Prompt as we don’t need it anymore.


Windows Part 5

Installing PHP

1.) Installing PHP itself on Windows takes around 7 steps to do because all we’re doing is using the binary files. There’s really nothing we need to do except configure the php.ini file and maybe copy over some files that maybe needed for cURL to work correctly on a x32 bit Operating System. So once you get to this step, we’re almost done. I’d say about half way to a little more than half way there. So about 3/4-ths done. Anyways, open up the File Explorer and browse to your PHP directory. It should be C:/dev/progs/PHP if you did it correctly during the Prepping your system section. Scroll down and rename php.ini-development. We’re going to only be using the development file since we are developing on a local machine. The production file is only for live servers. Both of them will vary and have different lines commented out and uncommented out. So rename php.ini-development to php.ini.

2.) Again, you can either open the php.ini file either by dragging and dropping the file into the Text Editor or you can browse to C:/dev/progs/PHP using your Text Editor.

3.) Once you have the php.ini file opened, hit CTRL+F to open up the Find command. Search for the term error_log. You might want to click on Find or Next until you find the line that reads ;error_log = php_errors.log. We’re basically looking for the error log and we’re going to add in our own error log which will be stored in C:/logs or C:/ Drive > logs.

4.) Just two lines below ;error_log = php_errors.log, you should have another line that reads ;error_log = syslog. You can either replace and uncomment this line or you can create a new line break and add in your own. It doesn’t matter. These lines are commented out, but we’re just going to leave them as default and create a new line break for our own error log. So once you have created a new line break, type in error_log = "C:\dev\logs\error.log". It needs to be the full path because these programs can’t read your mind. If you’re telling it to locate a specific location and you know where it is, you might want to use the full path as it will be helpful for the programs to determine where it is exactly that you want to point to. We are also naming our error log error.log.

5.) Again, in the search bar. Search for the term extension_dir. This time, we’re going to be searching for the extension directory section and we’re going to be adding in our own extension directory location. Once again, you might want to click on Find or Next until you find the line that reads ; extension_dir = "./". Again, after the commented section, type in extension_dir = "C:\dev\progs\PHP\ext".

6.) Next, search for the term .dll. There are only a selection of .dll lines so this one is easy to find. The first line you find should be ; extension=msql.dll. Scroll down a little bit and then uncomment the extensions that you really need. The ones that are really required for any basic PHP installations are php_curl.dll (only if you use cURL), php_gd2.dll (only if your project relies on the GD library for creating and modifying images), php_mbstring.dll (required for PHPMyAdmin to work), php_mysqli.dll (only if you are accustomed to MySQLi_*), php_pdo_mysql.dll (only if you are accustomed to PDO). php_openssl.dll isn’t really needed if you don’t know what it’s used for.

7.) Scroll down a little bit and you’ll find the timezone line. If you don’t want to put in your timezone. You don’t have to. You can skip this step if it doesn’t apply to you. If you do however want to put in your timezone, you’ll want to go to that link that’s in the comments. The link you want to really go to is The link that’s in the comments only leads to you a page that has this link in there. You’ll have to have a sharp eye in order to see where the link is. But since I have it linked above, you can just click on that link. Copy&paste the nearest timezone to you. Mine is America/Chicago.


Windows Part 6

Extra (needed if you want to have Apache up and running without having to manually start it up)

1.) I only placed these steps here because these steps simply doesn’t belong in the Installing PHP section and we cannot add these steps into the Installing Apache section as we have just finished configuring our php.ini file and our PHP installation. The neat thing about Linux is that it starts mostly every service up without needing to manually start up those service. In Windows however, if you want Apache to start up when you turn on your computer, you’ll need to create a short cut and add that into your Startup directory. So the first thing you want to do is again, open up File Explorer and browse to C:/dev/progs/Apache/bin or C:/ Drive > dev > progs > Apache > bin.

2.) Once you are there, right-click on ApacheMonitor and from the context menu, click on Create shortcut. This will create a shortcut to the ApacheMonitor executable file. Basically, when your computer starts up and all of the startup programs are started up, this shortcut will point to the ApacheMonitor and then Windows will start up the ApacheMonitor executable file.

3.) What I’d like to do is rename ApacheMonitor - Shortcut to just ApacheMonitor, but you can leave it as is if you’d like. It’s just a matter of preference.

4.) Once you have that all sorted out, click on the Start button at the bottom left corner of your Windows 10. Once the Start menu expands and you see the small left sidebar again, scroll way down to Windows System. Then click and open Run.

5.) Once Run is opened, where it says Open:, type in the text field shell:startup. This should open the Startup directory.

6.) The Startup directory should be empty and have nothing in there. If it there are things in there, don’t worry about it. Now, what you should do is line both the Apache directory and the Startup directory next to one another. Drag and drop the ApacheMonitor shortcut. If you renamed the ApacheMonitor shortcut to just ApacheMonitor, you can tell the difference between the actual ApacheMonitor and ApacheMonitor shortcut. The shortcut has a little blue icon that’s pointing up and it’s within a little white box. That icon represents shortcuts in Windows. You can interpret this as “A reference to the actual program”. When you drag and drop the shortcut, it should NOT create a new copy. It should have moved the shortcut to the Startup directory leaving no ApacheMonitor shortcut in the Apache directory.

7.) Once the ApacheMonitor shortcut is inside the Shortcut directory, click and open the ApacheMonitor shortcut. This will prompt you a security warning. Simply, it’s just the default Windows warning dialog box. In the left bottom corner of the dialog box, it says Always ask before opening this file. Unless you are sure and are willing to allow the ApacheMonitor to be opened without permission, I suggest not unchecking the checkbox. However, if you don’t uncheck the checkbox, the Apache service will not start up right away if there is an error in your Apache configuration for any reason. This dialog box may popup and ask you again or it may not even. So the Apache service may not even run OR start up without the ApacheMonitor. I suggest unchecking the checkbox to ensure that the Apache service does indeed start up when Windows gets booted. But it’s up to you if you want to open it or not. These files are safe and the Apache Lounge website is linked to by the official PHP team. So I would highly doubt that the official PHP team would link to you to any malicious website that they don’t deem unsafe for their users. Once you are done deciding whether you want to allow this or not, click on Run. The warning dialog box should disappear and the ApacheMonitor icon should appear in your icon tray at the bottom of your task menu.

8.) During this point, we should check to make sure that the Apache service is working and have no errors. You can check by clicking on the ApacheMonitor icon in your icon tray. The first time you hit Run from the above step, ApacheMonitor should actually open up. But if you’ve opened it before, it’ll minimize and go into the icon tray just like the picture below. So right-click on the ApacheMonitor icon if it’s already minimized. And from the context menu, click on Open Apache Monitor.

9.) By default, the Apache service should not be running. So you’ll have to start it up. Click on the Start button at the right sidebar. You’ll be prompt to type in or allow the Apache service to run. So allow it. If all works well, the little red circle at the left of Apache2.4 should turn into a green sun light. If it still remains a red circle or it prompts you a message saying that Apache cannot run or some kind of error message for Apache, you might want to correct that before running Apache. To do this, just open up a Command Prompt with administrator permissions and change the directory to C:/dev/progs/Apache/bin and then type in httpd. httpd will always tell you what’s wrong with your Apache configuration so use it well. It’s your friend.

10.) If you are NOT using Sublime Text, you can skip this step unless your Text Editor provides the same option. For Sublime Text users, I usually like to have my development projects ready to be worked on. I recommend placing your development directory on the left sidebar of Sublime Text. This allows you to navigate and pull up files at ease without having to go to File > Open File > ...... It takes too much time to open your project files so I recommend doing this. To do this, just click on File in the top menu. Then from the menu, click on Open Folder..., browse back to C:/dev and select the www directory and hit the Select Folder button. A new Sublime Text window should appear with your development projects or subdomain directories on the left sidebar. You can minimize both Sublime Text windows and drag and drag the files or tabs from the first Sublime Text window onto the second Sublime Text window. You might want to drop those files by holding onto the tabs and dropping them in the tabs view. Dragging and dropping just the filename might not work. Another way you can also do is just drag and drop the www directory onto the left sidebar. This will do basically the same exact thing except you don’t have to drag and drop the tabs since the www directory will be in the current Sublime Text window.

11.) Once we are all set and have a clean development environment to work with, you can now create test files to make sure that PHP works. To do so, we’ll create a new file. So click on File in the menu bar at the top and from the menu, click on New File. The new file will always be called Untitled by default unless you are using a different Text Editor such as Dreamweaver. Then yours might be Untitled.html. In the new file (Untitled), type in


Save the file to C:/dev/www/default and name it as index.php. We’re just basically checking to see if PHP works and if it does work, it’ll display our PHP information.

12.) Open up another new file using the same menu option and then type in


This time, save the file to C:/dev/www/sample and name it as index.php. This index.php is meant to make sure that our subdomains work correctly and that PHP also works correctly.

13.) For this step, I’m not really doing much. I am just expanding the directories to demonstrate that there are 2 different index.php files and they are both saved in different directories.

14.) Open up your favorite web browser and create a new tab and type into the address bar It should display a similar page to the first picture below.

15.) Create another new tab and type into the address bar It should display something similar to this page. There should be nothing really except for a text that outputs Sample. If you are getting a 404 Error page on this subdomain, you probably forgot to change the lines that read

<Directory />
    AllowOverride none
    Require all denied

They need to be changed to

<Directory />
    AllowOverride All
    Require all granted

So that you can access directories within your www directory. You’ll also want to restart your Apache service. You can restart the Apache service by clicking on the ApacheMonitor icon in the icon tray and hovering over Apache2.4 and then from the secondary menu, click on Restart. The Apache service should restart and you can then refresh that page you are on.


Windows Part 7

Installing MySQL

1.) Open up your favorite web browser if you don’t already have that opened. Open a new tab and browse to

2.) Click on the Downloads tab on the official website. Scroll way down the page and click on Community (GPL) Downloads »

3.) Once you are on the Community (GPL) Downloads page, click on the link MySQL Community Server (GPL).

4.) When you finally get to the MySQL Community Server (GPL) page, scroll way down. You’ll see an image banner. Click on the image banner because it provides the MySQL installer. The rest are basically the binaries and it’ll take you longer than you want if you are going to compile the actual binaries for MySQL. So it’s recommended to use the installer.

5.) After you have clicked on the image banner, it’ll direct you to the installer page. Again, just scroll down the page and you’ll see 2 options or a few other options. Download mysql-installer-web-community-x.x.xx.x.msi. The other installer isn’t the one we need. We need the web community one since it provides the MySQL server.

6.) Once again, after clicking on and going through multiple links, will give you another page to look at. Just scroll down and click on No thanks, just start my download.

7.) When you finally get to download and save the MySQL installer, click on the Save File button. It should save the installer to your default Downloads directory unless you specified it to download somewhere else. If you have, navigate to it.

8.) Open File Explorer and browse to your Downloads directory or click on the Downloads history dropdown list and then right-click and click on Open Containing Folder. This should open up the Downloads directory.

9.) Once in your Downloads directory, click on the MySQL installer. The installer should prompt you a warning dialog box. Click on Run and it’ll start the installer.

10.) The MySQL installer splash page should appear while you are waiting for the installer to load. Once the installer loads, the splash page should disappear and the installer should appear. The first thing you’ll see are the listed Terms and Conditions from Oracle. You don’t have to read the terms if you don’t want to. Just click on the checkbox and click on Next >.

11.) The Development Default option provides a ton of features and softwares such as MySQL Workbench. But we only want the MySQL server. All of those other softwares really aren’t needed unless you really want them. So for this tutorial, we’re going to select Server Only to save time and resource because we only need the MySQL server. Select which ever one you want. Once you are finished deciding which one you want, click on the Next > button.

12.) Once you have reached this page, just click on the Execute button. The MySQL installer will download the required files first and then install the MySQL server. Once the installer is finished, click on the Next > button.

13.) You’ll now come across this page which is basically just informative for what will be on the next page. Not really anything special on this page. So click on Next >.

14.) On this page, just leave everything default. Don’t mess around with this page or you might not get the MySQL server up and running. So just click Next > again.

15.) On this page, it’ll ask you to type in a default password for your root account. I suggest picking something simple that you’ll remember. I choose the password root. Once you have your password all set, click on Next >.

16.) On this page, I suggest renaming MySQL57 to just MySQL because that’s going to be the name of the service and it’s a lot easier to remember that the service is called MySQL instead of MySQL57. So click on Next > once you are done renaming the service.

17.) For this page, just click on Next > because there’s really nothing to do on this page.

18.) Once you have reached this page, click on Execute. At times, this page may fail due to collisions made from your anti-virus. I suggest adding the MySQL installer as an exception and add it to your firewall. The MySQL installer may already add itself to your firewall by default so I suggest to just do it in case it doesn’t.

19.) You may at some point get this error message. This simply means that the installer is taking longer than it should be. Sometimes it could be caused by your anti-virus as I have said. Just click on OK and then click on Finish. Usually if this error message affects you, it would normally relay you back to this particular page and ask you to press the Execute button again. But if you are able to go on to a different page, then it probably didn’t affect you. Everyone gets affected by this message differently. If you are getting a different message and you can’t seem to get out of it, message me or submit a post in this tutorial and I’ll try to get back to you as soon as possible. Remember to also point out which step you left off on and which part of the tutorial such as Installing MySQL or Installing PHP. If you didn’t get this message or any alert box like this, don’t worry about it. Click on Finish.

20.) On this page, just click on Next >. Again, the MySQL installer pretty much has a lot of pages that are just informative. Same thing can be said about downloading the installer process. It’s basically jumping through hoops just to get to where you really want to go.

21.) Again, click on Finish. Nothing to see on this page. The installer should also close out which means that you are finished installing MySQL.


Windows Part 8

Installing PHPMyAdmin

1.) So it seems like we are getting close to the end of this tutorial. You did great if you got up to this point and got everything working. I am proud of you. So we are basically going to download the PHPMyAdmin files and we’re basically going to do the same thing we did on Linux. So open up your favorite web browser if you don’t already have it opened and open up a new tab. Type in the address bar

2.) Once you are on the PHPMyAdmin website, there’s three green buttons at the top right. It should list Download 4.6.x.x, Try demo, and Donate. Click on Download 4.6.x.x where x.x are the version numbers. Yours might be different from mine and that’s okay. The current one we are using for this tutorial is Yours might be an up-to-date version. That’s even better.

3.) When you click on the Download button, it’ll prompt you a modal box along with your download. Save the compressed file by clicking on the Ok button. This should be stored in your default Downloads directory. You can close out of this tab and other various tabs if you want. You don’t have to keep these tabs opened as they will most likely waste space. But if you want to follow along, that’s fine.

4.) Open File Explorer and browse to your Downloads directory. Again, you can use the Downloads history dropdown list if you really wanted to. It’s up to you.

5.) Once your Downloads directory is opened, browse into the PHPMyAdmin compressed file. The one for this tutorial is called Yours might be different and that’s okay.

6.) Again, we’re going to extract this compressed file into our Downloads directory. So in the top menu, click on the Extract option and from the expanded menu, click on Extract All. Leave the extraction location as you see it. It’ll extract it to the Downloads directory.

7.) Once the extraction process is finished, rename the directory to PHPMyAdmin.

8.) Copy&paste or Cut&paste the PHPMyAdmin directory. Browse to your development environment and paste the PHPMyAdmin directory there. The development environment should be C:/dev/www or C:/ Drive > dev > www.

9.) Open up your favorite web browser and open up a new tab. Type in the address bar Input your root account password and username. My root username is root and the password is root.

10.) If you are able to log in and get to this page, that means everything is working fine. If you get an error, you’ll have to fix it. If the error says something along the lines of “connection refused” or “connection lost” or “no connection”, that means that the MySQL server isn’t running and it also could mean that during the installation process for MySQL, you didn’t fix the problem that kept persisting so the MySQL server was never properly installed. You should go back and uninstall the MySQL server. Then reinstall it. The MySQL server has to be up and running in order for you to actually have PHPMyAdmin working. So if you have it working, scroll down the page. There will be two things that are being complained about. You’ll want to correct these two things if you want to keep PHPMyAdmin working properly.

11.) The first message should usually be about not having a phpMyAdmin table and what not. We’ll do this last because we’re still going to have to modify the configuration file which is what we also need in order to get rid of the blowfish_secret warning. So let’s do that. Open up File Explorer and browse to C:/dev/www/PHPMyAdmin or C:/ Drive > dev > www > PHPMyAdmin. Scroll down to where you can see the file Either create a copy of it or rename it to

12.) Again, you can either drag and drop the file straight into the Text Editor from the current location or you can browse to it. C:/dev/www/PHPMyAdmin/ and then or C:/ Drive > dev > www > PHPMyAdminand`.

13.) Open up your favorite web browser again and open up a new tab. Type in your address bar and search for the term phpmyadmin blowfish generator. It should be the first link that appears in the Google results. If you cannot find it, you can click on this link.

14.) You should be on the phpMyAdmin Blowfish Secret Generator page of Scroll down about half way. You’ll see a randomly generated blowfish_secret text. Copy that and go back to your favorite Text Editor.

15.) With the blowfish_secret text copied, paste it in between the single quotes on the line that reads $cfg['blowfish_secret'] = ''; So you should have a random text in between = '';.

16.) Now, scroll down to line #47. That line should read // $cfg['Servers'][$i]['pmadb'] = 'phpmyadmin'; Uncomment it and every line until line #67. That should be the end point of things that you are required to uncomment in this file.

17.) Again, open up your favorite web browser if it isn’t already opened and open a new tab. This time, go to and search for the term phpmyadmin examples/create_tables.sql. By default, the new PHPMyAdmin libraries do not provide the examples directory that we need in order for us to get PHPMyAdmin working. Older versions of PHPMyAdmin should contain this directory, but we can still find it on the web. The first link should be the correct one. It’s stored on a github repository.

18.) Once you’re on the github repository, click on the Raw button at the far right middle of the page. This will give us the raw file that we need. Right-click on a blank part of the page and from the context menu, click on Select All and copy it.

19.) If you haven’t closed out of the PHPMyAdmin tab yet. Browse back to it. If you already have, it’s fine. Just open a new tab and type in the address bar Once you’re on the home page of, click on the SQL tab at the top. This will load up an SQL terminal where you can run SQL queries. It doesn’t really matter which page you are on, at least it’s a SQL tab. Now paste all the information you just copied from the github repository and click on the Go button at the lower right hand corner. Wait for a bit for the query to run and you should get something that looks like the second picture below.

20.) Once you are finished with the SQL tab, click on the Databases tab on the left of the SQL tab. We’re just going to create a test database to make sure that we can connect to MySQL and have PHP running on Apache. So just type test into the text field and click on the Create button.

21.) Browse into the test table if you aren’t already by default. You can also just click on the test link at the left sidebar. That will also browse you into the test table as well.

22.) In the text field in the Create table section, type in users with a column of 2 and hit the Go button.

23.) In the first column; specify id as the name, int type, with a length/value of 11, set id to primary key, and set it to auto_increment. For the second column; specify name as the name, text type, and you should normally set the Default value to NULL, but for tutorial purposes, we’re just going to save time. Once you are done with that, scroll down and at the bottom right hand corner, hit the Save button. It should lead you back to the Structure tab.

24.) Browse out of the users column by clicking on the test table at the left sidebar. This will bring you back to the test table. This time, click on the SQL tab.

25.) You can input anything you’d like for the name. For this tutorial, we’re going to just use three random names. spaceshiptrooper, Admin, and Demo. So in the text area, type in INSERT INTO users VALUES(1, 'spaceshiptrooper');. Then do the same with the other 2 demo names. We’re just doing this to make sure we can actually connect and display data from the database. Once you are done, click on the Go button to make changes.

26.) You can use the snippet that I provide in the introduction post if you’d like or you can create your own and test it.

27.) If all works, you should be able to display data like the below picture. If it didn’t work and you get a PHP error, remember. Go to C:/dev/logs/error.log to find out why. Sometimes error logs aren’t captured. You might need to do some research if the error halts, but aren’t being displayed and error logs are turned on.


Windows Part 9

So now you finally finished installing Apache, PHP, MySQL, and PHPMyAdmin and this is basically the end of this tutorial. If you want me to make more topics on how to install PHP on other operating systems, create a topic with polls and tag my username in it. I’ll gladly try my best to show you guys the best ways to install your favorite development environment.

I also am going to end this topic by linking a Youtube video on how to upgrade PHP on Windows. The same steps can basically be applied to downgrading as well. Once you go past a certain PHP version though, you’ll need to get the older Apache binaries in order for you to correctly have a working PHP environment. I would strongly suggest not downgrading past PHP 5.4. Lower than that should not be used. Even PHP 5.4 should not be used anymore.

The video is a bit out of date, but it can still be applied. I recorded this short video during the time when RC6 was still sort of new and they had just recently came out with the final candidate for PHP 7.1.


This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.