简体   繁体   中英

Cygwin Perl CGI with Xampp

Recently I installed XAMPP (Apache) server for running CGI script on windows machine. As you know, XAMPP has the option to install PERL but i didn't select it, i want to use Cygwin's PERL for executing those.

Problem is when I'm trying to run a basic CGI script , I get the following error

[Tue Sep 20 19:51:10.473825 2016] [win32:error] [pid 12420:tid 1848] [client ::1:57051] AH02102: C:/xampp/cgi-bin/perltest.cgi is not executable; ensure interpreted scripts have "#!" or "'!" first line`enter code here`

[Tue Sep 20 19:51:10.473825 2016] [cgi:error] [pid 12420:tid 1848] (9)Bad file descriptor: [client ::1:57051] AH01222: don't know how to spawn child process: C:/xampp/cgi-bin/perltest.cgi

Meaning the Cygwin Perl path is not vaild. However , I did change the path and put a shebang still its now working . This is the one i'm using:

#!C:\cygwin64\bin\perl.exe

Any help is appreciated

The shbang concept doesn't exit on Windows. Apache is known to have emulated the concept of shbang on Windows (by reading the first line of the script), but still there may be problems.

Better thing is just use Windows batch files (.bat files) on Windows as CGI scripts (you can also use .vbs).

Just do the SetHander (or AddHandler) for the particular type of script in Apache's configuration and then use a batch file like HelloWorld.bat.

@echo off
echo "content-type: text/plain"
echo.
echo "Hello World"
dir

In place of dir you can substitute any other binary (such as perl.exe).

在粘贴或更换shebang时,它移动到了第二条线并使其无法工作,但它现在正在工作。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM