This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Cygwin + Apache + Perl + sockets = Operation not permitted


We have old testing environment based on these:
 Host: WinXP sp2
 Filesystem: FAT32
 Cygwin: 1.5.11
 Apache: 1.3.29
 mySQL: 4.1.8


I tried to upgrade it to-

 Host: WindowsXP sp2
 Filesystem: FAT32

$ uname -srv
 CYGWIN_NT-5.1 1.5.16(0.128/4/2) 2005-04-25 20:26

$ /usr/sbin/httpd -v
 Server version: Apache/1.3.33 (Cygwin)
 Server built:   Mar  5 2005 17:27:42

$ /usr/bin/perl -V:version
 version='5.8.6';

Perl additional packages installed using `cpan`:
 DBI, DBD:mysql, DBD:mysqlPP

mySQL:
 mysql-4.1.11 (compiled from source)




Unfortunately the very same perl-scripts that used to work on the old 
computer, fails now -
The scripts uses DBI to connect to mySQL

 my dsn="...";
 my $dbh= DBI->connect($dsn, 'mysqluser', 'password') ;
 if (! $dbh)
 {
  print "Error: " . DBI->errstr . "\n";
 }

Whatever DSN i tried i got error:
for
 'DBI:mysql:host=localhost;database=dbMyDB'
error:
 Can't create UNIX socket (1)


for
 'DBI:mysql:host=127.0.0.1;database=dbMyDB';
error:
 Can't create TCP/IP socket (1)

for
 'DBI:mysqlPP:host=localhost;database=dbMyDB'
error:
 Couldn't connect to localhost:3306/tcp: IO::Socket::INET: Bad protocol 
'tcp' at /usr/lib/perl5/site_perl/5.8/DBD/mysqlPP.pm line 109


I can successfuly connect to the database using the mysql client from the 
bash prompt, either using UNIX socket or explicit socket (ip+port).



My guess is that something relevant to sockets' creation in the perl DBI 
module fails, so i tried to test my hypothesis-
I wrote a simple perl script that uses native sockets. When i run the 
perl-script from the bash promt it connect with no problem. but when same 
code is under the Apache all these methods fails-
 getprotobyname
 getservbyname
 socket (if i bypass the previous methods' failure using hardcoded values of 
6 for TCP and explicit port).
 (Other method are not relevant if there is no socket)
and the $! says for all of these methods -
 Operation not permitted



I checked the following issues (just to make sure) -
* localhost is defined in /etc/hosts
 127.0.0.1       localhost
* The /etc/group and /etc/passwd files are updates
 mkpasswd --local > /etc/passwd
 mkgroup --local > /etc/group
* The Apache server run as an administrator and i added the following lines 
to the `httpd.conf` file -
 User myusername
 Group Administrators
I don't mind this security risk since this server is used for testing 
purpose only (and is not connected to the internet anyway).
* Microsoft firewall is disabled
 START firewall.cpl
* I tried also running the Apache as a non-deamon process, but problem still 
exists -
 /usr/sbin/httpd -X
* When i retrieve the UID, GID, EUID and EGID from withing the perl-script i 
get the correct ones (my IDs), so apparently the script is not running as 
the default restricted `nobody`.
 my $uid= POSIX::getuid();
 ...



I did some googling and i found many people with same errors, but i could 
not find a solution (yet?)


What else can i try ? Any suggestions?
thanks


C1


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]