Apache Server and CGI

I’ve been running Apache (1.3) for a while now to host files on the web off of my machine, since I have a static IP address and all. Recently I’ve been wanting to start hosting CGI scripts in Perl…

I’ve got the Apache httpd.conf file set up as per the documentation to run CGI scripts; however, when I try to access a .cgi or a .pl file on my machine, I’m given an HTTP 403 (Error Forbidden to View) page.

I’m guessing this has something to do with the script not being set for execute permissions, but how do I go about doing that on XP? All I can seem to find is how to do it via CHMOD on a linux machine, but how can I change the file permissions on XP to allow execution?

Thanks!

Oh, and before anyone asks… yes, I have Perl installed. :slight_smile:

Go to the directory where your scripts are, right click on one, select properties and look at the Security tab. Make sure they have Read & Execute permission.

I don’t have a Security tab. :-/

I’ve never run a Windows server, so I’m no help there. But I have a workaround you can try: from another computer, access your site with an FTP client like WS_FTP and change the file permissions to CHMOD 755 from that.

I’d try that, only I have no idea how to access this computer from another using an FTP client.

I know it’s long, but could you post your httpd.conf? or a pointer to it? It can be a tricky thing to make work, especially the first time.

Also, I recommend you move to v. 2.0. (I’m assuming that’s available for Windows; I don’t see why it wouldn’t be). Many improvements, especially on the security front.

httpd.conf:

Perl is located in C:\PERL\BIN
Apache is located in C:\PROGRAM FILES\APACHE GROUP\APACHE\

Thanks!

Try this:

Go into View File Types and set up .pl and .cgi files to run the application Perl.

Also, try this putting this test.pl perl script in cgi-bin and running it, to ensure this isn’t an issue of a script errors:


#!C:\PERL\BIN\perl.exe
print "Content-type: text/html

";
print "<!doctype html public \"-//W3C//DTD HTML 4.0 Transitional//EN\">
";
print "<html><head><title>Perl Test</title></head>";
print "<body><h1>bang!</h1>test test</body></html>";

Ahhh… your example worked. Wonder why mine aren’t. :-/

DOH! I figured it out.

My PERL headers were

#!C:\PERL\BIN

Fixed. :slight_smile: Thanks, Bill!

No problem. 1% of the first years revenues oughta cover it.

New problem…

The scripts are running fine for me, but when anyone other than myself (on a different machine) tries to access the server via http://199.111.227.172/ (or run, for example, http://199.111.227.172/cgi-bin/test.pl, they get this message:

Cannot find server
The page cannot be displayed
The page you are looking for is currently unavailable. The Web site might be experiencing technical difficulties, or you may need to adjust your browser settings.

Suggestions?

Check your server’s IP address. I suspect that might be your local connection’s IP address (or a local network IP address if you have a router and a local network set up), not your internet IP address.

That’s the only IP address I can find… where would I look?

ipconfig:

Connection-specific DNS suffix: Virginia.EDU
IP Address: 199.111.227.172
Subnet Mask: 255.255.252.0
Default Gateway: 199.111.224.1

I see it’s a university network? Chances are you’re connected to their network which in turn provides a connection to the internet, yes? They may have a firewall in place that prevents outside connections. contact the university’s IT people; perhaps they can provide a solution, like a different IP address for you to use, or something.

A traceroute gives:

So, the IP address is resolving, but there’s no web content at that address.

Is this something that I can fix…?

Ooo…I had a thought. If you have a username on the university network, try affixing /~username after the IP address. It’s a long shot, but hey.

In my config, or in the browser URL? For me, doing this in the browser URL results in a 404 not found.