delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/07/30/09:49:21

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
X-Authentication-Warning: slinky.cs.nyu.edu: pechtcha owned process doing -bs
Date: Fri, 30 Jul 2004 09:49:14 -0400 (EDT)
From: Igor Pechtchanski <pechtcha AT cs DOT nyu DOT edu>
Reply-To: cygwin AT cygwin DOT com
To: "David A. Rogers" <darogers AT speakeasy DOT net>
cc: cygwin AT cygwin DOT com
Subject: Re: Socket problem w/ apache & perl cgi
In-Reply-To: <Pine.WNT.4.50.0407300135510.1316-100000@Thor>
Message-ID: <Pine.GSO.4.58.0407300946070.13714@slinky.cs.nyu.edu>
References: <Pine DOT WNT DOT 4 DOT 50 DOT 0407300135510 DOT 1316-100000 AT Thor>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.39

On Fri, 30 Jul 2004, David A. Rogers wrote:

> I have a snippet of perl code that runs fine at the bash prompt but fails
> when run under apache as a cgi app.
>
> =======================================
> #!/usr/bin/perl
>
> use strict;
> use IO::Socket;
>
>
> print "Content-type: text/plain\n\n";
>
> my $socket = IO::Socket::INET->new(PeerAddr => "127.0.0.1",
>                                 PeerPort => 3306,
>                                 PeerProto => "tcp",
>                                 PeerType => SOCK_STREAM);
> my $errno = 0;
> if (!$socket) {
>     $errno += $!;
>     print "Could not connect: $!\n";
>     print "errno = $errno\n";
> } else {
>     print "socket = $socket\n";
> }
> ======================================+
>
>
> Under bash I get this:
>
> =====================
> Content-type: text/plain
>
> socket = IO::Socket::INET=GLOB(0xa1843c4)
> =====================
>
> Under apache/cgi I get this:
> =====================
> Could not connect: Operation not permitted
> errno = 1
> =====================
>
> The standard apache test page comes up fine.
>
> setup is
> - Windows XP
> - cygwin was updated as of yesterday the 29th

...from which mirror?  It does matter.  Short of the "cygcheck -svr"
output, the output of "uname -a" is the best way to show your Cygwin
version.

> - httpd.conf has not been modified
> - passwd and group were generated by the appropriate tools and have not been modified
> - Both perl and apache were downloaded and not built from source.
> - I did install the dbi and dbd_mysql modules from cpan.
>
> apache                  1.3.29-2
> perl                    5.8.2-1
>
> I can send a full cygcheck.out if warrented.
>
> Any help appreciated.
> dar

At a guess, you're getting this because Apache runs as a service (i.e.,
the user, "nobody" by default, may not have enough rights).
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha AT cs DOT nyu DOT edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor AT watson DOT ibm DOT com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"Happiness lies in being privileged to work hard for long hours in doing
whatever you think is worth doing."  -- Dr. Jubal Harshaw

--
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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019