Help, Apache won't run my cgi

Help, Apache won't run my cgi

Post by TURBO101 » Mon, 31 May 1999 04:00:00



I have apache 1.3.4, and I'm trying to run a simple perl script, but it
doesn't work.  I've named the webpage *.shtml and put in <!--#exec
cgi="/cgi-bin/count.pl"--> but it doesn't work.  I know the script works,
because if I do perl count.pl then it returns html to me.  I think the
problem is that apache isn't running the script, and I'd like to know if
anyone can help me, or at least point me in the right direction to try to
get apache to run my cgi.  Thanks in Advance for any assistance.
 
 
 

Help, Apache won't run my cgi

Post by TURBO101 » Mon, 31 May 1999 04:00:00


Nothing happens on my wepage.  If I try to run the script by itself, by
going to the browser and typing http://url/cgi-bin/hello.pl I get
Internal Server Error
The server encountered an internal error or misconfiguration and was unable
to complete your request.
Please contact the server administrator, root and inform them of the time
the error occurred, and anything you might have done that may have caused
the error.



> >I have apache 1.3.4, and I'm trying to run a simple perl script, but it
> >doesn't work.  I've named the webpage *.shtml and put in <!--#exec
> >cgi="/cgi-bin/count.pl"--> but it doesn't work.  I know the script works,
> >because if I do perl count.pl then it returns html to me.  I think the
> >problem is that apache isn't running the script, and I'd like to know if
> >anyone can help me, or at least point me in the right direction to try to
> >get apache to run my cgi.  Thanks in Advance for any assistance.

> Does your system have Perl installed?

> Have you put:

> #!/usr/bin/perl

> at the top of your script?

> have you set up /cgi-bin to allow execution of scripts?

> This should start you off.

> Hugh


 
 
 

Help, Apache won't run my cgi

Post by TURBO101 » Mon, 31 May 1999 04:00:00


Perl is installed, it's appache that doesn't run it, don't know what else to
do.  I've made it executable, used .shtml, don't know what else to do.



> >I have apache 1.3.4, and I'm trying to run a simple perl script, but it
> >doesn't work.  I've named the webpage *.shtml and put in <!--#exec
> >cgi="/cgi-bin/count.pl"--> but it doesn't work.  I know the script works,
> >because if I do perl count.pl then it returns html to me.  I think the
> >problem is that apache isn't running the script, and I'd like to know if
> >anyone can help me, or at least point me in the right direction to try to
> >get apache to run my cgi.  Thanks in Advance for any assistance.

> Does your system have Perl installed?

> Have you put:

> #!/usr/bin/perl

> at the top of your script?

> have you set up /cgi-bin to allow execution of scripts?

> This should start you off.

> Hugh

 
 
 

Help, Apache won't run my cgi

Post by Hugh Saunder » Tue, 01 Jun 1999 04:00:00



>I have apache 1.3.4, and I'm trying to run a simple perl script, but it
>doesn't work.  I've named the webpage *.shtml and put in <!--#exec
>cgi="/cgi-bin/count.pl"--> but it doesn't work.  I know the script works,
>because if I do perl count.pl then it returns html to me.  I think the
>problem is that apache isn't running the script, and I'd like to know if
>anyone can help me, or at least point me in the right direction to try to
>get apache to run my cgi.  Thanks in Advance for any assistance.

Does your system have Perl installed?

Have you put:

#!/usr/bin/perl

at the top of your script?

have you set up /cgi-bin to allow execution of scripts?

This should start you off.

Hugh

 
 
 

Help, Apache won't run my cgi

Post by Hugh Saunder » Tue, 01 Jun 1999 04:00:00


<snip>
Quote:>I get
>Internal Server Error
>The server encountered an internal error or misconfiguration and was unable
>to complete your request.
>Please contact the server administrator, root and inform them of the time
>the error occurred, and anything you might have done that may have caused
>the error.

<snip>

This smacks of some kind of problems with your script headers. The FIRST
THING that your script must output should be: (perl extract)

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

Notice the two '\n' characters. These two linefeeds must be present. If you
have already done this, then check your apache logs. They should be in
/var/log/httpd or similar. There should be a file called error.log or
something. Apache generously logs all such errors, so this should give you a
lead.

If the log says something like "could execute myscript.pl", check that your
path to the perl libraries in the script are correct, by typing

which perl

this should produce output like

/usr/bin/perl

but its not the same on all systems!! With the output above, the first line
in your script should read

#!/usr/bin/perl

Failing all this, zip your script and apache error log up and mail them to
me and I'll try to have a look at them.

Hugh

 
 
 

Help, Apache won't run my cgi

Post by Monte Philli » Tue, 01 Jun 1999 04:00:00



>> >I have apache 1.3.4, and I'm trying to run a simple perl script, but it
>> >doesn't work.  I've named the webpage *.shtml and put in <!--#exec
>> >cgi="/cgi-bin/count.pl"--> but it doesn't work.  I know the script works,

That path looks like the culprit.  gotta put in the FULL path or perl
won't find it and it will error Apache.  That results in an Apache
error being sent to you.   Hope this helps.
 
 
 

Help, Apache won't run my cgi

Post by Lee Sau Dan ~ » Thu, 03 Jun 1999 04:00:00


    TURBO1010> Perl is installed, it's appache that doesn't run it,
    TURBO1010> don't know what else to do.  I've made it executable,
    TURBO1010> used .shtml, don't know what else to do.

Is it WORLD-executable?  If you  have root privilege, you may create a
dummy account and use it to test your script.

--

.----------------------------------------------------------------------------.

`----------------------------------------------------------------------------'

 
 
 

Help, Apache won't run my cgi

Post by a.. » Fri, 04 Jun 1999 04:00:00


I have a similar problem.  I can run the shell from the command line,
the browser will find the file in the cgi-bin, but it either:

1) Returns the same error message when run directly --either executed
with shtml or by typing the url of the script directly.

"Internal Server Error
The server encountered an internal error or misconfiguration and
was unable to complete your request.
Please contact the server administrator, and inform them of the time the
error occurred, and anything you  might have done that may have caused
the error."

          or

2) Returns the entire script (or binary when it is a C program) when
it is run as the action of a form.

#!/bin/perl
# --script that does something
print "Content-type: text/html\n\n";
print "<HTML>\n<HEAD><TITLE></TITLE></HEAD>\n";
print "<BODY>\n";
print "//results of script";
print "</BODY></HTML>\n";

From the command line the script runs, it accepts query strings, parses
variables, and does all that its supposed to, and it prints to standard
output:

Content-type: text/html

<HTML>
<HEAD><TITLE></TITLE></HEAD>
<BODY>
//results of script
</BODY></HTML>

I use apache too (don't remember which version) on both my ISP and my
linux box at home.  I know the server has user cgi-bins. My problem
began with updating a website that already has working cgi.  I don't
have access to the other cgi on that site, though.

At first I thought it was just a problem on my linux machine, but it has
apache, perl, and a cgi-bin directory already (/home/httpd/cgi-bin).

One thing on my home machine is that files from the /home/httpd/html
directory don't automatically find files in the cgi-bin.  I need to type
a full (or relative ../cgi-bin/file.cgi) pathname in order for it to
find them.  I was under the impression that under ~/httpd/html/ files
would automatically find files in the ~/httpd/cgi-bin/.

When I use a form like:

<FORM ACTION="../cgi-bin/file.cgi" METHOD="get">
<INPUT TYPE="submit">
</FORM>

It will show the query in the location bar and then print the text of
the script.

Any suggestions?

Aaron Evans

------------------------------------



Quote:> I have apache 1.3.4, and I'm trying to run a simple perl script, but
it
> doesn't work.  I've named the webpage *.shtml and put in <!--#exec
> cgi="/cgi-bin/count.pl"--> but it doesn't work.  I know the script
works,
> because if I do perl count.pl then it returns html to me.  I think the
> problem is that apache isn't running the script, and I'd like to know
if
> anyone can help me, or at least point me in the right direction to try
to
> get apache to run my cgi.  Thanks in Advance for any assistance.

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
 
 
 

Help, Apache won't run my cgi

Post by Ian » Sat, 05 Jun 1999 04:00:00



>I have a similar problem.  I can run the shell from the command line,
>the browser will find the file in the cgi-bin, but it either:

>1) Returns the same error message when run directly --either executed
>with shtml or by typing the url of the script directly.

>"Internal Server Error
>The server encountered an internal error or misconfiguration and
>was unable to complete your request.
>Please contact the server administrator, and inform them of the time the
>error occurred, and anything you  might have done that may have caused
>the error."

Either the script is returning incorrect header information (the
Content-type bit), the script is not executable by the account the httpd
deamon is running under, or the script is returning and error message.

Quote:>          or

>2) Returns the entire script (or binary when it is a C program) when
>it is run as the action of a form.

Sounds like you haven't set up the config file to allow cgi to be run, or
it's not executable. If the cgi is there but is not executable for any
reason it will normally try to return the cgi itself. From memory the first
Apache setup I did, cgi was disabled by default.

Quote:>At first I thought it was just a problem on my linux machine, but it has
>apache, perl, and a cgi-bin directory already (/home/httpd/cgi-bin).

Just because it has the directory doesn't mean that it's configed to work.
Check the configs.

Quote:>One thing on my home machine is that files from the /home/httpd/html
>directory don't automatically find files in the cgi-bin.  I need to type
>a full (or relative ../cgi-bin/file.cgi) pathname in order for it to
>find them.  I was under the impression that under ~/httpd/html/ files
>would automatically find files in the ~/httpd/cgi-bin/.

I've never heard of a webserver looking in a different directory for the
hell of it. Normally to access something in /cgi-bin you have to preceed the
file name with /cgi-bin.

>Aaron Evans

>------------------------------------

Ian
 
 
 

1. Apache-SSL CGI's won't run

I have been unable to get Apache-SSL server to run CGI's.
 I have the following in my httpd.conf file for the server:

     Alias /cgi /home/httpsd/cgi-bin

    <Directory /home/httpsd/cgi-bin>
    Options ExecCGI
    </Directory>

 but when I open the URL httpsd://localhost/cgi/test-cgi
 it gives me the content of the script it self.
 Permissions are set 0755, and the same scripts with the
 same entry in the config file for the httpd (the non SSL
 Apache server) run as CGI's.
 Please help.
 Thanks in advance.

--
Ken Lesick

2. Where is LINUX.EXE?

3. CGI's won't run - Apache Newbie Lost and Presumed Dead

4. Motif-2.0 for Linux

5. Apache CGI won't run Perl!

6. Netscape 4.05 & Fetchmail

7. Action directive won't run cgi in non ScriptAlias'ed dir?

8. login problem

9. Why won't NCSA run my CGI's?

10. HELP : Can't Run Perl and CGI on Apache 1.3b3 for win32 (on win95)

11. APACHE CGI's won't execute (forbidden) whats the deal?

12. Apache 1.3b3 on Win NT -- problem running CGI

13. CGI prog won't run.