LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   apache and cgi (https://www.linuxquestions.org/questions/linux-newbie-8/apache-and-cgi-191241/)

hward 06-08-2004 04:29 PM

apache and cgi
 
Hi, very new to linux here. I have a fresh install of Fedora Core 1 and I went into service and started Apache. I get the startup Apache page showing that it is working.

My question is if I put a .cgi file in the cgi-bin I can't it to do anything.
What exactly do i need to do. I have tried following online tutorials that I have found and created the test.pl files that suggest and put them in and still nothing.


Like I said I just reinstallled everything so its fresh and all I have done so far is start apache. Could someone help walk me through what I need to do.

Thanks
Heath

btmiller 06-08-2004 04:50 PM

What gets displayed in your browser when you try to run the CGI script? Look at your Apache error log (I think by default it's in /var/log/httpd/error_log) and see what it says. Make sure that the user the Apache server runs under has read and execute permissions on the CGI script, too. This is probably the problem if you forgot to chmod +x your script.

hward 06-08-2004 05:04 PM

[Tue Jun 08 16:59:17 2004] [error] [client 192.168.1.100] Premature end of
script headers: hello_cgi.pl

btmiller 06-08-2004 07:34 PM

Oftentime this means that there's a problem with the script itself -- did you remember to print out the "Content-type: text/html\r\n" header?

hward 06-08-2004 07:49 PM

#!/usr/bin/perl


print "Content-type: text/html\n\n";

print <<"EOF";
<HTML>

<HEAD>
<TITLE>Hello, world!</TITLE>
</HEAD>

<BODY>
<H1>Hello, world!</H1>
</BODY>

</HTML>
EOF

Demonbane 06-09-2004 03:53 AM

make sure the file permission is setup correctly


All times are GMT -5. The time now is 03:43 PM.