After Reboot Perl CGI Scripts don't work

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

After Reboot Perl CGI Scripts don't work

Postby Ryun » 30. April 2009 13:47

Hi, a friend of mine pointed me to xampp and at first everything was going great. Then I restarted my computer and when I tried to run my scripts again I was greeted with this error message:

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

Error message:
Cannot open: Invalid argument at C:/xampp/cgi-bin/loginscript.pl line 15. , <--- Here I am opening a .txt file in the same directory

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

Error 500
localhost
4/30/2009 8:39:17 AM
Apache/2.2.11 (Win32) DAV/2 mod_ssl/2.2.11 OpenSSL/0.9.8i PHP/5.2.9 mod_perl/2.0.4 Perl/v5.10.0

The server log just tells me the exact same thing. The weird part is though on my desktop at home when I reinstall xampp the scripts will work fine. However, I'm am using my friend's laptop so I could get my project (that's due today before 4PM EST) done at the library and then show it to my teacher. Unfortunately my teacher is clueless about these matters and this laptop is really my only medium for showing my work.

The only things similar between the laptop and my desktop is that they have HTML-kit installed, and they are both running Windows XP SP3. There are not logs in event viewer, and apache is using port 80 without interruption.

From my observations it appears like xampp "forgets" the perl interpreter after a reboot and almost all calls made using perl syntax are either ignored or throw an exception. Any and all help is greatly appreciated!
Ryun
 
Posts: 8
Joined: 30. April 2009 13:34

Re: After Reboot Perl CGI Scripts don't work

Postby Wiedmann » 30. April 2009 13:51

The server log just tells me the exact same thing.

I don't think so. The server log shows you the exact reason for an error 500.
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Re: After Reboot Perl CGI Scripts don't work

Postby Ryun » 30. April 2009 13:55

Unless I'm looking in the wrong place (c:\xampp\apache\logs\error.txt) this is all it says:

[Thu Apr 30 08:38:08 2009] [notice] Apache/2.2.11 (Win32) DAV/2 mod_ssl/2.2.11 OpenSSL/0.9.8i PHP/5.2.9 mod_perl/2.0.4 Perl/v5.10.0 configured -- resuming normal operations
[Thu Apr 30 08:38:08 2009] [notice] Server built: Dec 10 2008 00:10:06
[Thu Apr 30 08:38:08 2009] [notice] Parent: Created child process 232
[Thu Apr 30 08:38:12 2009] [notice] Digest: generating secret for digest authentication ...
[Thu Apr 30 08:38:12 2009] [notice] Digest: done
[Thu Apr 30 08:38:17 2009] [notice] Child 232: Child process is running
[Thu Apr 30 08:38:17 2009] [notice] Child 232: Acquired the start mutex.
[Thu Apr 30 08:38:17 2009] [notice] Child 232: Starting 250 worker threads.
[Thu Apr 30 08:38:17 2009] [notice] Child 232: Starting thread to listen on port 443.
[Thu Apr 30 08:38:17 2009] [notice] Child 232: Starting thread to listen on port 80.
[Thu Apr 30 08:39:17 2009] [error] Cannot open: Invalid argument at C:/xampp/cgi-bin/loginscript.pl line 15.\n
[Thu Apr 30 08:44:54 2009] [error] Cannot open: Invalid argument at C:/xampp/cgi-bin/loginscript.pl line 15.\n
Ryun
 
Posts: 8
Joined: 30. April 2009 13:34

Re: After Reboot Perl CGI Scripts don't work

Postby Wiedmann » 30. April 2009 13:58

[Thu Apr 30 08:39:17 2009] [error] Cannot open: Invalid argument at C:/xampp/cgi-bin/loginscript.pl line 15.\n
[Thu Apr 30 08:44:54 2009] [error] Cannot open: Invalid argument at C:/xampp/cgi-bin/loginscript.pl line 15.\n

And what's the line 15 from that script?
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Re: After Reboot Perl CGI Scripts don't work

Postby Ryun » 30. April 2009 14:01

open(USER, "http://localhost/cgi-bin/usernames.txt") or die("Cannot open: $!");

By the way, thanks for the quick responses. Like I said before, usernames.txt is in the same directory and no matter how I call it I still get an error.
Ryun
 
Posts: 8
Joined: 30. April 2009 13:34

Re: After Reboot Perl CGI Scripts don't work

Postby Wiedmann » 30. April 2009 14:13

Code: Select all
open(USER, "http://localhost/cgi-bin/usernames.txt") or die("Cannot open: $!");

I don't think you can open a http uri with Perls' open() function.
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Re: After Reboot Perl CGI Scripts don't work

Postby Ryun » 30. April 2009 14:32

I should be able to, especially since it worked flawlessly before the reboot. When I try using an absolute path, on usernames.txt I don't get an error but the perl functions I call, such as when I'm trying to set a cookie are completely ignored. It's as if it doesn't want to compile perl.
Ryun
 
Posts: 8
Joined: 30. April 2009 13:34

Re: After Reboot Perl CGI Scripts don't work

Postby Wiedmann » 30. April 2009 14:37

I don't think you can open a http uri with Perls' open() function.

I should be able to

Well, the Perl manual about open() writes something other...

When I try using an absolute path, on usernames.txt I don't get an error but the perl functions I call, such as when I'm trying to set a cookie are completely ignored.

And if you are using an absolute path, did you have somthing in the error.log?
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Re: After Reboot Perl CGI Scripts don't work

Postby Ryun » 30. April 2009 14:45

No, I don't get any errors in the error log.
Ryun
 
Posts: 8
Joined: 30. April 2009 13:34

Re: After Reboot Perl CGI Scripts don't work

Postby Wiedmann » 30. April 2009 14:49

No, I don't get any errors in the error log.

So we must assume, the script is working correct.

perl functions I call, such as when I'm trying to set a cookie are completely ignored

Why did you think, these funktions are ignored?

BTW:
Is the testscript (printenv.pl), which is part of the XAMPP install, working?
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Re: After Reboot Perl CGI Scripts don't work

Postby Ryun » 30. April 2009 15:04

Yes the printenv.pl file does print out what it's supposed to.

The reason I feel like functions are being skipped is because my cgi scripts were working perfectly before the reboot and now they can't even do seemingly simply functions like creating a cookie (that's when I strip them down to do just one task too mind you).
Ryun
 
Posts: 8
Joined: 30. April 2009 13:34

Re: After Reboot Perl CGI Scripts don't work

Postby Wiedmann » 30. April 2009 15:09

and now they can't even do seemingly simply functions like creating a cookie

How have you verified this?
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Re: After Reboot Perl CGI Scripts don't work

Postby Ryun » 30. April 2009 15:31

#!c:/xampp/perl/bin/perl.exe

use strict;
use warnings;
use CGI qw(:standard);

my $username = 'justin';
print ("Set-Cookie:username=$username;\n");


Just like that
Ryun
 
Posts: 8
Joined: 30. April 2009 13:34

Re: After Reboot Perl CGI Scripts don't work

Postby Ryun » 30. April 2009 17:03

Well, good news is it appears I've resolved the problem. If I simply try and read the file it throws an exception but if I open my username.txt file for updating (writing and reading) like so: open(USER, "+< usernames.txt") it works just fine, thank you for your help Wiedmann. I guess I'll never know why rebooting caused an issue though...
Ryun
 
Posts: 8
Joined: 30. April 2009 13:34


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 144 guests