Cygwin w/ Apache+mysql+php+Perl (win XP)

Andrew DeFaria Andrew@DeFaria.com
Fri Aug 31 06:47:00 GMT 2007


JamesStock wrote:
> Hi I am having issues w/ the following config:
Rule of thumb: Don't use non Cygwin stuff with Cygwin stuff!

Corollary: Well since Cygwin runs under Windows there are many 
interactions and you can use some (a lot) of non Cygwin stuff with Cygwin.

Corollary #1: If you're gonna interface between Cygwin and non Cygwin, 
you'll have to hack, take into account the differences and do lots of 
experimentation. BTW: You'll probably do lots of this...

OK. So,
> I have Apache, mysql, PHP and perl (activestate) installed in my XP 
> (NOT through cygwin but installed individually).
Stop. We know perl (activestate) is not Cygwin I assume Apache, Mysql 
and Php are similarly not Cygwin? Cygwin stuff works best with other 
Cygwin stuff. Piecemealing a bunch of Unix like utilities together from 
different places (perl: activestate, apache: apache.org, mysql: 
mysql.com, etc...) is asking for trouble (and I never understand why 
people insist on doing it! I mean why use PuTTY when Cygwin already 
provides ssh!) Why are you not simply using the Cygwin versions of all 
of these?
> I can use dos prompt and connect to mysql DB (e.g mysql -U???? -P?????),
Windows DOS box, running a Windows oriented mysql...
> I can also use Mysql-Front / SQLyog to connect to mysql (localhost of 
> course).
Whatever that is...
> But if I open an xterm through cygwin, I cannot connect to mysql (e.g 
> mysql -U???? -P?????).
Ah so now you're using a Cygwin program (xterm) and a non-Cygwin program 
(mysql)
> Also the activestate perl (has DBD DBI mysql module installed) can 
> access mysql db (through dos calling a pl script / using cgi through 
> apache).
Non-Cygwin perl (activestate) using a non-Cygwin mysql.
> But I cannot use perl through cygwin to connect to mysql. WHen I tried 
> to do a 'mysql -U???? -P????' through the xterm in cygwin, it'll just 
> 'hang' and keep me waiting and waiting w/out errors..
Have you heard of ptys? They're what Unix uses when using things like 
xterm (BTW, stop the X server and use rxvt. Works like xterm but will 
also work without an X server using Windows widgets instead). Cygwin, 
being Unix-like, also uses them. Windows knowns nothing about them. So 
the Windows oriented mysql gets confused when it attempts to talk to you 
through stdout/stdin because those are connected to ptys, which Windows 
knows nothing about. Bottom line is it is talking to you (displaying the 
mysql banner and prompt) and it will listen to you (accept input). It's 
just that you don't see any of the output because it's sorta lost in the 
pty. Again, mixing Cygwin programs (xterm) with non-Cygwin programs (mysql).
> so I had to do a hard excape.
What's that? Try just typing exit (blindly) and I bet you return to the 
shell prompt.
> also when I tried to execute the same perl script (the same script I 
> used through dos prompt) through the xterm in cygwin, i cannot connect 
> to mysql.
Might be the same thing.
> Not sure if it's the same issue (mysql and perl), but how should I 
> tackle them?
Personally I would remove all of the non Cygwin versions of LAMP that 
you have there and install the Cygwin versions. They are designed to 
work well together.
> I know that the perl and mysql package is different b/w the one 
> installed in windows and the one installed through cygwin. anyways I 
> can have cygwin use the perl and mysql installed in windows? 
Maybe but it may take considerable effort. For example, Windows programs 
typically use "\" as the directory separator whereas Cygwin uses "/". To 
the shell the "\" will need to be doubled. Again, just going all Cygwin 
(or all non-Cygwin if you must) would be much less hassle.
> when I do a 'which perl' it tells me it's using /usr/bin/perl while 
> the perl (activestate) under windows is installed in another dir so 
> it's definitely using a different perl package.
When you type "which perl" *in the cygwin environment* it will be 
evaluated in that light. It's no wonder it would favor the Cygwin 
version. However, if the activestate perl was in say C:\Perl\bin you 
could do:

$ export PATH=/cygdrive/c/perl/bin:$PATH

and "which perl" would yield the activestate one. However I wouldn't 
advise that you do that. (BTW: Write a simple perl script to call 
setsid. Run it under activestate. What does it say?)
> I tried installed DBI:mysql bundle into the perl pkg in cygwin but it 
> failed becoz it cannot find the mysql_config. so I cannot installed 
> that. ANyhelp will be appreciated. thx
I'm not sure of the status of the availability of mysql as a Cygwin 
package. I think that package just lacks an owner. My solution was to 
invest $400 and get a real Linux system instead. However if one were 
available (and I believe it is, somewhere, unofficially) then you could 
just install the Cygwin mysql then install (I suspect) the DBD::mysql 
(DBI is, as it's name implies, DataBase *Independent*). DBD is the 
DataBase Driver, of which there is a MySQL version...
-- 
Andrew DeFaria <http://defaria.com>
Why is it that when you transport something by car, it is called a 
shipment, but when you transport something by ship, it is called cargo?


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



More information about the Cygwin mailing list