# Need help with mod\_ruby under Win32

**URL:** <https://rubytalk.org/t/need-help-with-mod-ruby-under-win32/12067>\
**Category:** ruby-talk\
**Created:** [12 June 2004 16:08 UTC](https://rubytalk.org/t/need-help-with-mod-ruby-under-win32/12067 "2004-06-12T16:08:19Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Iouri\_Kloubakov](https://avatars.discourse-cdn.com/v4/letter/i/ea666f/32.png) [@Iouri\_Kloubakov](https://rubytalk.org/u/Iouri_Kloubakov)\
**Post date:** [12 June 2004 16:08 UTC](https://rubytalk.org/t/need-help-with-mod-ruby-under-win32/12067/1 "2004-06-12T16:08:19Z")

</div>

Hi,

I know there are not many people on this mailing list who use my  
configuration but hope that someone can help solve my problem.

Windows XP SP1  
Apache 2.0.49  
mod\_ruby 1.1.1  
&nbsp;&nbsp;&nbsp;(from [http://www.moriq.com/ruby/win32-apache2-ruby1.8.1-mod\_ruby/](http://www.moriq.com/ruby/win32-apache2-ruby1.8.1-mod_ruby/))

I've copied "lib/apache" folder from mod\_ruby-1.1.3 source distribution  
to "c:\ruby\lib\ruby\site\_ruby\1.8" and updated httpd.conf with:

\<IfModule mod\_ruby.c\>  
&nbsp;&nbsp;RubyRequire apache/ruby-run  
&nbsp;&nbsp;\<Files \*.rbx\>  
&nbsp;&nbsp;&nbsp;&nbsp;SetHandler ruby-object  
&nbsp;&nbsp;&nbsp;&nbsp;RubyHandler Apache::RubyRun.instance  
&nbsp;&nbsp;\</Files\>  
\</IfModule\>

Now, when I'm trying to open "[http://localhost/test.rbx](http://localhost/test.rbx)" I am getting  
the following error:

"access to C:/Program Files/Apache Group/Apache2/htdocs/test.rbx failed  
for (null), reason: file permissions deny server execution"

If I rename the file to "test.r" the browser shows it.

> **···**
>
> --  
> Thanks,  
> Yura.

---

<div class="post-metadata">

**Author:** ![Kaspar\_Schiess](https://avatars.discourse-cdn.com/v4/letter/k/d78d45/32.png) [@Kaspar\_Schiess](https://rubytalk.org/u/Kaspar_Schiess)\
**Post date:** [12 June 2004 16:41 UTC](https://rubytalk.org/t/need-help-with-mod-ruby-under-win32/12067/2 "2004-06-12T16:41:02Z")

</div>

in site\_ruby/apache/ruby-run.rb and ruby-debug.rb:

~ #~ unless r.finfo.executable?  
&nbsp;&nbsp;#~ r.log\_reason("file permissions deny server execution", r.filename)  
&nbsp;&nbsp;#~ return FORBIDDEN  
~ #~ end

Commented out because not needed on my Windows XP SP1 machine, so you  
are not alone.

I had other troubles with that setup, so I kind of gave up. Basic  
mod\_ruby runs fine though.

kaspar

semantics & semiotics  
code manufacture

[www.tua.ch/ruby](http://www.tua.ch/ruby)

---

<div class="post-metadata">

**Author:** ![Iouri\_Kloubakov](https://avatars.discourse-cdn.com/v4/letter/i/ea666f/32.png) [@Iouri\_Kloubakov](https://rubytalk.org/u/Iouri_Kloubakov)\
**Post date:** [12 June 2004 20:18 UTC](https://rubytalk.org/t/need-help-with-mod-ruby-under-win32/12067/3 "2004-06-12T20:18:08Z")

</div>

> From: news [mailto:news@sea.gmane.org]On Behalf Of Kaspar Schiess  
> Sent: June 12, 2004 12:41
> 
> in site\_ruby/apache/ruby-run.rb and ruby-debug.rb:
> 
> ~ #~ unless r.finfo.executable?  
> &nbsp;&nbsp;#~ r.log\_reason("file permissions deny server execution",  
> r.filename)  
> &nbsp;&nbsp;#~ return FORBIDDEN  
> ~ #~ end
> 
> Commented out because not needed on my Windows XP SP1 machine, so you  
> are not alone.

Thanks, Kaspar. I am not getting this error any more.

> I had other troubles with that setup, so I kind of gave up. Basic  
> mod\_ruby runs fine though.

I'd like to get basic mod\_ruby working before I give up too.  
Right now Apache "freezes" (so that I have to restart it) on  
the following simple "test.rbx" script:

print "HTTP/1.1 200 OK\r\n"  
print "Content-Type: text/plain\r\n\r\n"  
print "hello world"

> **···**
>
> > -----Original Message-----
> 
> --  
> Yura.

---

<div class="post-metadata">

**Author:** ![Iouri\_Kloubakov](https://avatars.discourse-cdn.com/v4/letter/i/ea666f/32.png) [@Iouri\_Kloubakov](https://rubytalk.org/u/Iouri_Kloubakov)\
**Post date:** [12 June 2004 21:52 UTC](https://rubytalk.org/t/need-help-with-mod-ruby-under-win32/12067/4 "2004-06-12T21:52:05Z")

</div>

After some debugging done, I found that Apache crashes on the  
call to "setup\_cgi\_env" in "ruby-run.rb". I guess, it's some  
incompatibility between mod\_rudy.so/1.1.1 for Windows and Apache 2.0.49.

Yura.

> **···**
>
> > -----Original Message-----  
> > From: Iouri Kloubakov [mailto:ykloubakov@ftxs.fujitsu.com]  
> > Sent: June 12, 2004 16:16  
> > \> -----Original Message-----  
> > \> From: news [mailto:news@sea.gmane.org]On Behalf Of Kaspar Schiess  
> > \> Sent: June 12, 2004 12:41  
> > \> I had other troubles with that setup, so I kind of gave up. Basic  
> > \> mod\_ruby runs fine though.
> > 
> > I'd like to get basic mod\_ruby working before I give up too.  
> > Right now Apache "freezes" (so that I have to restart it) on  
> > the following simple "test.rbx" script:
> > 
> > print "HTTP/1.1 200 OK\r\n"  
> > print "Content-Type: text/plain\r\n\r\n"  
> > print "hello world"

---

<div class="post-metadata">

**Author:** ![Iouri\_Kloubakov](https://avatars.discourse-cdn.com/v4/letter/i/ea666f/32.png) [@Iouri\_Kloubakov](https://rubytalk.org/u/Iouri_Kloubakov)\
**Post date:** [13 June 2004 01:45 UTC](https://rubytalk.org/t/need-help-with-mod-ruby-under-win32/12067/5 "2004-06-13T01:45:32Z")

</div>

I found the problem but I am not good with patches.

File: mod\_ruby.c  
Function: mod\_ruby\_clearenv()  
Fix: replace call to putenv(buf) with call to ruby\_unsetenv(buf)

> **···**
>
> > -----Original Message-----  
> > From: Iouri Kloubakov [mailto:ykloubakov@ftxs.fujitsu.com]  
> > Sent: June 12, 2004 17:50
> > 
> > After some debugging done, I found that Apache crashes on the  
> > call to "setup\_cgi\_env" in "ruby-run.rb". I guess, it's some  
> > incompatibility between mod\_rudy.so/1.1.1 for Windows and Apache 2.0.49.
> 
> --  
> Yura.
