Site hosted by Angelfire.com: Build your free website today!

.

Install APACHE on Windows

Please note: When you run a web server you are more variable. Same is true when you get on the internet.

Videos Videos.

Download APACHE and Visual C++ Redistributable for Visual Studio 2015-2019

Download vc_redist_x64 (for 64bit computer) or vc_redist_x86 (for 32bit computer).
Download Apache 2.4.46 Win64 httpd-2.4.46-win64-VS16.zip (for 64bit computer) or Apache 2.4.46 Win32 httpd-2.4.46-win32-VS16.zip (for 32bit computer)
Install the version of Visual C++ Redistributable that matches your computer. You will need to reboot before installing APACHE.
How do I know if my computer is a 64bit or 32bit. Click on the START icon -> Control Panel -> System.

New that you have installed the version of Visual C++ Redistributable that matches your computer and rebooted.

Lets install APACHE.
Unzip the version of APACHE you downloaded.
In my cases httpd-2.4.46-win64-VS16 and copy the sub-directory Apache24 to the C drive. (C:\Apache24).
Goto C:\Apache24\bin and create a shortcut of httpd.exe and paste it to the desktop.
Execute the shortcut. This will run a console Window. Do not close this window.
When you execute the Apache shortcut. You may get the "Windows protected you PC" window.
If so click on "More Info" and yhen "Run anyway".
Windows will ask if you wont to allow access. You do. At lest Private Network and maybe more. depending what you wont to do.
Open your web browser and type 127.0.0.1 or http://localhost in the address bar and press enter.
If all went well. You will see a "It works!". If not reboot and try the shortcut aging.
In the sub-directory C:\Apache24\htdocs there is a file "index.html" this is your HTTP Document directory and file.
And C:\Apache24\cgi-bin is your CGI directory. Where your CGI screpts go.

New let setup the http.conf file to run CGI scripts.
Goto C:\Apache24\conf directory and open httpd.conf in notepad.
A # in front of a line is a comment. If you remove the #. It is a directive.
Goto the line Define SRVROOT "C:/Apache24". This is the root directory of your web server.
Goto the line Listen 80. This is the port that your server will listen to.
Goto the line DocumentRoot "${SRVROOT}/htdocs". This is where the html files go.
Goto the line

<Directory "${SRVROOT}/cgi-bin">
    AllowOverride None
    Options None
    Require all granted
</Directory>
And change it to.
<Directory "${SRVROOT}/cgi-bin">
    AllowOverride None
    Options  +ExecCGI
    AddHandler cgi-script .cgi .pl .py .php .exe
    Require all granted
</Directory>
This will allow CGI scripts with the extension of .cgi .pl .py .php .exe to be executed.
I change the extension of my C scripts to .cgi. CScript.exe to CScript.cgi.
Save the httpd.conf file and close the console Window then Execute the shortcut agen.
Any errors in the httpd.conf will be displayed in the console Window.
You may get a "httpd.exe: Could not reliably determine the server's ..." error.
If so ignore it. Because it does not effect the running of Apache. I have not spent the time to fugue out how to correct it.

New let write a script in C to test are work.
#include <stdio.h>
int main(void) {
  printf("Content-Type: text/plain;charset=us-ascii\n\n");
  printf("Hello world\n\n");
  return 0;
}
Compile it as CGI_Test1.exe and put it in the CGI directory. C:\Apache24\cgi-bin
New open C:\Apache24\htdocs\index.html and add the lines.
<FORM ACTION="http://localhost/cgi-bin/CGI_Test1.exe" METHOD="POST">
<INPUT TYPE="SUBMIT" VALUE="Send"></CENTER>
</FORM>
Open your web browser and type http://localhost in the link box and press enter.
Or press F5 if it is already open.
There will be a button at the bottom of the index.html file.

Press it. If all went will. You will see. Hello World
That is how you test C CGI scripts.

If you wont to know to test CGI scripts or you came hear from "Howto Create a HTML form and read it into a CGI script"
you do not need to read the rest of this page. It for people who wont to setup perl, php, pytion, and/or tcl


If you wont to use perl, php, pytion, and/or tcl. you will need to install there interrupters.
Perl, python, Tcl is at https://www.activestate.com/. will need to sing up for free.
PHP is at https://windows.php.net/download/.
Don't forget to put the interrupters path at the top of the script.
Perl would be #!C:\Perl64\bin\perl.exe -T if C:\Perl64 is where you installed Perl.
Hear an example of a perl script.

#!C:\Perl64\bin\perl.exe -T
print "Content-type: text/html\n\n";
print "Hello, World.";

New you wont to access your server (The computer with apache running) with a client (Computer that is not running apache).
You need 2 thing to do this.
1) Your server's local ip address. Open a console Window. Start -> Run -> cmd. will do it.
In the console Window type ipconfig look for IPv4 Address and write it down. It normally start with 192.
Goto the client computer and edit the C:\windows\system32\drivers\ect\hosts file.
Add the Server's ip address and a space and a name. Like localnetwork.loc. Reboot the client.
After you've rebooted open a web browser and type localnetwork.loc in the title bar.
New you will get the server's index.html with CGI access.
If you do not need CGI access.
You jest wont to access the server's web page and download files from the server to the client.
You do not need to change the host file or reboot. Jest type the server's IP Address.
To download a file from the server to a client.
You need 2 thing.
The name of the file and server's IP Address.
If the filename was Test.zip and the server's IP Address was 192.168.1.44
You would type in the address bar of the client web browser.
192.168.1.44/Test.zip

If you wunt to install Apache as a server (Runs on bootup).
Type in the console Window C:\Apache24\bin\httpd.exe -k install .
To uninstall type C:\Apache24\bin\httpd.exe -k uninstall .
You can add Apache and the interrupters to the path.
To do this.
Start -> Right-click on "This PC" or "My Computer" -> Properties -> "Advenced system setting" -> "Environment Veriables" button.
Under System variables double-click Path -> The New button -> C:\Apache24\bin .
Do the same for each interrupter bin sub-directory.

Security
If you run apache as a service. You have a possible Security hole even when you are not using apache.
I do not use apache munch. And I use the interrupters even less. So I do not run Apache as a service.
Or add the interrupters to the path. I jest write the full path at the start of the script.
Example for Perl is #!C:\Perl64\bin\perl.exe -T


Hoto Download and Setup Apache web server PART 1 Youtube.
Hoto Download and Setup Apache web server PART 2 Youtube.