Perl error message

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Perl error message

Postby mrsmith » 26. May 2010 10:51

Hi,

I have installed on XAMPP on Windows XP 32-bits and apache server works perfectly well except perl.

I have two version of hello.pl and hello-oo.pl. (oo = object oriented)

I attempted to execute it by typing 192.168.1.25/cgi-bin/hello.pl (hello-oo.pl too)

The source code for hello.pl is:

#!/usr/bin/perl

use strict;
use CGI ':standard';

print header;
print start_html('Hello World');
print h1('Hello World');
print end_html();

exit;

And oo version is:

#!/usr/bin/perl

use strict;
use CGI;

my $cgi = new CGI;

print $cgi->header;
print $cgi->start_html('Hello World');
print $cgi->h1('Hello World');
print $cgi->end_html();

exit;

The error messages in apache error.log are:

The system cannot find the path specified. : couldn't create child process: 720003: hello-oo.pl
The system cannot find the path specified. : couldn't spawn child process: C:/xampp/cgi-bin/hello-oo.pl
The system cannot find the path specified. : couldn't create child process: 720003: hello.pl
The system cannot find the path specified. : couldn't spawn child process: C:/xampp/cgi-bin/hello.pl

How can I do to resolve it?

Thanks kindly in advance

M
mrsmith
 
Posts: 4
Joined: 03. May 2010 16:35

Re: Perl error message

Postby Nobbie » 26. May 2010 11:01

mrsmith wrote:#!/usr/bin/perl


You have Perl installed in /usr/bin on your Windows PC?
Nobbie
 
Posts: 8772
Joined: 09. March 2008 13:04

Re: Perl error message

Postby mrsmith » 26. May 2010 11:53

Yes i have installed perl on Windows XP at c:\perl
mrsmith
 
Posts: 4
Joined: 03. May 2010 16:35

Re: Perl error message

Postby Altrea » 26. May 2010 12:12

mrsmith wrote:Yes i have installed perl on Windows XP at c:\perl

So, why does your shebang route to folder usr/bin/perl?

mrsmith wrote:
Code: Select all
#!/usr/bin/perl
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 8294
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64

Re: Perl error message

Postby mrsmith » 26. May 2010 12:37

Hi,

I am newbie on perl programming.

I was following the "Hello World" programming exercise from the book "SAMS Teach yourself CGI in 24 hours".

What is the correct statement? What it should be? "c:\perl"?

Thanks in advance

Mike
mrsmith
 
Posts: 4
Joined: 03. May 2010 16:35

Re: Perl error message

Postby Altrea » 26. May 2010 12:50

Code: Select all
#!C:\Perl\bin\perl.exe


or something which is correct on your Perl installation path
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 8294
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64

Re: Perl error message

Postby MC10 » 31. May 2010 00:40

I think you need to use forward slashes, not backslashes, like so:

Code: Select all
#!C:/Perl/bin/perl.exe
Last edited by MC10 on 31. May 2010 23:24, edited 1 time in total.
MC10
 
Posts: 148
Joined: 20. February 2010 20:13

Re: Perl error message

Postby JonB » 31. May 2010 02:41

uhhh - aren't we talking about a XAMMP install on windows??

I think XAMPP wants to use its 'own' Perl. (and you may need to turn mod_perl off).

This is the setting from my YaBB board. i.e. I know it works, LOL. :wink:

Code: Select all
#!C:/xampp/perl/bin/perl.exe


Perl escapes the slashes in a Windows environment.

An ActiveStates install will put Perl in c:\perl by default (I have Active States 5.10 installed as well, but XAMPP uses the Perl dlls found in /perl/bin - I have been working to get a new port of Webmin to run, so I have been experimenting with these) No dice on Webmin on windows for 5.10 Perl :(

Good Luck

8)
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7

Re: Perl error message

Postby Altrea » 31. May 2010 04:58

MC10 wrote:I think you need to use forward slashes, not backslashes, like so:

Code: Select all
#!C:\Perl\bin\perl.exe

Thank you very much for the correction.
I get fooled from one of the perl tutorials out in the web which uses Backslashes in the shebang :D
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 8294
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64

Re: Perl error message

Postby peterwt » 31. May 2010 10:28

Using xampp ver 1.6.4 under Windows Vista.

I have just come across this problem.

All the Perl scripts I have written in the past work. I wanted to experiment with cookies using Perl.

The line use CGI;, which I have not used before, but is in the cookie script, is causing the problem. The error log points to this line.

As I understand it, CGI is a module which appears to be missing. In xampp/perl/bin there is only perl.exe.

The script works when I upload to my hoating site.

How do I get CGI module installed?

By the way if you are running xampp under Windows you can change in httpd.conf -

# To enable the this Windows specific behavior (and therefore -disable- the
# equivilant Unix behavior), uncomment the following directive:
#
ScriptInterpreterSource registry

and set the default program for .pl or .cgi files to run perl.exe then the shebang line in Perl scripts will be ignored.

Peter
Peter
peterwt
 
Posts: 42
Joined: 17. March 2009 11:06
Operating System: Windows 7 64 bit Professional

Re: Perl error message

Postby JonB » 31. May 2010 14:19

peterwt:

You didn't give the actual error. or the code that created it.

CGI:: is a Perl MOD, not a dll or exe. Its a piece of Portable Perl. Perl has repository systems and Module Managers, much like PHP or Linux. Google 'CPAN' and 'PPM'.

the CGI Perl mod is installed. Look on your XAMPP Perlinfo page (give it a chance to complete). Down in All Perl Mods you will find CGI 3.48 Handle Common Gateway Interface requests and responses. I know it (CGI) works cause my forum software uses it for cookies and doing uploads.

Its only a guess, but CGI needs a temporary workspace, you may need to create a directory called c:\temp. Otherwise it uses the PWD, or the root of the script (as I recall) in that order. You can define the location with an environment variable, I think.
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7

Re: Perl error message

Postby peterwt » 31. May 2010 15:41

jonB:

Thanks for your reply. I am usung xampp ver 1.6.4 which seems to have a basic version of Perl. in the xampp/perl/bin folder there is only perl.exe.

I can not find perlinfo, only phpinfo.
I have had no problems in scripts until I tried one to use cookies. This is the first script I have put the directive CGI;
Code: Select all
#!/usr/bin/perl -w

use CGI qw(:standard);
#rest of script


The errors I get are -
[Mon May 31 15:22:21 2010] [error] [client 127.0.0.1] Premature end of script headers: cookies.cgi, referer: http://localhost/Ptest.html
[Mon May 31 15:22:21 2010] [error] [client 127.0.0.1] Can't locate CGI.pm in @INC (@INC contains: .) at C:\\xampp\\htdocs\\mysites\\cgi-bin\\cookies.cgi line 3.\r, referer: http://localhost/Ptest.html
[Mon May 31 15:22:21 2010] [error] [client 127.0.0.1] BEGIN failed--compilation aborted at C:\\xampp\\htdocs\\mysites\\cgi-bin\\cookies.cgi line 3.\r, referer: http://localhost/Ptest.html

This points to line 3 - use CGI qw(:standard);

It appears that my perl does not have CGI module.

Peter
Peter
peterwt
 
Posts: 42
Joined: 17. March 2009 11:06
Operating System: Windows 7 64 bit Professional

Re: Perl error message

Postby JonB » 31. May 2010 16:01

peter:

I spent the time to extract XAMPP 1.6.4, you are correct, and that version would require a good amount of work to make it a workable Perl environment. The is no 'lib' folder included.

Unless there is some overriding reason, I would simply suggest you get on the current version, it has a well developed and rich Perl environment. If you are going to write and test scripts, take the time to upgrade (its a reinstall) -- I don't know what else you have in that environment, but working with Perl will be torturous.

If you don't have things to save, for sure make the upgrade. If you only have HTML files, save the htdocs folder to a location outside XAMPP.

If you have other projects such as PHP or MySQL databases, the process should not so bad. Dump the databases, and save all your settings in text files, Save your htdocs folder by copying it to a secure location and so forth.

I'm not trying to give you a comprehensive guide to upgrading, just saying to get your ducks in a row first

BTW, even if the installation does not require a shebang line, it serves another function - (hint) to tell you where to look for components.


The Good News:

XAMMP 1.7.3 comes with a fairly tricked out set of Perl Mods aleady in place. Some mods are windows or *nix specific (mostly ones for system functions), and won't work in all environments, so you may not find them in all installations. I was able to get every one of my apps running with no Mod's needing installation (which is not true for ActiveStates), other than the Webmin port which is dependent on one of those OS specific Perl mods that is not available in the current version 5.10.

Good Luck
8)
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7

Re: Perl error message

Postby peterwt » 01. June 2010 10:04

JonB:

Many thanks.

Looking at the version history of XAMPP it shows that Perl Add-In was not included in the distribution until version 1.7.2, after the version I have.

I downloaded a current version of Perl with library and modules and it now works.

Peter
Peter
peterwt
 
Posts: 42
Joined: 17. March 2009 11:06
Operating System: Windows 7 64 bit Professional

Re: Perl error message

Postby JonB » 01. June 2010 11:50

Great -

Perl is not the darling of the webworld it once was, but it is a tool you can do almost anything with (including writing free-standing programs that can be compiled into executables - take THAT, PHP!, LOL).

Good Luck
8)
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 41 guests