Yup, that's a known issue. It's not actually Cygwin that requires the 'SYSTEMROOT' environment variable setting. It's winsock. :-(
Larry At 04:05 PM 10/6/2004, you wrote: >A couple of months ago I reported a problem trying to use Apache and perl >for web development. The problem was that all attempts to use any kind of >a socket failed. > >I just got this note from Eric Davis. He's worked out the problem and a >work-around. > >He asked me to forward this to the mailing list as he is not subscribed. > >dar > > > > >---------- Forwarded message ---------- >Date: Wed, 6 Oct 2004 12:18:29 -0700 >From: Eric Davis <[EMAIL PROTECTED]> >To: [EMAIL PROTECTED] >Cc: [EMAIL PROTECTED] >Subject: Fix: Socket problem w/ apache & perl cgi > > >Hi David, > >I came across your post on the Cygwin mailing list about Perl/CGI not >working under Apache. > > http://www.cygwin.com/ml/cygwin/2004-07/msg01080.html > >Like you, I was also pulling my hair out on this and figured out the >problem/solution. I verified that the problem exists and the solution >works for both the Apache and Boa web servers. > >The following CGI script works from the bash prompt but fails as a >CGI program (name - proto_real.cgi): > > #!/usr/bin/perl > > print "Content-Type: text/html\r\n\r\n<html>\n<head></head>\n<body>\n"; > > my $num; > (undef, undef, $num) = getprotobyname('tcp'); > > if ($num) > { > print "OK: tcp($num)<br/>\n"; > } > else > { > print "ERROR<br/>\n"; > } > > print "</body>\n</html>\n"; > > >The problem has to do with (good) Web servers removing all the existing >environment variables before a fork and exec of the CGI script, and of >course building new environment variables containing all the CGI data. >For some reason, Cygwin requires the SYSTEMROOT environment variable to >be set for things to work properly. > >The fix (i.e. without modifying any Web server CGI code) is to create >a wrapper around the real script. This wrapper simply sets the >SYSTEMROOT environment variable and executes the real script. Here >is an example wrapper (name - proto.cgi): > > #!/usr/bin/perl > > $ENV{SYSTEMROOT} = "C:\\WINDOWS"; > > exec 'proto_real.cgi' > > >That should do it. With this, I can now write CGI code using Apache >or Boa under the Cygwin environment. So using DBI, DBD::mysql, >DBD::mysqlPP, IO::Socket, etc, now works as expected... all of which >I have used/tested under Cygwin/Apache/Perl/CGI. > >Lastly, could you please post this as a reply to your original question >on the Cygwin mailing list. I'm not on that list and don't want to >subscribe just to post this. > >Good luck! > >- eric > >-- > Eric Davis > http://www.foobargeek.com > > > >-- >Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple >Problem reports: http://cygwin.com/problems.html >Documentation: http://cygwin.com/docs.html >FAQ: http://cygwin.com/faq/ -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/