# Auto-Require some .rb files for specific .cgi page

**URL:** <https://www.ruby-forum.com/t/auto-require-some-rb-files-for-specific-cgi-page/170546>\
**Category:** Ruby\
**Created:** [June 18, 2009, 7:09pm UTC](https://www.ruby-forum.com/t/auto-require-some-rb-files-for-specific-cgi-page/170546 "2009-06-18T19:09:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![quik77](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/q/dec6dc/32.png) [@quik77](https://www.ruby-forum.com/u/quik77)\
**Post date:** [June 18, 2009, 7:09pm UTC](https://www.ruby-forum.com/t/auto-require-some-rb-files-for-specific-cgi-page/170546/1 "2009-06-18T19:09:35Z")

</div>

I am using Linux + Apache + ruby 1.8.7 (2009-06-08 patchlevel 173)

I use quite many .cgi pages which are nothing more than .rb files  
which output a html string.

I found that every of this .cgi page requires my “web.rb” file.

Is it somehow possible to auto-load this file _without_ doing  
require ‘web.rb’? It is tedious to require that web.rb for every  
ruby .cgi page. I wonder if what I would like to have is  
somehow possible at all.

---

<div class="post-metadata">

**Author:** ![quik77](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/q/dec6dc/32.png) [@quik77](https://www.ruby-forum.com/u/quik77)\
**Post date:** [June 18, 2009, 9:04pm UTC](https://www.ruby-forum.com/t/auto-require-some-rb-files-for-specific-cgi-page/170546/2 "2009-06-18T21:04:45Z")

</div>

Marc H. wrote:

> somehow possible at all.  
> You can add ‘-r somefile.rb’ to ruby command string, so the whole  
> command will become ‘ruby -r web.rb script.rb’, for example. Try  
> modifying shebang line/apache options/etc. for this.
