# Apache2 and popen

**URL:** <https://www.ruby-forum.com/t/apache2-and-popen/90600>\
**Category:** Rails\
**Created:** [January 5, 2006, 5:44pm UTC](https://www.ruby-forum.com/t/apache2-and-popen/90600 "2006-01-05T17:44:34Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jon\_ASLambert](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/f08c70/32.png) [@Jon\_ASLambert](https://www.ruby-forum.com/u/Jon_ASLambert)\
**Post date:** [January 5, 2006, 5:44pm UTC](https://www.ruby-forum.com/t/apache2-and-popen/90600/1 "2006-01-05T17:44:34Z")

</div>

I’m running Apache2 on windows and I have a controller that issues a  
popen.

class FileController \< ApplicationController  
def index  
f = IO.popen(“dir”)  
@files = f.readlines  
end  
end

This works using webbrick but on Apache produces…

* * *

Errno::ENOENT in File#index

No such file or directory - dir

RAILS\_ROOT: C:/www/teensymud/public/…/config/…  
Application Trace | Framework Trace | Full Trace

#{RAILS\_ROOT}/app/controllers/repository\_controller.rb:3:in `popen' #{RAILS_ROOT}/app/controllers/repository_controller.rb:3:in`index’

* * *

Is this a known Apache problem, misconfiguration problem, or Ruby or  
Rails  
issue?  
I’m running 2.0.54.

Thanks,

Jon L.

---

<div class="post-metadata">

**Author:** ![Jon\_ASLambert](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/f08c70/32.png) [@Jon\_ASLambert](https://www.ruby-forum.com/u/Jon_ASLambert)\
**Post date:** [January 5, 2006, 5:44pm UTC](https://www.ruby-forum.com/t/apache2-and-popen/90600/2 "2006-01-05T17:44:49Z")

</div>

OT: but for this directory listing i suggest you use Dir module

a=Dir[’\*’]

> > [“rubygems-0.8.11.zip”, “ruby182-15.exe”, "ruby-oci8-0.1.13.tar.]

---

<div class="post-metadata">

**Author:** ![Jon\_ASLambert](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/f08c70/32.png) [@Jon\_ASLambert](https://www.ruby-forum.com/u/Jon_ASLambert)\
**Post date:** [January 5, 2006, 5:47pm UTC](https://www.ruby-forum.com/t/apache2-and-popen/90600/3 "2006-01-05T17:47:50Z")

</div>

Mathieu C. wrote:

> OT: but for this directory listing i suggest you use Dir module
> 
> a=Dir[’\*’]

Yes, I’m actually running subversion commands from rscm. I just wanted  
to  
post the smallest and most easily produced code example that eliminated  
other possible problems like ACL and PATH being wrong. That’s why I  
used  
`dir`.

–  
J. Lambert

---

<div class="post-metadata">

**Author:** ![Jon\_ASLambert](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/f08c70/32.png) [@Jon\_ASLambert](https://www.ruby-forum.com/u/Jon_ASLambert)\
**Post date:** [January 5, 2006, 7:57pm UTC](https://www.ruby-forum.com/t/apache2-and-popen/90600/4 "2006-01-05T19:57:31Z")

</div>

> Yes, I’m actually running subversion commands from rscm. I just wanted to  
> post the smallest and most easily produced code example that eliminated  
> other possible problems like ACL and PATH being wrong. That’s why I used  
> `dir`.

Reproducted here (XP, Apache 2.0.55, FastCGI)

Perhaps passing “c:\win\cmd.exe /c dir” ?

Here i’m getting #IO:0x379a0d0

with @f = IO.popen(“c:/windows/system32/cmd.exe /c dir”)

and \<%=debug @f %\>

But I’saw a command windows appearing, not really clean…

---

<div class="post-metadata">

**Author:** ![Jon\_ASLambert](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/f08c70/32.png) [@Jon\_ASLambert](https://www.ruby-forum.com/u/Jon_ASLambert)\
**Post date:** [January 7, 2006, 1:37pm UTC](https://www.ruby-forum.com/t/apache2-and-popen/90600/5 "2006-01-07T13:37:04Z")

</div>

Mathieu C. wrote:

> > Yes, I’m actually running subversion commands from rscm. I just  
> > wanted to post the smallest and most easily produced code example  
> > that eliminated other possible problems like ACL and PATH being  
> > wrong. That’s why I used `dir`.
> 
> Reproducted here (XP, Apache 2.0.55, FastCGI)

Hmm. I am using FastCGI as well. So I switched to CGI and it works.  
Looks like FastCGI and popen aren’t playing well together.

–  
J Lambert
