You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Ke...@emc.com on 2003/11/27 20:36:16 UTC
[users@httpd] cgi executables on windows
Hi:
I am using apache to run some perl scripts using cgi on Windows 2000. I am
having some trouble and any help would be greatly appreciated. It is very
simple and I performed this on UNIX before but I can't get it to work on
Windows.
The scripts are not running. Instead Apache is serving out the contents of
the script and I am literally seing the perl code.
I have attempted using 3 different configurations to get it to work (see
config extract below).
(1) & (2) SetHandler & AddHandler directives.
The script is located in /SmoothieRedirected/cgi-bin and is called test.pl.
I have another file called test.cgi that calls the perl script. When I run
the script from the command line it outputs html as expected. When I invoke
it from a form or directly using a URL, Apache doesn't invoke the script but
just literally serves out the content of test.cgi. I put in SetHandler and
AddHandler directives to attempt to get this to work.
(3) ScriptInterpreterSource directive
I also tried setting the ScriptInterpreterSource directive to use the
regisry and I invoked the perl script directly.
Here, I see the perl code.
Note:
* When I use a bat file, the browser downloads it and runs it in a dos
window.
* I am using the apache server as both a server and a proxy. I don't
see why this should have any impact.
#------------------------------------------------------------
# CGI-script
#------------------------------------------------------------
<Location /SmoothieRedirected/cgi-bin>
SetHandler cgi-script
</Location>
AddHandler cgi-script cgi
ScriptInterpreterSource registry
=======================================================
The script is simply:
#!C:/Perl/bin/perl.exe
print "Content-type: text/html\n\n
<HEAD>
<TITLE>Simple HTML Example</TITLE>
</HEAD>
<BODY>
<HR>
<H1>Hello, this is my first CGI script!</H1>
<HR>
</BODY> ";
____________________________________________
Martin Kerrigan, EMC²
Software Development Tel: +353-21-4281689
Cork, Ireland. e-mail: kerrigan_martin@emc.com
____________________________________________
http://www.webmasterworld.com/forum13/3319.htm
<http://www.webmasterworld.com/forum13/3319.htm>
Re: [users@httpd] cgi executables on windows
Posted by Michael Scott <ms...@pyewacket.org>.
Quoting Kerrigan_Martin@emc.com:
> Hi:
>
> I am using apache to run some perl scripts using cgi on Windows 2000. I
> am
> having some trouble and any help would be greatly appreciated. It is
> very
> simple and I performed this on UNIX before but I can't get it to work
> on
> Windows.
>
It sounds like Apache doesn't know it's an executable.
Are you giving the files .pl extensions? In the windows world, extension are
everything. What happens if you go to a C:> prompt and type the file name? If
it doesn't execute there, chances are Apache won't run it.
<snip>
> =======================================================
> The script is simply:
>
> #!C:/Perl/bin/perl.exe
^^^^^^^^^^^^^^^^^^^^^^
This means nothing to the Windows command interpreter. It relies solely on the
name of the file, or rather the extension, to decide how to process it.
----------------------
- Mike Scott
- mscott@pyewacket.org
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] cgi executables on windows
Posted by Marty Landman <ML...@face2interface.com>.
At 02:36 PM 11/27/2003, Kerrigan_Martin@emc.com wrote:
>
>I am using apache to run some perl scripts using cgi on Windows 2000. I am
>having some trouble and any help would be greatly appreciated. It is very
>simple and I performed this on UNIX before but I can't get it to work on
>Windows.
Kerrigan, I had trouble when initially setting up Apache 2 to run cgi's on
my Windows XP box and then got it working. Getting it going on my FreeBSD
box was no problem, although that I assume was because it was already going
on Windows.
>The scripts are not running. Instead Apache is serving out the contents of
>the script and I am literally seing the perl code.
Here's an extract of what's in my httpd.conf file:
LoadModule cgi_module modules/mod_cgi.so
<Directory "E:/Apache Group/Apache2/web">
Options +ExecCGI
[snip]
</Directory>
ScriptAlias /cgi-bin/ "E:/Apache Group/Apache2/cgi-bin/"
<Directory "E:/Apache Group/Apache2/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
AddHandler cgi-script .cgi .pl
Apologies if this is more than you need -- or less. As the previous poster
mentioned you'll need .pl on that last AddHandler directive if you're
trying to run the script as a .pl.
Marty Landman Face 2 Interface Inc 845-679-9387
Sign On Required: Web membership software for your site
Make a Website: http://face2interface.com/Home/Demo.shtml
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org