public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Setting up Apache2 with mod_perl and Apache2::AuthCookieLDAP
@ 2014-05-06 20:24 Andrew DeFaria
  0 siblings, 0 replies; 17+ messages in thread
From: Andrew DeFaria @ 2014-05-06 20:24 UTC (permalink / raw)
  To: cygwin

Forgive me if this is double posted. I posted yesterday after a long 
hiatus of posting anything to the Cygwin Mailing list and it didn't seem 
to show up so I'm trying again. If anybody sees this then a quick email 
to adefaria@audience.com saying you saw it would clear that up.

I've been working mainly on Linux boxes and haven't had to dig in to 
Cygwin deeply for a while. But I have a question or two again. I could 
just switch to a Linux server but I figured I'd try my Windows laptop first.

Goal: Set up Apache2 on my Windows laptop with mod_perl working as well 
as Apache2::AuthCookieLDAP and write an example login page that 
authenticates to Active Directory using AuthCookieLDAP.

First problem (minor): I can't figure out how to install Apache2 as a 
Windows service. For now I can just do apachectl2 start but would like 
to configure it as a real service. I've tried:

Adefaria-lt:cygrunsrv -I httpd2 -d 'CYGWIN Apache2' -p 
/usr/sbin/httpd2.exe -a '-DNO_DETACH'
Adefaria-lt:net start httpd2
The CYGWIN Apache2 service is starting.
The CYGWIN Apache2 service could not be started.

The service did not report an error.

More help is available by typing NET HELPMSG 3534.

Adefaria-lt:

Second problem: Perl CGI scripts do not execute but just display even 
though AddHandler is configured in Apache:

Adefaria-lt:grep -i 'addhandler cgi-script' /etc/apache2/httpd.conf
     AddHandler cgi-script .cgi .pl
Adefaria-lt:cat ~/web/test.pl
#!/usr/bin/perl

print "Content-type: text/html\n\n";
print <<HTML;
<html>
<head>
<title>A Simple Perl CGI</title>
</head>
<body>
<h1>A Simple Perl CGI</h1>
<p>Hello World</p>
</body>
HTML
exit;
Adefaria-lt:

When I go to test.pl it just gets printed as the web page. Note that PHP 
is working and if I go to phpinfo.php it works just fine...

Third problem: mod_perl2 doesn't seem to want to install:

Running install for module 'mod_perl2'
Running make for P/PH/PHRED/mod_perl-2.0.8.tar.gz
Checksum for 
/home/adefaria/.cpan/sources/authors/id/P/PH/PHRED/mod_perl-2.0.8.tar.gz ok
Catching error: "Couldn't move 
/cygdrive/a/.cpan/build/tmp-156520/mod_perl-2.0.8/src to 
/home/adefaria/.cpan/build/mod_perl-2.0.8-zKWTRp/src: Is a directory at 
/usr/lib/perl5/5.14/CPAN/Distribution.pm line 
528.\cJ\cICPAN::Distribution::run_preps_on_packagedir(CPAN::Distribution=HASH(0x60aa40ad8)) 
called at /usr/lib/perl5/5.14/CPAN/Distribution.pm line 
355\cJ\cICPAN::Distribution::get(CPAN::Distribution=HASH(0x60aa40ad8)) 
called at /usr/lib/perl5/5.14/CPAN/Distribution.pm line 
1760\cJ\cICPAN::Distribution::make(CPAN::Distribution=HASH(0x60aa40ad8)) 
called at /usr/lib/perl5/5.14/CPAN/Distribution.pm line 
3088\cJ\cICPAN::Distribution::test(CPAN::Distribution=HASH(0x60aa40ad8)) 
called at /usr/lib/perl5/5.14/CPAN/Distribution.pm line 
3480\cJ\cICPAN::Distribution::install(CPAN::Distribution=HASH(0x60aa40ad8)) 
called at /usr/lib/perl5/5.14/CPAN/Module.pm line 479\cJ\cIeval {...} 
called at /usr/lib/perl5/5.14/CPAN/Module.pm line 
478\cJ\cICPAN::Module::rematein(CPAN::Module=HASH(0x607f96780), 
\"install\") called at /usr/lib/perl5/5.14/CPAN/Module.pm line 
578\cJ\cICPAN::Module::install(CPAN::Module=HASH(0x607f96780)) called at 
/usr/lib/perl5/5.14/CPAN/Shell.pm line 
1797\cJ\cICPAN::Shell::rematein(\"CPAN::Shell\", \"install\", 
\"Apache2::AuthCookie\") called at /usr/lib/perl5/5.14/CPAN/Shell.pm 
line 1977\cJ\cICPAN::Shell::__ANON__(\"CPAN::Shell\", 
\"Apache2::AuthCookie\") called at /usr/lib/perl5/5.14/CPAN.pm line 
376\cJ\cIeval {...} called at /usr/lib/perl5/5.14/CPAN.pm line 
373\cJ\cICPAN::shell() called at /usr/lib/perl5/5.14/App/Cpan.pm line 
338\cJ\cIApp::Cpan::_process_options(\"App::Cpan\") called at 
/usr/lib/perl5/5.14/App/Cpan.pm line 
421\cJ\cIApp::Cpan::run(\"App::Cpan\") called at /bin/cpan line 12\cJ" 
at /usr/lib/perl5/5.14/CPAN.pm line 392.
         CPAN::shell() called at /usr/lib/perl5/5.14/App/Cpan.pm line 338
         App::Cpan::_process_options("App::Cpan") called at 
/usr/lib/perl5/5.14/App/Cpan.pm line 421
         App::Cpan::run("App::Cpan") called at /bin/cpan line 12


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Setting up Apache2 with mod_perl and Apache2::AuthCookieLDAP
  2014-05-10 12:50     ` Andrey Repin
@ 2014-05-10 15:50       ` Andrey Repin
  0 siblings, 0 replies; 17+ messages in thread
From: Andrey Repin @ 2014-05-10 15:50 UTC (permalink / raw)
  To: All

Greetings, All!

Sorry me.
Wasn't intended to be sent to the mailing list...


--
WBR,
Andrey Repin (anrdaemon@yandex.ru) 10.05.2014, <19:42>

Sorry for my terrible english...


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Setting up Apache2 with mod_perl and Apache2::AuthCookieLDAP
  2014-05-08  2:39   ` Andrew DeFaria
@ 2014-05-10 12:50     ` Andrey Repin
  2014-05-10 15:50       ` Andrey Repin
  0 siblings, 1 reply; 17+ messages in thread
From: Andrey Repin @ 2014-05-10 12:50 UTC (permalink / raw)
  To: Andrew DeFaria, cygwin

Greetings, Andrew DeFaria!

>> I still think you're begging for trouble by building new software on top
>> of mod_perl in 2014, though. :)

> I'm tempted to say: "I'm a consultant and trouble rarely follows me" ;-) 
> however I am also a professional. Still I do what my client asks me to 
> do. The client didn't even ask me to use mod_perl! In fact they don't 
> use it but wanted to start (that's how far behind they are(?)).

> I don't even understand why I need mod_perl at all... I just want to 
> authenticate via LDAP to the Active Directory domain server. I set up 
> the basic authentication using LDAP/Active Directory authentication but 
> the boss is saying he'd like it make it more convenient for the 
> engineers and use cookies so they don't have to log in every time they 
> restart their browser. I looked up about authentication and cookies and 
> that led me to Apache2::AuthCookieLDAP, which is pulling in the whole 
> mod_perl thing...

Native Apache + mod_sspi (transparent authentication for browsers supporting
NTLM web auth).
Don't know, in which state of things it is ATM, but that's what I was using
back in the days of Windows server.

> ... You're in a twisty maze of dependencies, all different...

If you clearly state, what you actually want to do, the answer usually float
to the top.


--
WBR,
Andrey Repin (anrdaemon@yandex.ru) 10.05.2014, <16:35>

Sorry for my terrible english...


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Setting up Apache2 with mod_perl and Apache2::AuthCookieLDAP
  2014-05-06 17:42 Andrew DeFaria
  2014-05-06 19:33 ` Warren Young
  2014-05-08  0:12 ` Warren Young
@ 2014-05-08  5:08 ` Yaakov (Cygwin/X)
  2 siblings, 0 replies; 17+ messages in thread
From: Yaakov (Cygwin/X) @ 2014-05-08  5:08 UTC (permalink / raw)
  To: cygwin

On 2014-05-06 12:42, Andrew DeFaria wrote:
> Goal: Set up Apache2 on my Windows laptop with mod_perl working as well
> as Apache2::AuthCookieLDAP and write an example login page that
> authenticates to Active Directory using AuthCookieLDAP.
>
> First problem (minor): I can't figure out how to install Apache2 as a
> Windows service.

Run /usr/sbin/httpd2-config from an Administrator prompt.

> Third problem: mod_perl2 doesn't seem to want to install:

An (untested) apache2-mod_perl is available in Ports.


Yaakov


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Setting up Apache2 with mod_perl and Apache2::AuthCookieLDAP
  2014-05-08  0:12 ` Warren Young
@ 2014-05-08  2:39   ` Andrew DeFaria
  2014-05-10 12:50     ` Andrey Repin
  0 siblings, 1 reply; 17+ messages in thread
From: Andrew DeFaria @ 2014-05-08  2:39 UTC (permalink / raw)
  To: cygwin

On 5/7/2014 5:12 PM, Warren Young wrote:
> On 5/6/2014 11:42, Andrew DeFaria wrote:
>>
>> Adefaria-lt:cygrunsrv -I httpd2 -d 'CYGWIN Apache2' -p
>
> This may be your problem.
>
> While poking around in /usr/sbin, I found httpd2-config, which is 167
> lines long, so it must be doing something fairly clever.
>
> I tried it, and Cygwin Apache is running as a service on my box now.

Actually it's not that clever but it does install the service. My 
problem was slightly different. See 
https://sourceware.org/ml/cygwin/2014-05/msg00142.html

> I still think you're begging for trouble by building new software on top
> of mod_perl in 2014, though. :)

I'm tempted to say: "I'm a consultant and trouble rarely follows me" ;-) 
however I am also a professional. Still I do what my client asks me to 
do. The client didn't even ask me to use mod_perl! In fact they don't 
use it but wanted to start (that's how far behind they are(?)).

I don't even understand why I need mod_perl at all... I just want to 
authenticate via LDAP to the Active Directory domain server. I set up 
the basic authentication using LDAP/Active Directory authentication but 
the boss is saying he'd like it make it more convenient for the 
engineers and use cookies so they don't have to log in every time they 
restart their browser. I looked up about authentication and cookies and 
that led me to Apache2::AuthCookieLDAP, which is pulling in the whole 
mod_perl thing...

... You're in a twisty maze of dependencies, all different...
-- 
Andrew DeFaria
http://defaria.com


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Setting up Apache2 with mod_perl and Apache2::AuthCookieLDAP
  2014-05-06 17:42 Andrew DeFaria
  2014-05-06 19:33 ` Warren Young
@ 2014-05-08  0:12 ` Warren Young
  2014-05-08  2:39   ` Andrew DeFaria
  2014-05-08  5:08 ` Yaakov (Cygwin/X)
  2 siblings, 1 reply; 17+ messages in thread
From: Warren Young @ 2014-05-08  0:12 UTC (permalink / raw)
  To: Cygwin-L

On 5/6/2014 11:42, Andrew DeFaria wrote:
>
> Adefaria-lt:cygrunsrv -I httpd2 -d 'CYGWIN Apache2' -p

This may be your problem.

While poking around in /usr/sbin, I found httpd2-config, which is 167 
lines long, so it must be doing something fairly clever.

I tried it, and Cygwin Apache is running as a service on my box now.

I still think you're begging for trouble by building new software on top 
of mod_perl in 2014, though. :)

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Setting up Apache2 with mod_perl and Apache2::AuthCookieLDAP
  2014-05-07 19:13   ` Andrew DeFaria
@ 2014-05-07 20:03     ` Andrew DeFaria
  0 siblings, 0 replies; 17+ messages in thread
From: Andrew DeFaria @ 2014-05-07 20:03 UTC (permalink / raw)
  To: cygwin

First off, David Habermann, you really should respond to the list 
instead of emailing me directly so that others can benefit. Dave wrote:

 >If you are using a Cygwin based Apache then it will follow symlinks=20
 >whereas my experience with the Windows based Apache it doesn't.

Although not a popular opinion, I agree with you.  Cygwin based Apache works
and has a number of desirable properties.

 >
 >> However I had set up Apache2 as a Windows service before so I know it's
 >> doable. I just forget how to do it! ;-) I thought it was just to specify
 >> -k or perhaps -DNO_DETACH or something like that...

I just went through the configs and it (httpd2-config) asked if I wanted to=
  create a service,
I said yes and was all set.=20=20
/bin/cygserver-config (cygserver is apparently required)
/usr/sbin/httpd2-config

Hope this helped.
------

Yes it did! It's been a long time and in the meantime somebody made 
/usr/sbin/httpd2-config which sets up the service nicely.

On 5/7/2014 12:13 PM, Andrew DeFaria wrote:
> On 5/7/2014 6:23 AM, Andrey Repin wrote:
>>> Goal: Set up Apache2 on my Windows laptop with mod_perl working as well
>>> as Apache2::AuthCookieLDAP and write an example login page that
>>> authenticates to Active Directory using AuthCookieLDAP.
>>
>> Little bit OT: Is this necessary to set up Cygwin Apache/Perl?
>
> I view my development environment as "Linux". When I don't have bona
> fide Linux at my fingertips and they shove a Windows box under my
> keyboard I rely on Cygwin to provide a "Linux-like" environment. True
> it's not strictly "necessary" to set up a Cygwin Apache/Perl but it is
> what I'm best familiar and comfortable with.
>
>>> First problem (minor): I can't figure out how to install Apache2 as a
>>> Windows service. For now I can just do apachectl2 start but would like
>>> to configure it as a real service. I've tried:
>>
>>> Adefaria-lt:cygrunsrv -I httpd2 -d 'CYGWIN Apache2' -p
>>> /usr/sbin/httpd2.exe -a '-DNO_DETACH'
>>> Adefaria-lt:net start httpd2
>>> The CYGWIN Apache2 service is starting.
>>> The CYGWIN Apache2 service could not be started.
>>
>>> The service did not report an error.
>>
>> What's in Apache logs?
>
> Nothing!

Let me restate. The problem is there are too many log files! There's 
/var/log/apache2/[error|access]_log (which shows nothing) and 
/var/log/apache2.log (which also shows nothing) but then there's 
/var/log/httpd2.log which shows:

Syntax error on line 172 of /etc/apache2/httpd.conf:
DocumentRoot must be a directory

My DocumentRoot was "/cygdrive/a/web" because I mound my home directory 
from a NetApp (I believe) to my (unused) A drive. I assure you that 
"web" is a directory in my home directory. I've also tried the following 
but all failed:

DocumentRoot "a:/web"
DocumentRoot "//<server>/<share>/adefaria/web"
DocumentRoot "/home/adefaria/web" # where /home/adefaria is a symlink A:

Then I created a local /web directory and moved stuff there and 
restarted. Now in the error_log I see:

[Wed May 07 12:49:48 2014] [error] (28)No space left on device: Cannot 
create SSLMutex Configuration Failed

My disks are not full. The only reference I see to this is 
http://www.cygwin.com/ml/cygwin/2010-01/msg01017.html which doesn't 
point to an eventual answer. Other googling talks only about Linux 
systems and how to remove semaphores but none of the semaphores are 
owned by the Apache user. Used ipcrm -s <semid> to remove all of them. 
Now Apache starts!
-- 
Andrew DeFaria
http://defaria.com


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Setting up Apache2 with mod_perl and Apache2::AuthCookieLDAP
  2014-05-07 13:35     ` Andrey Repin
@ 2014-05-07 19:19       ` Andrew DeFaria
  0 siblings, 0 replies; 17+ messages in thread
From: Andrew DeFaria @ 2014-05-07 19:19 UTC (permalink / raw)
  To: cygwin

On 5/7/2014 6:33 AM, Andrey Repin wrote:
> Greetings, Andrew DeFaria!

Hey guys! I missed you! :-)

>> Personally I prefer Cygwin Apache because all of the pathing then can be
>> POSIX-like and can easily port to Linux systems later on. Plus Cygwin's
>> Perl is, IMHO, far superior to ActiveState.
>
> Then use Cygwin Perl! And it is THAT part of your setup that needs to be aware
> of Cygwin's POSIX'y paths. Apache can be just told where to find Perl, and
> that's all.

That's what I'm doing...

>> However I had set up Apache2 as a Windows service before so I know it's
>> doable. I just forget how to do it! ;-) I thought it was just to specify
>> -k or perhaps -DNO_DETACH or something like that...
>
> httpd --help
> ?
> (I honestly don't remember myself, it is long since I moved all my server
> stuff to Linux, and forgot about it.)

Same here! http2 --help does exactly nothing AFAICT!
-- 
Andrew DeFaria
http://defaria.com


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Setting up Apache2 with mod_perl and Apache2::AuthCookieLDAP
  2014-05-07 13:35 ` Andrey Repin
@ 2014-05-07 19:13   ` Andrew DeFaria
  2014-05-07 20:03     ` Andrew DeFaria
  0 siblings, 1 reply; 17+ messages in thread
From: Andrew DeFaria @ 2014-05-07 19:13 UTC (permalink / raw)
  To: cygwin

On 5/7/2014 6:23 AM, Andrey Repin wrote:
>> Goal: Set up Apache2 on my Windows laptop with mod_perl working as well
>> as Apache2::AuthCookieLDAP and write an example login page that
>> authenticates to Active Directory using AuthCookieLDAP.
>
> Little bit OT: Is this necessary to set up Cygwin Apache/Perl?

I view my development environment as "Linux". When I don't have bona 
fide Linux at my fingertips and they shove a Windows box under my 
keyboard I rely on Cygwin to provide a "Linux-like" environment. True 
it's not strictly "necessary" to set up a Cygwin Apache/Perl but it is 
what I'm best familiar and comfortable with.

>> First problem (minor): I can't figure out how to install Apache2 as a
>> Windows service. For now I can just do apachectl2 start but would like
>> to configure it as a real service. I've tried:
>
>> Adefaria-lt:cygrunsrv -I httpd2 -d 'CYGWIN Apache2' -p
>> /usr/sbin/httpd2.exe -a '-DNO_DETACH'
>> Adefaria-lt:net start httpd2
>> The CYGWIN Apache2 service is starting.
>> The CYGWIN Apache2 service could not be started.
>
>> The service did not report an error.
>
> What's in Apache logs?

Nothing!

> I suspect Apache was running at the time.

I just checked. Shut down Apache. Cleared the logfiles. Did net start 
httpd2. Errored out. Checked the logs - they're empty.

>> Adefaria-lt:grep -i 'addhandler cgi-script' /etc/apache2/httpd.conf
>>       AddHandler cgi-script .cgi .pl
>> Adefaria-lt:cat ~/web/test.pl
>> #!/usr/bin/perl
>
> It is long (like, 10-15 years long) since recommended to use filters instead
> of handlers.
> I.e.
> AddOutputFilter Perl .pl
> AddInputFilter Perl .pl

I've always just used the handler.

>> print "Content-type: text/html\n\n";
>
> print "Content-type: text/html\r\n\r\n";
>
> Read http://tools.ietf.org/html/rfc2616#section-4 pretty please.

Normally I use CGI and call start_html. This script I just grabbed off 
the net as a simple test. Note that LF works just find and CRLF does not 
seem to be required.
-- 
Andrew DeFaria
http://defaria.com


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Setting up Apache2 with mod_perl and Apache2::AuthCookieLDAP
  2014-05-06 21:12   ` Andrew DeFaria
  2014-05-06 21:51     ` Warren Young
@ 2014-05-07 13:35     ` Andrey Repin
  2014-05-07 19:19       ` Andrew DeFaria
  1 sibling, 1 reply; 17+ messages in thread
From: Andrey Repin @ 2014-05-07 13:35 UTC (permalink / raw)
  To: Andrew DeFaria, cygwin

Greetings, Andrew DeFaria!

>> If you do go with Dancer or something like it, you don't need to use
>> Cygwin Apache.  The native Windows version of Apache will perform much
>> better, and when used as a reverse proxy, you probably won't need any of
>> the benefits you get from using Cygwin Apache which native Apache
>> wouldn't have, such as the ability to compile and load some of the more
>> esoteric modules that only build on POSIXy systems.
>>
>>> First problem (minor): I can't figure out how to install Apache2 as a
>>> Windows service.
>>
>> Another reason to native Windows Apache instead.

> Personally I prefer Cygwin Apache because all of the pathing then can be 
> POSIX-like and can easily port to Linux systems later on. Plus Cygwin's 
> Perl is, IMHO, far superior to ActiveState.

Then use Cygwin Perl! And it is THAT part of your setup that needs to be aware
of Cygwin's POSIX'y paths. Apache can be just told where to find Perl, and
that's all.

> However I had set up Apache2 as a Windows service before so I know it's 
> doable. I just forget how to do it! ;-) I thought it was just to specify 
> -k or perhaps -DNO_DETACH or something like that...

httpd --help
?
(I honestly don't remember myself, it is long since I moved all my server
stuff to Linux, and forgot about it.)


--
WBR,
Andrey Repin (anrdaemon@yandex.ru) 07.05.2014, <17:30>

Sorry for my terrible english...


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Setting up Apache2 with mod_perl and Apache2::AuthCookieLDAP
  2014-05-06 19:41 Andrew DeFaria
@ 2014-05-07 13:35 ` Andrey Repin
  2014-05-07 19:13   ` Andrew DeFaria
  0 siblings, 1 reply; 17+ messages in thread
From: Andrey Repin @ 2014-05-07 13:35 UTC (permalink / raw)
  To: Andrew DeFaria, cygwin

Greetings, Andrew DeFaria!

> I've been working mainly on Linux boxes and haven't had to dig in to 
> Cygwin deeply for a while. But I have a question or two again. I could 
> just switch to a Linux server but I figured I'd try my Windows laptop first.

> Goal: Set up Apache2 on my Windows laptop with mod_perl working as well 
> as Apache2::AuthCookieLDAP and write an example login page that 
> authenticates to Active Directory using AuthCookieLDAP.

Little bit OT: Is this necessary to set up Cygwin Apache/Perl?

> First problem (minor): I can't figure out how to install Apache2 as a 
> Windows service. For now I can just do apachectl2 start but would like 
> to configure it as a real service. I've tried:

> Adefaria-lt:cygrunsrv -I httpd2 -d 'CYGWIN Apache2' -p 
> /usr/sbin/httpd2.exe -a '-DNO_DETACH'
> Adefaria-lt:net start httpd2
> The CYGWIN Apache2 service is starting.
> The CYGWIN Apache2 service could not be started.

> The service did not report an error.

What's in Apache logs?
I suspect Apache was running at the time.

> More help is available by typing NET HELPMSG 3534.

> Adefaria-lt:

> Second problem: Perl CGI scripts do not execute but just display even 
> though AddHandler is configured in Apache:

> Adefaria-lt:grep -i 'addhandler cgi-script' /etc/apache2/httpd.conf
>      AddHandler cgi-script .cgi .pl
> Adefaria-lt:cat ~/web/test.pl
> #!/usr/bin/perl

It is long (like, 10-15 years long) since recommended to use filters instead
of handlers.
I.e.
AddOutputFilter Perl .pl
AddInputFilter Perl .pl


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

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

Read http://tools.ietf.org/html/rfc2616#section-4 pretty please.

> print <<HTML;
> <html>
> <head>
> <title>A Simple Perl CGI</title>
> </head>
> <body>
> <h1>A Simple Perl CGI</h1>
> <p>Hello World</p>
> </body>
> HTML
> exit;
> Adefaria-lt:

> When I go to test.pl it just gets printed as the web page. Note that PHP 
> is working and if I go to phpinfo.php it works just fine...

> Third problem: mod_perl2 doesn't seem to want to install:

> Running install for module 'mod_perl2'
> Running make for P/PH/PHRED/mod_perl-2.0.8.tar.gz
> Checksum for 
> /home/adefaria/.cpan/sources/authors/id/P/PH/PHRED/mod_perl-2.0.8.tar.gz ok
> Catching error: "Couldn't move 
> /cygdrive/a/.cpan/build/tmp-156520/mod_perl-2.0.8/src to 
> /home/adefaria/.cpan/build/mod_perl-2.0.8-zKWTRp/src: Is a directory at 
> /usr/lib/perl5/5.14/CPAN/Distribution.pm line 
> 528.\cJ\cICPAN::Distribution::run_preps_on_packagedir(CPAN::Distribution=HASH(0x60aa40ad8)) 
> called at /usr/lib/perl5/5.14/CPAN/Distribution.pm line 
> 355\cJ\cICPAN::Distribution::get(CPAN::Distribution=HASH(0x60aa40ad8)) 
> called at /usr/lib/perl5/5.14/CPAN/Distribution.pm line 
> 1760\cJ\cICPAN::Distribution::make(CPAN::Distribution=HASH(0x60aa40ad8)) 
> called at /usr/lib/perl5/5.14/CPAN/Distribution.pm line 
> 3088\cJ\cICPAN::Distribution::test(CPAN::Distribution=HASH(0x60aa40ad8)) 
> called at /usr/lib/perl5/5.14/CPAN/Distribution.pm line 
> 3480\cJ\cICPAN::Distribution::install(CPAN::Distribution=HASH(0x60aa40ad8)) 
> called at /usr/lib/perl5/5.14/CPAN/Module.pm line 479\cJ\cIeval {...} 
> called at /usr/lib/perl5/5.14/CPAN/Module.pm line 
> 478\cJ\cICPAN::Module::rematein(CPAN::Module=HASH(0x607f96780), 
> \"install\") called at /usr/lib/perl5/5.14/CPAN/Module.pm line 
> 578\cJ\cICPAN::Module::install(CPAN::Module=HASH(0x607f96780)) called at 
> /usr/lib/perl5/5.14/CPAN/Shell.pm line 
> 1797\cJ\cICPAN::Shell::rematein(\"CPAN::Shell\", \"install\", 
> \"Apache2::AuthCookie\") called at /usr/lib/perl5/5.14/CPAN/Shell.pm 
> line 1977\cJ\cICPAN::Shell::__ANON__(\"CPAN::Shell\", 
> \"Apache2::AuthCookie\") called at /usr/lib/perl5/5.14/CPAN.pm line 
> 376\cJ\cIeval {...} called at /usr/lib/perl5/5.14/CPAN.pm line 
> 373\cJ\cICPAN::shell() called at /usr/lib/perl5/5.14/App/Cpan.pm line 
> 338\cJ\cIApp::Cpan::_process_options(\"App::Cpan\") called at 
> /usr/lib/perl5/5.14/App/Cpan.pm line 
> 421\cJ\cIApp::Cpan::run(\"App::Cpan\") called at /bin/cpan line 12\cJ" 
> at /usr/lib/perl5/5.14/CPAN.pm line 392.
>          CPAN::shell() called at /usr/lib/perl5/5.14/App/Cpan.pm line 338
>          App::Cpan::_process_options("App::Cpan") called at 
> /usr/lib/perl5/5.14/App/Cpan.pm line 421
>          App::Cpan::run("App::Cpan") called at /bin/cpan line 12



--
WBR,
Andrey Repin (anrdaemon@yandex.ru) 07.05.2014, <17:15>

Sorry for my terrible english...


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Setting up Apache2 with mod_perl and Apache2::AuthCookieLDAP
  2014-05-06 21:51     ` Warren Young
@ 2014-05-07  2:31       ` Andrew DeFaria
  0 siblings, 0 replies; 17+ messages in thread
From: Andrew DeFaria @ 2014-05-07  2:31 UTC (permalink / raw)
  To: cygwin

On 5/6/2014 2:51 PM, Warren Young wrote:
> On 5/6/2014 15:10, Andrew DeFaria wrote:
>>
>> Yeah thanks for all of that but really my real goal was just to get
>> Apache2::AuthCookieLDAP working.
>
> Plack::Middleware::Auth::Basic supports LDAP auth: http://goo.gl/O7RHgp
>
>> Personally I prefer Cygwin Apache because all of the pathing then can be
>> POSIX-like and can easily port to Linux systems later on. Plus Cygwin's
>> Perl is, IMHO, far superior to ActiveState.
>
> The two issues are actually separate.  There's nothing making you use
> ActiveState Perl to run a PSGI app front-ended by native Windows Apache.
>   PSGI apps behind a reverse proxy simply present an HTTP interface to
> the proxy.  As far as the proxy server knows, the app providing that
> interface could be built in F#.

If you are using a Cygwin based Apache then it will follow symlinks 
whereas my experience with the Windows based Apache it doesn't.

>
> (Why F#?  Another new favorite tool, and about as different from Perl as
> you can get. :) )
>
>> However I had set up Apache2 as a Windows service before so I know it's
>> doable. I just forget how to do it! ;-) I thought it was just to specify
>> -k or perhaps -DNO_DETACH or something like that...
>
> Did you try -F?
>
>      http://comments.gmane.org/gmane.os.cygwin/60331

That message was about Apache 1.3. I'm on Apache 2.2. There is no -F option:

Adefaria-lt:/usr/sbin/httpd2 -F
httpd2: illegal option -- F
Usage: /usr/sbin/httpd2 [-D name] [-d directory] [-f file]
                         [-C "directive"] [-c "directive"]
                         [-k start|restart|graceful|graceful-stop|stop]
                         [-v] [-V] [-h] [-l] [-L] [-t] [-T] [-S]
Options:
   -D name            : define a name for use in <IfDefine name> directives
   -d directory       : specify an alternate initial ServerRoot
   -f file            : specify an alternate ServerConfigFile
   -C "directive"     : process directive before reading config files
   -c "directive"     : process directive after reading config files
   -e level           : show startup errors of level (see LogLevel)
   -E file            : log startup errors to file
   -v                 : show version number
   -V                 : show compile settings
   -h                 : list available command line options (this page)
   -l                 : list compiled in modules
   -L                 : list available configuration directives
   -t -D DUMP_VHOSTS  : show parsed settings (currently only vhost settings)
   -S                 : a synonym for -t -D DUMP_VHOSTS
   -t -D DUMP_MODULES : show all loaded modules
   -M                 : a synonym for -t -D DUMP_MODULES
   -t                 : run syntax check for config files
   -T                 : start without DocumentRoot(s) check
Adefaria-lt:


-- 
<style type="text/css">
body {
   font:			Helvetica, Arial, sans-serif;
}
p {
   font:			Helvetica, Arial, sans-serif;
}
.standout {
   font-family:		verdana,
			arial,
			sans-serif;
   font-size:		12px;
   color:		#993333;
   line-height:		13px;
   font-weight:		bold;
   margin-bottom:	10px;
}
.code {
   border-top:		1px solid #ddd;
   border-left:		1px solid #ddd;
   border-right:		2px solid #000;
   border-bottom:	2px solid #000;
   padding:		10px;
   margin-top:		5px;
   margin-left:		5%;
   margin-right:		5%;
   background:		#ffffea;
   color:		black;
   font-family:		courier;
   white-space:		pre;
   -moz-border-radius:	10px;
}
.terminal {
   border-top:		10px solid #03f;
   border-left:		1px solid #ddd;
   border-right:		2px solid grey;
   border-bottom:	2px solid grey;
   padding:		10px;
   margin-top:		5px;
   margin-left:		5%;
   margin-right:		5%;
   background:		black;
   color:		white;
   font-family:		courier;
   white-space:		pre;
   -moz-border-radius:	10px;
}
a:link {
   color:		blue;
}

a:visited {
   color:		darkblue;
}

a:hover {
   color:		black;
   background-color:	#ffffcc;
   text-decoration:	underline;
}

a:active {
   color: 		red;
}
</style>
<img src="http://defaria.com/Images/clearscm.com-qrcode.jpg" 
align="left" height="100" width="100"/><br>
<a href="http://defaria.com">Andrew DeFaria</a><br>
<a href="http://clearscm.com">ClearSCM, Inc.</a><br>


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Setting up Apache2 with mod_perl and Apache2::AuthCookieLDAP
  2014-05-06 21:12   ` Andrew DeFaria
@ 2014-05-06 21:51     ` Warren Young
  2014-05-07  2:31       ` Andrew DeFaria
  2014-05-07 13:35     ` Andrey Repin
  1 sibling, 1 reply; 17+ messages in thread
From: Warren Young @ 2014-05-06 21:51 UTC (permalink / raw)
  To: Cygwin-L

On 5/6/2014 15:10, Andrew DeFaria wrote:
>
> Yeah thanks for all of that but really my real goal was just to get
> Apache2::AuthCookieLDAP working.

Plack::Middleware::Auth::Basic supports LDAP auth: http://goo.gl/O7RHgp

> Personally I prefer Cygwin Apache because all of the pathing then can be
> POSIX-like and can easily port to Linux systems later on. Plus Cygwin's
> Perl is, IMHO, far superior to ActiveState.

The two issues are actually separate.  There's nothing making you use 
ActiveState Perl to run a PSGI app front-ended by native Windows Apache. 
  PSGI apps behind a reverse proxy simply present an HTTP interface to 
the proxy.  As far as the proxy server knows, the app providing that 
interface could be built in F#.

(Why F#?  Another new favorite tool, and about as different from Perl as 
you can get. :) )

> However I had set up Apache2 as a Windows service before so I know it's
> doable. I just forget how to do it! ;-) I thought it was just to specify
> -k or perhaps -DNO_DETACH or something like that...

Did you try -F?

	http://comments.gmane.org/gmane.os.cygwin/60331


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Setting up Apache2 with mod_perl and Apache2::AuthCookieLDAP
  2014-05-06 19:33 ` Warren Young
@ 2014-05-06 21:12   ` Andrew DeFaria
  2014-05-06 21:51     ` Warren Young
  2014-05-07 13:35     ` Andrey Repin
  0 siblings, 2 replies; 17+ messages in thread
From: Andrew DeFaria @ 2014-05-06 21:12 UTC (permalink / raw)
  To: cygwin

On 5/6/2014 12:33 PM, Warren Young wrote:
> On 5/6/2014 11:42, Andrew DeFaria wrote:
>> I could just switch to a Linux server but I figured I'd try my
>> Windows laptop first.
>
> Don't neglect the option of running a minimal Linux VM on the laptop.
> You can shove a headless Linux VMs into a pretty small slice of RAM.

Well I do happen to have a Linux VM but usually I'm just given a Windows 
laptop by my clients and must press on. Sure I could download and 
install vmware and get a Linux VM setup but that's a lot of work to do 
to set up a machine I'm basically only using for one thing. Sure setting 
up Cygwin takes work/care/feeding but I can then use that Cygwin 
installation all the time to connect to and develop stuff.

>> Goal: Set up Apache2 on my Windows laptop with mod_perl
>
> mod_perl has been slowly dying for years.  It's not dead yet (*thwack*)
> but it pretty much only works with Apache 2.2 and older.  RHEL7 won't
> include it at all, because it will ship with Apache 2.4.6.  There are
> third-party patches floating around the net that restore compatibility,
> but this isn't the sort of thing you want to be building programs
> against that have to live for many years to come.

...

Yeah thanks for all of that but really my real goal was just to get 
Apache2::AuthCookieLDAP working. That seems to require mod_perl. Of 
course if mod_perl is dying then that brings in the question of "Is it 
worth it to develop a login page to authenticate with Active Directory 
and store cookies to ease logins if this all might be going away?".

... <interesting info deleted but I will read up on it later - thanks! ...

> If you do go with Dancer or something like it, you don't need to use
> Cygwin Apache.  The native Windows version of Apache will perform much
> better, and when used as a reverse proxy, you probably won't need any of
> the benefits you get from using Cygwin Apache which native Apache
> wouldn't have, such as the ability to compile and load some of the more
> esoteric modules that only build on POSIXy systems.
>
>> First problem (minor): I can't figure out how to install Apache2 as a
>> Windows service.
>
> Another reason to native Windows Apache instead.

Personally I prefer Cygwin Apache because all of the pathing then can be 
POSIX-like and can easily port to Linux systems later on. Plus Cygwin's 
Perl is, IMHO, far superior to ActiveState.

However I had set up Apache2 as a Windows service before so I know it's 
doable. I just forget how to do it! ;-) I thought it was just to specify 
-k or perhaps -DNO_DETACH or something like that...


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Setting up Apache2 with mod_perl and Apache2::AuthCookieLDAP
@ 2014-05-06 19:41 Andrew DeFaria
  2014-05-07 13:35 ` Andrey Repin
  0 siblings, 1 reply; 17+ messages in thread
From: Andrew DeFaria @ 2014-05-06 19:41 UTC (permalink / raw)
  To: cygwin

I've been working mainly on Linux boxes and haven't had to dig in to 
Cygwin deeply for a while. But I have a question or two again. I could 
just switch to a Linux server but I figured I'd try my Windows laptop first.

Goal: Set up Apache2 on my Windows laptop with mod_perl working as well 
as Apache2::AuthCookieLDAP and write an example login page that 
authenticates to Active Directory using AuthCookieLDAP.

First problem (minor): I can't figure out how to install Apache2 as a 
Windows service. For now I can just do apachectl2 start but would like 
to configure it as a real service. I've tried:

Adefaria-lt:cygrunsrv -I httpd2 -d 'CYGWIN Apache2' -p 
/usr/sbin/httpd2.exe -a '-DNO_DETACH'
Adefaria-lt:net start httpd2
The CYGWIN Apache2 service is starting.
The CYGWIN Apache2 service could not be started.

The service did not report an error.

More help is available by typing NET HELPMSG 3534.

Adefaria-lt:

Second problem: Perl CGI scripts do not execute but just display even 
though AddHandler is configured in Apache:

Adefaria-lt:grep -i 'addhandler cgi-script' /etc/apache2/httpd.conf
     AddHandler cgi-script .cgi .pl
Adefaria-lt:cat ~/web/test.pl
#!/usr/bin/perl

print "Content-type: text/html\n\n";
print <<HTML;
<html>
<head>
<title>A Simple Perl CGI</title>
</head>
<body>
<h1>A Simple Perl CGI</h1>
<p>Hello World</p>
</body>
HTML
exit;
Adefaria-lt:

When I go to test.pl it just gets printed as the web page. Note that PHP 
is working and if I go to phpinfo.php it works just fine...

Third problem: mod_perl2 doesn't seem to want to install:

Running install for module 'mod_perl2'
Running make for P/PH/PHRED/mod_perl-2.0.8.tar.gz
Checksum for 
/home/adefaria/.cpan/sources/authors/id/P/PH/PHRED/mod_perl-2.0.8.tar.gz ok
Catching error: "Couldn't move 
/cygdrive/a/.cpan/build/tmp-156520/mod_perl-2.0.8/src to 
/home/adefaria/.cpan/build/mod_perl-2.0.8-zKWTRp/src: Is a directory at 
/usr/lib/perl5/5.14/CPAN/Distribution.pm line 
528.\cJ\cICPAN::Distribution::run_preps_on_packagedir(CPAN::Distribution=HASH(0x60aa40ad8)) 
called at /usr/lib/perl5/5.14/CPAN/Distribution.pm line 
355\cJ\cICPAN::Distribution::get(CPAN::Distribution=HASH(0x60aa40ad8)) 
called at /usr/lib/perl5/5.14/CPAN/Distribution.pm line 
1760\cJ\cICPAN::Distribution::make(CPAN::Distribution=HASH(0x60aa40ad8)) 
called at /usr/lib/perl5/5.14/CPAN/Distribution.pm line 
3088\cJ\cICPAN::Distribution::test(CPAN::Distribution=HASH(0x60aa40ad8)) 
called at /usr/lib/perl5/5.14/CPAN/Distribution.pm line 
3480\cJ\cICPAN::Distribution::install(CPAN::Distribution=HASH(0x60aa40ad8)) 
called at /usr/lib/perl5/5.14/CPAN/Module.pm line 479\cJ\cIeval {...} 
called at /usr/lib/perl5/5.14/CPAN/Module.pm line 
478\cJ\cICPAN::Module::rematein(CPAN::Module=HASH(0x607f96780), 
\"install\") called at /usr/lib/perl5/5.14/CPAN/Module.pm line 
578\cJ\cICPAN::Module::install(CPAN::Module=HASH(0x607f96780)) called at 
/usr/lib/perl5/5.14/CPAN/Shell.pm line 
1797\cJ\cICPAN::Shell::rematein(\"CPAN::Shell\", \"install\", 
\"Apache2::AuthCookie\") called at /usr/lib/perl5/5.14/CPAN/Shell.pm 
line 1977\cJ\cICPAN::Shell::__ANON__(\"CPAN::Shell\", 
\"Apache2::AuthCookie\") called at /usr/lib/perl5/5.14/CPAN.pm line 
376\cJ\cIeval {...} called at /usr/lib/perl5/5.14/CPAN.pm line 
373\cJ\cICPAN::shell() called at /usr/lib/perl5/5.14/App/Cpan.pm line 
338\cJ\cIApp::Cpan::_process_options(\"App::Cpan\") called at 
/usr/lib/perl5/5.14/App/Cpan.pm line 
421\cJ\cIApp::Cpan::run(\"App::Cpan\") called at /bin/cpan line 12\cJ" 
at /usr/lib/perl5/5.14/CPAN.pm line 392.
         CPAN::shell() called at /usr/lib/perl5/5.14/App/Cpan.pm line 338
         App::Cpan::_process_options("App::Cpan") called at 
/usr/lib/perl5/5.14/App/Cpan.pm line 421
         App::Cpan::run("App::Cpan") called at /bin/cpan line 12

-- 
Andrew DeFaria


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Setting up Apache2 with mod_perl and Apache2::AuthCookieLDAP
  2014-05-06 17:42 Andrew DeFaria
@ 2014-05-06 19:33 ` Warren Young
  2014-05-06 21:12   ` Andrew DeFaria
  2014-05-08  0:12 ` Warren Young
  2014-05-08  5:08 ` Yaakov (Cygwin/X)
  2 siblings, 1 reply; 17+ messages in thread
From: Warren Young @ 2014-05-06 19:33 UTC (permalink / raw)
  To: Cygwin-L

On 5/6/2014 11:42, Andrew DeFaria wrote:
> I could just switch to a Linux server but I figured I'd try my
> Windows laptop first.

Don't neglect the option of running a minimal Linux VM on the laptop. 
You can shove a headless Linux VMs into a pretty small slice of RAM.

> Goal: Set up Apache2 on my Windows laptop with mod_perl

mod_perl has been slowly dying for years.  It's not dead yet (*thwack*) 
but it pretty much only works with Apache 2.2 and older.  RHEL7 won't 
include it at all, because it will ship with Apache 2.4.6.  There are 
third-party patches floating around the net that restore compatibility, 
but this isn't the sort of thing you want to be building programs 
against that have to live for many years to come.

Cygwin still ships Apache 2.2, but you'd be betting that either Cygwin 
Apache will never be updated to 2.4, or that mod_perl will get dragged 
into the modern world before that happens.

mod_perl is being allowed to die because all the modern web frameworks 
have moved to PSGI/Plack instead: http://plackperl.org/

PSGI abstracts away the operating environment.  You can run PSGI apps 
standalone as their own web server, or behind a fast reverse proxy, or 
in a FastCGI environment (e.g. Apache's mod_fcgid).  From the software 
development perspective, it's all the same.  (Devops is a different 
story, of course.)

A common pattern is to run the PSGI app with an internal web server on 
localhost:3000 or whatever, then put nginx or similar in front of it to 
carry the static content load and proxy dynamic page requests to the web 
app.

Since the native Windows nginx port doesn't yet run as a Windows 
service, it isn't suited for systems that need long uptimes, or which 
can't be left logged in to an interactive desktop.  The native Windows 
version of Apache is only a smidge slower than nginx for many workloads, 
it ships with mod_proxy to make it act as a reverse proxy, and it 
naturally runs as a Windows service: http://goo.gl/woQjYZ

It is common to use HTTP::Server::PSGI (http://goo.gl/o7wmIm) for 
development, and only switch to something more complicated when it comes 
time to deploy to production.  If your web app won't have a high load, 
you may not have to switch at all.  Or, if most of the load is static 
content, you can push that load off onto the reverse proxy. 
Single-threaded dynamic page generation is fine for many web apps.

If you really need concurrent dymamic page generation, a lot of people 
use Starman (http://goo.gl/J97Ac1) rather than a traditional web server. 
  It is a pure Perl pre-forking web server, compatible with PSGI, and 
fast enough that a lot of its users don't use a reverse proxy in front 
of it at all.

If you go Perl-native, your web app can run as a single-instance 
program, which can have tremendous benefits.  A lot of old web 
frameworks persist session data to disk purely because it assumes it 
will run under pre-forking Apache, where there are many short-lived 
children that may contend for access to the session store.  When all I/O 
comes into a single long-lived process, you might not have to persist 
some things to disk at all, greatly reducing that area of I/O overhead. 
  Single-instance web apps also don't have to pay other penalties 
associated with periodically killing off an restarting child forks.

You don't have to use PSGI/Plack directly.  All of the modern Perl web 
frameworks -- Catalyst, Mojolicious, Mason/Poet -- will run under it, 
providing a much nicer usage environment.  I've been using Dancer 
(http://perldancer.org/) for months now, and love it.  I just tested, 
and it does build and run under Cygwin.  Install App::cpanminus with 
cpan, then just say "cpanm Dancer".  Done, easy.

(I chose Dancer because it doesn't impose MVC or ORM policies like a lot 
of other web frameworks do.  (Catalyst, Rails, Zope, etc.)  You're free 
to design your web app however it makes sense to you.)

If you do go with Dancer or something like it, you don't need to use 
Cygwin Apache.  The native Windows version of Apache will perform much 
better, and when used as a reverse proxy, you probably won't need any of 
the benefits you get from using Cygwin Apache which native Apache 
wouldn't have, such as the ability to compile and load some of the more 
esoteric modules that only build on POSIXy systems.

> First problem (minor): I can't figure out how to install Apache2 as a
> Windows service.

Another reason to native Windows Apache instead.

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Setting up Apache2 with mod_perl and Apache2::AuthCookieLDAP
@ 2014-05-06 17:42 Andrew DeFaria
  2014-05-06 19:33 ` Warren Young
                   ` (2 more replies)
  0 siblings, 3 replies; 17+ messages in thread
From: Andrew DeFaria @ 2014-05-06 17:42 UTC (permalink / raw)
  To: cygwin

I've been working mainly on Linux boxes and haven't had to dig in to 
Cygwin deeply for a while. But I have a question or two again. I could 
just switch to a Linux server but I figured I'd try my Windows laptop 
first.

Goal: Set up Apache2 on my Windows laptop with mod_perl working as well 
as Apache2::AuthCookieLDAP and write an example login page that 
authenticates to Active Directory using AuthCookieLDAP.

First problem (minor): I can't figure out how to install Apache2 as a 
Windows service. For now I can just do apachectl2 start but would like 
to configure it as a real service. I've tried:

Adefaria-lt:cygrunsrv -I httpd2 -d 'CYGWIN Apache2' -p 
/usr/sbin/httpd2.exe -a '-DNO_DETACH'
Adefaria-lt:net start httpd2
The CYGWIN Apache2 service is starting.
The CYGWIN Apache2 service could not be started.

The service did not report an error.

More help is available by typing NET HELPMSG 3534.

Adefaria-lt:

Second problem: Perl CGI scripts do not execute but just display even 
though AddHandler is configured in Apache:

Adefaria-lt:grep -i 'addhandler cgi-script' /etc/apache2/httpd.conf
     AddHandler cgi-script .cgi .pl
Adefaria-lt:cat ~/web/test.pl
#!/usr/bin/perl

print "Content-type: text/html\n\n";
print <<HTML;
<html>
<head>
<title>A Simple Perl CGI</title>
</head>
<body>
<h1>A Simple Perl CGI</h1>
<p>Hello World</p>
</body>
HTML
exit;
Adefaria-lt:

When I go to test.pl it just gets printed as the web page. Note that PHP 
is working and if I go to phpinfo.php it works just fine...

Third problem: mod_perl2 doesn't seem to want to install:

Running install for module 'mod_perl2'
Running make for P/PH/PHRED/mod_perl-2.0.8.tar.gz
Checksum for 
/home/adefaria/.cpan/sources/authors/id/P/PH/PHRED/mod_perl-2.0.8.tar.gz ok
Catching error: "Couldn't move 
/cygdrive/a/.cpan/build/tmp-156520/mod_perl-2.0.8/src to 
/home/adefaria/.cpan/build/mod_perl-2.0.8-zKWTRp/src: Is a directory at 
/usr/lib/perl5/5.14/CPAN/Distribution.pm line 
528.\cJ\cICPAN::Distribution::run_preps_on_packagedir(CPAN::Distribution=HASH(0x60aa40ad8)) 
called at /usr/lib/perl5/5.14/CPAN/Distribution.pm line 
355\cJ\cICPAN::Distribution::get(CPAN::Distribution=HASH(0x60aa40ad8)) 
called at /usr/lib/perl5/5.14/CPAN/Distribution.pm line 
1760\cJ\cICPAN::Distribution::make(CPAN::Distribution=HASH(0x60aa40ad8)) 
called at /usr/lib/perl5/5.14/CPAN/Distribution.pm line 
3088\cJ\cICPAN::Distribution::test(CPAN::Distribution=HASH(0x60aa40ad8)) 
called at /usr/lib/perl5/5.14/CPAN/Distribution.pm line 
3480\cJ\cICPAN::Distribution::install(CPAN::Distribution=HASH(0x60aa40ad8)) 
called at /usr/lib/perl5/5.14/CPAN/Module.pm line 479\cJ\cIeval {...} 
called at /usr/lib/perl5/5.14/CPAN/Module.pm line 
478\cJ\cICPAN::Module::rematein(CPAN::Module=HASH(0x607f96780), 
\"install\") called at /usr/lib/perl5/5.14/CPAN/Module.pm line 
578\cJ\cICPAN::Module::install(CPAN::Module=HASH(0x607f96780)) called at 
/usr/lib/perl5/5.14/CPAN/Shell.pm line 
1797\cJ\cICPAN::Shell::rematein(\"CPAN::Shell\", \"install\", 
\"Apache2::AuthCookie\") called at /usr/lib/perl5/5.14/CPAN/Shell.pm 
line 1977\cJ\cICPAN::Shell::__ANON__(\"CPAN::Shell\", 
\"Apache2::AuthCookie\") called at /usr/lib/perl5/5.14/CPAN.pm line 
376\cJ\cIeval {...} called at /usr/lib/perl5/5.14/CPAN.pm line 
373\cJ\cICPAN::shell() called at /usr/lib/perl5/5.14/App/Cpan.pm line 
338\cJ\cIApp::Cpan::_process_options(\"App::Cpan\") called at 
/usr/lib/perl5/5.14/App/Cpan.pm line 
421\cJ\cIApp::Cpan::run(\"App::Cpan\") called at /bin/cpan line 12\cJ" 
at /usr/lib/perl5/5.14/CPAN.pm line 392.
         CPAN::shell() called at /usr/lib/perl5/5.14/App/Cpan.pm line 338
         App::Cpan::_process_options("App::Cpan") called at 
/usr/lib/perl5/5.14/App/Cpan.pm line 421
         App::Cpan::run("App::Cpan") called at /bin/cpan line 12

-- 
Andrew DeFaria
--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2014-05-10 15:50 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-06 20:24 Setting up Apache2 with mod_perl and Apache2::AuthCookieLDAP Andrew DeFaria
  -- strict thread matches above, loose matches on Subject: below --
2014-05-06 19:41 Andrew DeFaria
2014-05-07 13:35 ` Andrey Repin
2014-05-07 19:13   ` Andrew DeFaria
2014-05-07 20:03     ` Andrew DeFaria
2014-05-06 17:42 Andrew DeFaria
2014-05-06 19:33 ` Warren Young
2014-05-06 21:12   ` Andrew DeFaria
2014-05-06 21:51     ` Warren Young
2014-05-07  2:31       ` Andrew DeFaria
2014-05-07 13:35     ` Andrey Repin
2014-05-07 19:19       ` Andrew DeFaria
2014-05-08  0:12 ` Warren Young
2014-05-08  2:39   ` Andrew DeFaria
2014-05-10 12:50     ` Andrey Repin
2014-05-10 15:50       ` Andrey Repin
2014-05-08  5:08 ` Yaakov (Cygwin/X)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).