Difference between revisions of "Apache (Retired)"
Line 33: | Line 33: | ||
''Note: For future reference, in order to manage the Apache service, you can either run the <span class="cde">httpd -k</span> command with the options <span class="cde">start</span>, <span class="cde">restart</span>, or <span class="cde">stop</span>. Alternatively, you can manage the service by opening <span class="cde">services.msc</span>, finding the Apache2.4 service, and then right clicking on it to manage it there. | ''Note: For future reference, in order to manage the Apache service, you can either run the <span class="cde">httpd -k</span> command with the options <span class="cde">start</span>, <span class="cde">restart</span>, or <span class="cde">stop</span>. Alternatively, you can manage the service by opening <span class="cde">services.msc</span>, finding the Apache2.4 service, and then right clicking on it to manage it there. | ||
Go to your browser and visit <span class="cde">http://localhost/</span> and you should see a page load. You've successfully installed Apache! 👏 | |||
=== httpd.conf === | |||
<span class="cde">httpd.conf</span> is the main configuration file Apache uses and references it whenever any HTTP request is sent to the website, which is why it's so important you have everything configured properly. First and foremost, if you want your website to be accessible via LAN you're going to need to access this file and tell it to listen on the server's IP. To start, open a new command prompt window and run <span class="cde">ipconfig</span> and find where it says "IPv4 Address . . . ." in the output (it'll say "IPv6 Address" if you're a communist) and copy the IP. | |||
Open your favorite text editor as an administrator (it matters that you run as administrator) and then open the file <span class="cde">C:/Apache24/bin/httpd.conf</span>, and then add the following code at the bottom of the file (location doesn't matter, bottom is just the easiest): | |||
<pre>Listen [IP]:80</pre> | |||
Just replace <span class="cde">[IP]</span> with the IP you copied and save the file, and then restart Apache (<span class="cde">httpd -k restart</span> or <span class="cde">services.msc</span> in case you forgot.) | |||
=== VCURNTIME140.dll === | === VCURNTIME140.dll === | ||
Line 42: | Line 53: | ||
This will get a little confusing, but this is where to put the file(s): | This will get a little confusing, but this is where to put the file(s): | ||
==== 64-bit OS ==== | |||
<span class="cde">64-bit File</span> → <span class="cde">C:/Windows/System32</span> | |||
<span class="cde">32-bit File</span> → <span class="cde">C:/Windows/SysWOW64</span> | |||
==== 32-bit OS ==== | |||
<span class="cde">32-bit File</span> → <span class="cde">C:/Windows/System32</span> | |||
== PHP Installation == | |||
After following the instructions for installing PHP as instructed in the Dependencies and Prerequisites section, open a text editor as administrator and open the file <span class="cde">C:/Apache24/bin/httpd.conf</span>. Next, at the bottom, add the following lines: | |||
<pre> | |||
LoadModule php7_module "C:/PHP/php7apache2_4" | |||
AddHandler application/x-httpd-php .php | |||
PHPIniDir C:/PHP | |||
</pre> | |||
Save the configuration file and restart Apache. Next, find the following code in <span class="cde">httpd.conf</span>: | |||
<pre> | |||
<IfModule dir_module> | |||
DirectoryIndex index.html | |||
</IfModule> | |||
</pre> | |||
' | Once you've found it, replace it with: | ||
<pre> | |||
<IfModule dir_module> | |||
DirectoryIndex index.php index.html | |||
</IfModule> | |||
</pre> | |||
- | Save your file and restart Apache (<span class="cde">httpd -k restart</span> or <span class="cde">services.msc</span> in case you forgot.) Once you've restarted that, navigate to <span class="cde">C:/Apache24/htdocs</span>, create a new file called index.php, and edit it to have only the following code (reminder to edit it with a text editor that has been ran as administrator): | ||
<pre> | |||
<?php | |||
phpinfo(); | |||
?> | |||
</pre> | |||
Save the file, and then navigate back to <span class="cde">http://localhost/</span>. You should now see a page that displays info and statistics about the current PHP version you have installed. | |||
Revision as of 01:56, 1 March 2018
todo: finish dependencies and prerequisites, then Apache Installation + PHP Installation + MySQL Installation + Verifying Functionality + Celebration
Introduction and Summary
Apache is one of the most common, versatile, and supported web servers of all time due to its easy installation and high functionality. This article is meant to guide you through the process of installing and configuring a fresh new install of Apache and the libraries it works well with (PHP and MySQL) on a Windows environment.
Selecting the Proper Environment
Another great thing about Apache is that it runs well on most (if not all) operating systems and provides the same functionality. Before you get started, you want to select which OS you are going to run the web server on. You as the server administrator (or poor soul assigned this agonizing task) should note the features you need and what OS they work best on. If you need a utility that runs better on a Linux server distro than on Windows Server, you might want to select a Linux distro that works well for you (vice versa Windows server.)
If you only need an Apache server running, the general consensus is that it will run the same regardless of OS on most modern hardware, but some disagree. (serverfault discussion about LAMP vs WAMP stacks)
Dependencies and Prerequisites
Before you begin, you're obviously going to need to download Apache. You can find this here, or at the bottom of this section. Once you have it downloaded, unzip the folder called Apache24 and paste it into the C:\ drive (or whatever drive your primary partition is on.) Repeat the same process with PHP, except create a folder on the C:\ drive called PHP and extract the .zip file's contents into there.
For MySQL, download the
All of the download links can be found here:
Apache Installation
Open a new command prompt window as administrator and navigate to the bin folder in the Apache directory you unzipped by running
cd C:/Apache24/bin
and then run the command:
httpd -k install
You should now see "The 'Apache2.4' service is successfully installed." on the 2nd line of the output. After this, start Apache by running the command in the same directory:
httpd -k start
Note: For future reference, in order to manage the Apache service, you can either run the httpd -k command with the options start, restart, or stop. Alternatively, you can manage the service by opening services.msc, finding the Apache2.4 service, and then right clicking on it to manage it there.
Go to your browser and visit http://localhost/ and you should see a page load. You've successfully installed Apache! 👏
httpd.conf
httpd.conf is the main configuration file Apache uses and references it whenever any HTTP request is sent to the website, which is why it's so important you have everything configured properly. First and foremost, if you want your website to be accessible via LAN you're going to need to access this file and tell it to listen on the server's IP. To start, open a new command prompt window and run ipconfig and find where it says "IPv4 Address . . . ." in the output (it'll say "IPv6 Address" if you're a communist) and copy the IP.
Open your favorite text editor as an administrator (it matters that you run as administrator) and then open the file C:/Apache24/bin/httpd.conf, and then add the following code at the bottom of the file (location doesn't matter, bottom is just the easiest):
Listen [IP]:80
Just replace [IP] with the IP you copied and save the file, and then restart Apache (httpd -k restart or services.msc in case you forgot.)
VCURNTIME140.dll
"The program can't start because VCRUNTIME140.dll is missing from your computer. Try reinstalling the program to fix this issue."
Go here and scroll below the "DLL-files.com Client Demo" button where it says "VCRUNTIME140.DLL, 7 AVAILABLE VERSIONS" and download both the 64-bit and 32-bit file if you have a 64-bit OS, and only the 32-bit file if you have a 32-bit OS.
This will get a little confusing, but this is where to put the file(s):
64-bit OS
64-bit File → C:/Windows/System32
32-bit File → C:/Windows/SysWOW64
32-bit OS
32-bit File → C:/Windows/System32
PHP Installation
After following the instructions for installing PHP as instructed in the Dependencies and Prerequisites section, open a text editor as administrator and open the file C:/Apache24/bin/httpd.conf. Next, at the bottom, add the following lines:
LoadModule php7_module "C:/PHP/php7apache2_4" AddHandler application/x-httpd-php .php PHPIniDir C:/PHP
Save the configuration file and restart Apache. Next, find the following code in httpd.conf:
<IfModule dir_module> DirectoryIndex index.html </IfModule>
Once you've found it, replace it with:
<IfModule dir_module> DirectoryIndex index.php index.html </IfModule>
Save your file and restart Apache (httpd -k restart or services.msc in case you forgot.) Once you've restarted that, navigate to C:/Apache24/htdocs, create a new file called index.php, and edit it to have only the following code (reminder to edit it with a text editor that has been ran as administrator):
<?php phpinfo(); ?>
Save the file, and then navigate back to http://localhost/. You should now see a page that displays info and statistics about the current PHP version you have installed.