Installing the PHP environment - spaceshiptrooper [Style]

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 phpmyadmin.localhost.com, sample.localhost.com, and test.localhost.com. All you really need to do is add in phpmyadmin. in front of localhost.com when you are configuring the entries for their respective domain names if you copied&paste the configuration for localhost.com. 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.




2 Likes