Apache for Windows

Issues and solutions for vista users

I recommend you dowload Apache for Windows. Go to http://httpd.apache.org/download.cgi and find the windows binary with installer. Double-click the icon after downloading and select the defaults. When it asks if you want a "Typical", "Full", or "Custom Install", choose "Typical" and let it do its thing. If all is successful, Apache will be on your system.

Go to C:\Program Files\Apache Software Foundation\Apache2.2\bin and run the httpd.exe program. Congratulations! If all went well, you have a Web server running on your box. Once the server is running, open a Web browser and type http://localhost/ or http://localhost:8080/ into the address bar. Depending on your system configuration, one should work for you. If it's the latter, please use that :8080 on all the addresses mentioned below You should see a Web page telling you that your installation of Apache was successful.

If there was a problem with the Apache install, often the error message and the window it appears in will dissappear quickly (assuming that you double-clicked the executable and didn't run it from the command line). To see the message, open a command prompt and CD to the directory. Then, run the program from the command line. If there is an error message, you'll see it and take the appropriate action.

Next, you want to ensure that you can run CGI scripts. First, go to C:\Program Files\Apache Group\Apache\cgi-bin and create a file named "test.cgi". Assuming that you have followed the defaults for your Perl installation, edit test.cgi and enter the following program:

#!c:\strawberry\perl\bin\perl.exe use CGI; my $query = new CGI; print "Content-type: text/html\n\n"; print "This is a test page"; Notice that I have the full path of perl on the system in the #! line. YOu need that for this to run on your computer. Once you have that entered exactly as I have it above, enter http://localhost/cgi-bin/test.cgi into the browser's address bar and hit return. If all went well, you'll see a Web page with the text from above.

If you see an "Internal Server Error" or something similar in your browser, you may have an error. To find the actual error message, you'll go to C:\Program Files\Apache Group\Apache\logs and open up the "error.log".

The above instructions should work fine if you are one Windows9.x or WindowsNT (you might need administrator privileges for WinNT). I haven't tested this on Vista, but hopefully the class will help refine these instructions.

Apache for Mac OS X

Apache is already installed on macs. To activate it, go to System Preferences. Select Sharing. Turn on "Web Sharing". Go to your browser and type: http://localhost as the address. You should see an Apache welcome screen. To test a CGI script, put it in /Library/WebServer/CGI-Executables Try creating a file there that has this content: #!/usr/bin/perl print "Content-type: text/html\n\n"; print "Test"; I called this test.cgi. Next, you need to change the permissions on this file. In the terminal, type

cd /Library/WebServer/CGI-Executables

and then type

chmod 755 *.cgi

After you've done this, you can go to http://localhost/cgi-bin/test.cgi (test.cgi there is your file name) and you should see the word "Test" printed.