Page 1 of 2

Perl on XAMPP

PostPosted: 07. April 2011 08:16
by fakename
Hi,

I am a newbie to PERL and started it with XAMPP. I got to know that to run PERL CGi I need to have "lib" directory within "xampp/perl/" with "strict.pm" but there doesn't exist as such. I just have "bin" directory with "perl.exe" there. Please help me what should be done.

Re: Perl on XAMPP

PostPosted: 07. April 2011 20:42
by Sharley
Which XAMPP version are you referring to?

Re: Perl on XAMPP

PostPosted: 08. April 2011 09:31
by fakename
Its XAMPP for Windows Version 1.7.1

Re: Perl on XAMPP

PostPosted: 08. April 2011 09:59
by Sharley
1.7.1 needs to have a perl add-on installed to get the full version.

Now download and install the perl add-on from here:
http://sourceforge.net/projects/xampp/f ... rl/5.10.0/

You need to decide which style of install either the installer or exe or the zip file of this version:
xampp-win32-perl-addon-5.10.0-2.2.11 pl2
Suitable for XAMPP 1.7.1
Read the readme-addon-perl.txt file contained in the addon download - all downloaded files can be opened with 7zip so you can read the readme file.

If you click on the little black circle with i in it then you can read the release notes for each version and then you can decide which to use.

Let us know how you get on.


BTW XAMPP 1.7.2 onwards has full perl included in the installation - 1.7.1 was the last version that needed an add-on.


Best wishes.

Re: Perl on XAMPP

PostPosted: 11. April 2011 10:52
by fakename
Hi,
I have installed xampp 1.7.2. But after installation the php files in cgi-bin folder have stopped working giving the following error "Server error!

The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there was an error in a CGI script. " :cry:

Re: Perl on XAMPP

PostPosted: 11. April 2011 10:55
by Sharley
Read the \xampp\apache\logs\error.log file for clues about your server error.

Re: Perl on XAMPP

PostPosted: 11. April 2011 10:58
by fakename
It says
"[Mon Apr 11 15:07:08 2011] [error] [client 127.0.0.1] (9)Bad file descriptor: don't know how to spawn child process: H:/xampp/cgi-bin/midi/midi.php
[Mon Apr 11 15:10:26 2011] [error] [client 127.0.0.1] H:/xampp/cgi-bin/index.php is not executable; ensure interpreted scripts have "#!" first line
[Mon Apr 11 15:10:26 2011] [error] [client 127.0.0.1] (9)Bad file descriptor: don't know how to spawn child process: H:/xampp/cgi-bin/index.php"

Re: Perl on XAMPP

PostPosted: 11. April 2011 11:25
by Sharley
You need to add a shebang line to the top of every file that contains perl script that you want to be executed in the cgi-bin like so:
Code: Select all
#!"H:\xampp\perl\bin\perl.exe"
It has to be the very first line right at the top of the page before anything else.
Save the files and then try again to execute your scripts.

This line in your error message was the clue
Code: Select all
[Mon Apr 11 15:10:26 2011] [error] [client 127.0.0.1] H:/xampp/cgi-bin/index.php is not executable; ensure interpreted scripts have "#!" first line

Re: Perl on XAMPP

PostPosted: 11. April 2011 11:41
by fakename
Thanks for your reply. I did that but got the following error
"The server encountered an internal error and was unable to complete your request.

Error message:
Premature end of script headers: index.php "

My script says
"
#!"H:\xampp\perl\bin\perl.exe"
<?php
?>
<form method="post" action="test.pl">
<textarea name="mytextarea">textarea content</textarea>
<input type="submit" name="submit" value="submit" />
</form>
"

Re: Perl on XAMPP

PostPosted: 11. April 2011 11:48
by Sharley
Code: Select all
"
#!"H:\xampp\perl\bin\perl.exe"
<?php
?>
<form method="post" action="test.pl">
<textarea name="mytextarea">textarea content</textarea>
<input type="submit" name="submit" value="submit" />
</form>
"
I said to put the shebang right at the top of your page and you put it on the second line.

What are these 2 " " doing floating in space.

You index.php is either not complete or you need to do some more reading - there is no php code included and have you put the shebang line in your test.pl script?
Code: Select all
#!"H:\xampp\perl\bin\perl.exe"
<?php
?>
<form method="post" action="test.pl">
<textarea name="mytextarea">textarea content</textarea>
<input type="submit" name="submit" value="submit" />
</form>

Re: Perl on XAMPP

PostPosted: 11. April 2011 11:50
by fakename
I added this
#!"H:\xampp\perl\bin\perl.exe"
<?php
?>
<form method="post" action="test.pl">
<textarea name="mytextarea">textarea content</textarea>
<input type="submit" name="submit" value="submit" />
</form>

those were the double quotes

Re: Perl on XAMPP

PostPosted: 11. April 2011 11:56
by Sharley
Use the forum Code tags from the menu when you write code in a post, that's what the Code tags are for.

Try and remove the php tag lines as I can't see you need them as there is no php code in between.

Then you can rename that file index.html

Re: Perl on XAMPP

PostPosted: 11. April 2011 11:59
by fakename
Hi
I removed the tags and renamed the file. When I try to access it, it gives the error
Server error!

The server encountered an internal error and was unable to complete your request.

Error message:
Premature end of script headers: index.html

If you think this is a server error, please contact the webmaster.
Error 500

Re: Perl on XAMPP

PostPosted: 11. April 2011 12:04
by Sharley
I did say that server errors should be read from the apache error log file not the browser.

Remove the shebang line as you don't have any perl code either to execute.

You really do need to do some reading and learning as we are here to help with any issues you have with XAMPP and it's components not to tutor code issues.

Sorry I can't be of any more help.

Good luck.

Re: Perl on XAMPP

PostPosted: 11. April 2011 12:11
by fakename
Thanks for your reply but I never added that line and did that when asked by the forum members coz I myself being an experienced php programnmer know that we don't need to add the lines until and unless needed and and after removing the line I am back to the same problem.
Server error!

The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there was an error in a CGI script.

If you think this is a server error, please contact the webmaster.
Error 500

I already played with all this stuff which you told but did again on the faith that forum members are right coz they guide.

Thanks.