LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 09-18-2007, 11:36 AM   #1
jwaters504
LQ Newbie
 
Registered: Sep 2007
Posts: 10

Rep: Reputation: 0
Apache2 and CGI problem on Debian Etch


I have searched and tried the various things on this site and I'm still having problems with cgi scripts executing on the server. Here is part of my apache2.conf file:

# To use CGI scripts outside of ScriptAliased directories:
# (You will also need to add "ExecCGI" to the "Options" directive.)
#
AddHandler cgi-script .cgi .pl

#ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
#<Directory /usr/lib/cgi-bin>
#AllowOverride None
#Options ExecCGI
#Order allow,deny
#Allow from all
#</Directory>

ScriptAlias /cgi-bin/ /var/www/cgi-bin/
<Directory /var/www/cgi-bin>
AllowOverride None
Options ExecCGI
Order allow,deny
Allow from all
</Directory>

I started out with the top ScriptAlias, put my script in the /usr/lib/cgi-bin directory, made sure it was chmod to 755 and then went to the site http://192.168.0.110/cgi-bin/cgitest.cgi

I get a blank page. If I change the name to cgitest.pl it tries to download the file instead of executing it. The errorlog shows this:

[Tue Sep 18 12:10:52 2007] [error] [client 192.168.0.101] (2)No such file or directory: exec of '/var/www/cgi-bin/cgitest.cgi' failed
[Tue Sep 18 12:10:52 2007] [error] [client 192.168.0.101] Premature end of script headers: cgitest.cgi

[Tue Sep 18 12:14:40 2007] [error] [client 192.168.0.101] (2)No such file or directory: exec of '/var/www/cgi-bin/cgitest.pl' failed
[Tue Sep 18 12:14:40 2007] [error] [client 192.168.0.101] Premature end of script headers: cgitest.pl

If I run perl -c cgitest.pl or cgitest.cgi it says it passes. Here is the script:

#!/usr/bin/perl



# Create an HTML page to display a message.

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

print "<HTML><BODY><TITLE>Test</TITLE>";

print "<CENTER>";

print "<H1>";

print "TEST";

print "</H1>";

print "<HR>";

print "Hooray! It works!";

print "<HR>";

print "</CENTER>";

print "</BODY></HTML>";

I get the same errors no matter which ScriptAlias I use. Any ideas on why this isn't working?
 
Old 09-18-2007, 07:33 PM   #2
BCarey
Senior Member
 
Registered: Oct 2005
Location: New Mexico
Distribution: Slackware
Posts: 1,452

Rep: Reputation: Disabled
It's looking in /var/www/cgi-bin, so try putting it there.

Brian
 
Old 09-19-2007, 08:28 PM   #3
jwaters504
LQ Newbie
 
Registered: Sep 2007
Posts: 10

Original Poster
Rep: Reputation: 0
I had tried both areas to place the script based on which ScriptAlias I had used. I finally got it working, I think the script was actually goofed up even though the perl check said it was OK. I think what may have happened is it got uploaded as a binary file instead of a text file, when I created a simple "hello world" script in vi on the server it worked fine. I also downloaded a couple simple scripts and they work too. Not sure what it was, but both php and cgi are working now! Thanks for the response .
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Apache2 on Debian Etch not working finferflu Linux - Server 28 02-24-2011 05:03 AM
Debian, apache2, CGI problem daviddutch1964 Linux - Networking 1 06-29-2007 03:19 PM
Debian, apache2, CGI problem daviddutch1964 Linux - Server 0 06-29-2007 02:14 PM
Debian Sarge Apache2 Parse C cgi programs disturbed Debian 4 03-19-2006 10:03 PM


All times are GMT -5. The time now is 12:07 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration