Xampp cgi-bin problem

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

Xampp cgi-bin problem

Postby richardpd » 17. February 2010 01:36

Hi

I have been trying to run simple helloworld.cgi in Xampp cgi-bin but unsuccessfully (helloworld.pl also does not work).


http://localhost:8080/cgi-bin/helloworld.cgi
The error message is:
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
localhost
16/02/2010 23:22:54
Apache/2.2.12 (Win32) DAV/2 mod_ssl/2.2.12 OpenSSL/0.9.8k mod_autoindex_color PHP/5.3.0 mod_jk/1.2.28 mod_perl/2.0.4 Perl/v5.10.0


The error log:

[Wed Feb 17 00:22:17 2010] [notice] Server built: Jul 22 2009 11:35:54
[Wed Feb 17 00:22:17 2010] [notice] Parent: Created child process 4316
[Wed Feb 17 00:22:18 2010] [notice] Digest: generating secret for digest authentication ...
[Wed Feb 17 00:22:18 2010] [notice] Digest: done
[Wed Feb 17 00:22:20 2010] [notice] Child 4316: Child process is running
[Wed Feb 17 00:22:20 2010] [notice] Child 4316: Acquired the start mutex.
[Wed Feb 17 00:22:20 2010] [notice] Child 4316: Starting 150 worker threads.
[Wed Feb 17 00:22:20 2010] [notice] Child 4316: Starting thread to listen on port 4499.
[Wed Feb 17 00:22:20 2010] [notice] Child 4316: Starting thread to listen on port 4499.
[Wed Feb 17 00:22:20 2010] [notice] Child 4316: Starting thread to listen on port 8080.
[Wed Feb 17 00:22:20 2010] [notice] Child 4316: Starting thread to listen on port 8080.
[Wed Feb 17 00:22:22 2010] [error] [client 127.0.0.1] C:/xampp/cgi-bin/helloworld.cgi is not executable; ensure interpreted scripts have "#!" first line
[Wed Feb 17 00:22:22 2010] [error] [client 127.0.0.1] (9)Bad file descriptor: don't know how to spawn child process: C:/xampp/cgi-bin/helloworld.cgi
[Wed Feb 17 00:22:59 2010] [error] [client 127.0.0.1] C:/xampp/cgi-bin/helloworld.cgi is not executable; ensure interpreted scripts have "#!" first line
[Wed Feb 17 00:22:59 2010] [error] [client 127.0.0.1] (9)Bad file descriptor: don't know how to spawn child process: C:/xampp/cgi-bin/helloworld.cgi
[Wed Feb 17 00:23:01 2010] [error] [client 127.0.0.1] C:/xampp/cgi-bin/helloworld.cgi is not executable; ensure interpreted scripts have "#!" first line
[Wed Feb 17 00:23:01 2010] [error] [client 127.0.0.1] (9)Bad file descriptor: don't know how to spawn child process: C:/xampp/cgi-bin/helloworld.cgi
[Wed Feb 17 00:24:27 2010] [error] [client 127.0.0.1] C:/xampp/cgi-bin/helloworld.cgi is not executable; ensure interpreted scripts have "#!" first line
[Wed Feb 17 00:24:27 2010] [error] [client 127.0.0.1] (9)Bad file descriptor: don't know how to spawn child process: C:/xampp/cgi-bin/helloworld.cgi
[Wed Feb 17 00:24:46 2010] [notice] Parent: Received shutdown signal -- Shutting down the server.
[Wed Feb 17 00:24:46 2010] [notice] Child 4316: Exit event signaled. Child process is ending.
[Wed Feb 17 00:24:47 2010] [notice] Child 4316: Released the start mutex
[Wed Feb 17 00:24:48 2010] [notice] Child 4316: All worker threads have exited.
[Wed Feb 17 00:24:48 2010] [notice] Child 4316: Child process is exiting
[Wed Feb 17 00:24:48 2010] [notice] Parent: Child process exited successfully.


The helloworld.cgi:
#!C:\xampp\perl\bin\perl.exe

# Tell perl to send a html header.
# So your browser gets the output
# rather then <stdout>(command line
# on the server.)
print "Content-type: text/html\n\n";

# print your basic html tags.
# and the content of them.
print "<html><head><title>Hello World!! </title></head>\n";
print "<body><h1>Hello world</h1></body></html>\n";

What am I doing wrong & can anyone help me fix this please?
richardpd
 
Posts: 13
Joined: 24. January 2010 23:54

Re: Xampp cgi-bin problem

Postby richardpd » 17. February 2010 11:38

Further to my first post I am still having problems with this and am posting another example when I tried to run a different perl script (first.pl) from xampp cgi-bin folder.
This is the resulting error message:

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

Error message:
couldn't create child process: 720003: first.pl

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

Error 500
localhost
17/02/2010 10:26:01
Apache/2.2.12 (Win32) DAV/2 mod_ssl/2.2.12 OpenSSL/0.9.8k mod_autoindex_color PHP/5.3.0 mod_jk/1.2.28 mod_perl/2.0.4 Perl/v5.10.0

I have been doing internet searches to find the cause of these problems but haven't found the solution yet.
Can someone please reply with help so I can run perl & cgi scripts from Xampp cgi-bin?
I look forward to helpful replies, thanks
richardpd
 
Posts: 13
Joined: 24. January 2010 23:54

Re: Xampp cgi-bin problem

Postby richardpd » 17. February 2010 12:13

Hi again
I solved the issue with first.pl by changing first.pl shebang line to point to Xampp/perrl

ie:
Change this first.pl
[http://httpd.apache.org/docs/2.0/howto/cgi.html]
#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "Hello, World.";

to this first.pl
#!/xampp/perl/bin/perl -w
print "Content-type: text/html\n\n";
print "Hello, World.";

I had tried a similar (but not exactly the same) shebang line for my first issue to point to xampp/perl.
I will try this shebang line & see if all works to solve my first problem & my issue of using .pl & .cgi in Xampp cgi-bin.
(I used this shebang line from this link/ post on apachefriends forum:http://community.apachefriends.org/f/viewtopic.php?p=68577&sid=4293c830a984784bbc9d26123bd33c35)

I hope this post helps anyone else struggling with this!
richardpd
 
Posts: 13
Joined: 24. January 2010 23:54

Re: Xampp cgi-bin problem

Postby richardpd » 17. February 2010 12:33

As my last post stated my new shebang line in first.pl worked so I thought this would work for helloworld.pl
and I changed this to the same shebang line but this does not run in local host browser!

Here is helloworld.pl

#!/xampp/perl/bin/perl -w

# Tell perl to send a html header.
# So your browser gets the output
# rather then <stdout>(command line
# on the server.)
print "Content-type: text/html\n\n";

# print your basic html tags.
# and the content of them.
print "<html><head><title>Hello World!! </title></head>\n";
print "<body><h1>Hello world</h1></body></html>\n";

and this brings up this error message again:
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
localhost
17/02/2010 11:31:15
Apache/2.2.12 (Win32) DAV/2 mod_ssl/2.2.12 OpenSSL/0.9.8k mod_autoindex_color PHP/5.3.0 mod_jk/1.2.28 mod_perl/2.0.4 Perl/v5.10.0


Very strange!

So my xampp cgi-bin issues are not yet fully fixed! I am still grateful for any helpful replies to help me understand & fix this....
Thanks
richardpd
 
Posts: 13
Joined: 24. January 2010 23:54

Re: Xampp cgi-bin problem

Postby richardpd » 17. February 2010 12:42

Oh dear! Another post soon after my last one!
I changed helloworld.pl to helloworld1.pl by removing all the 'hashed' comments
ie:
#!/xampp/perl/bin/perl -w

print "Content-type: text/html\n\n";

print "<html><head><title>Hello World!! </title></head>\n";
print "<body><h1>Hello world</h1></body></html>\n";

and guess what? This displays correctly in localhost browser now!
What was the matter with the comments in the original helloworld.pl script?

Anyway I am slowly making progress and hope to learn about perl and cgi using Xampp localhost. This could be an interesting learning curve!
richardpd
 
Posts: 13
Joined: 24. January 2010 23:54


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 63 guests