# 'require' does not work under mod\_ruby

**URL:** <https://www.ruby-forum.com/t/require-does-not-work-under-mod-ruby/73431>\
**Category:** Ruby\
**Created:** [February 26, 2006, 12:29pm UTC](https://www.ruby-forum.com/t/require-does-not-work-under-mod-ruby/73431 "2006-02-26T12:29:23Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Frantisek\_Fuka](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/e9bcb4/32.png) [@Frantisek\_Fuka](https://www.ruby-forum.com/u/Frantisek_Fuka)\
**Post date:** [February 26, 2006, 12:29pm UTC](https://www.ruby-forum.com/t/require-does-not-work-under-mod-ruby/73431/1 "2006-02-26T12:29:23Z")

</div>

When using: “require ‘engine.rbx’” under mod\_ruby, I get “File does not  
exist” error. However, if I change “require” to “load”, it gets loaded  
allright. the file and it directory has correct permissions (755).  
“Untaint”-ing the file does solve the problem.

I am particularly confused about this error - how can the ruby say the  
file does not exist when it evidentnly does?

---

<div class="post-metadata">

**Author:** ![Frantisek\_Fuka](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/e9bcb4/32.png) [@Frantisek\_Fuka](https://www.ruby-forum.com/u/Frantisek_Fuka)\
**Post date:** [February 26, 2006, 1:14pm UTC](https://www.ruby-forum.com/t/require-does-not-work-under-mod-ruby/73431/2 "2006-02-26T13:14:59Z")

</div>

Frantisek Fuka wrote:

> When using: “require ‘engine.rbx’” under mod\_ruby, I get “File does not  
> exist” error. However, if I change “require” to “load”, it gets loaded  
> allright. the file and it directory has correct permissions (755).  
> “Untaint”-ing the file does solve the problem.
> 
> I am particularly confused about this error - how can the ruby say the  
> file does not exist when it evidentnly does?

chmod +x engine.rbx

Nezabírá?

Kyosuke 😉

---

<div class="post-metadata">

**Author:** ![Frantisek\_Fuka](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/e9bcb4/32.png) [@Frantisek\_Fuka](https://www.ruby-forum.com/u/Frantisek_Fuka)\
**Post date:** [February 26, 2006, 3:49pm UTC](https://www.ruby-forum.com/t/require-does-not-work-under-mod-ruby/73431/3 "2006-02-26T15:49:11Z")

</div>

A mentioned in my original post, the file already has permissions set  
to “755”. Thus, “chmod +x” does nothing.

---

<div class="post-metadata">

**Author:** ![Frantisek\_Fuka](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/e9bcb4/32.png) [@Frantisek\_Fuka](https://www.ruby-forum.com/u/Frantisek_Fuka)\
**Post date:** [February 26, 2006, 4:01pm UTC](https://www.ruby-forum.com/t/require-does-not-work-under-mod-ruby/73431/4 "2006-02-26T16:01:17Z")

</div>

Hi,

“Frantisek Fuka” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) writes:

> When using: “require ‘engine.rbx’” under mod\_ruby, I get “File does not  
> exist” error. However, if I change “require” to “load”, it gets loaded  
> allright. the file and it directory has correct permissions (755).  
> “Untaint”-ing the file does solve the problem.
> 
> I am particularly confused about this error - how can the ruby say the  
> file does not exist when it evidentnly does?

See ri ‘Kernel#require’.

If the file has the extension `.rb'', it is loaded as a source file; if the extension is `.so’‘, `.o'', or `.dll’‘, or whatever the  
default shared library extension is on the current platform, Ruby  
loads the shared library as a Ruby extension.  
Otherwise, Ruby tries adding `.rb'', `.so’', and so on to the name.

---

<div class="post-metadata">

**Author:** ![Frantisek\_Fuka](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/e9bcb4/32.png) [@Frantisek\_Fuka](https://www.ruby-forum.com/u/Frantisek_Fuka)\
**Post date:** [February 26, 2006, 4:22pm UTC](https://www.ruby-forum.com/t/require-does-not-work-under-mod-ruby/73431/5 "2006-02-26T16:22:25Z")

</div>

WATANABE Hirofumi wrote:

> > I am particularly confused about this error - how can the ruby say the

Oops! Right now I tried this, it really behaves this way. I suspected  
initially that this was the case, but in a quick experiment it had  
worked for both “require” and “load”, so I became confused. But now I  
realized I tried it with “.rb” extension rather than “.rbx”. /me stupid.

I didn’t notice the “file” part in the “file _and_ directory have  
correct permissions”, so the permissions problem as a logical  
afterthought and advice didn’t strike this obstacle. 😃

Jakub
