# Ruby + apache. need to export path=/opt/ruby/bin every time before starting apache

**URL:** <https://www.ruby-forum.com/t/ruby-apache-need-to-export-path-opt-ruby-bin-every-time-before-starting-apache/180774>\
**Category:** Ruby\
**Created:** [December 28, 2009, 10:20pm UTC](https://www.ruby-forum.com/t/ruby-apache-need-to-export-path-opt-ruby-bin-every-time-before-starting-apache/180774 "2009-12-28T22:20:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![adad](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/9e8a1a/32.png) [@adad](https://www.ruby-forum.com/u/adad)\
**Post date:** [December 28, 2009, 10:20pm UTC](https://www.ruby-forum.com/t/ruby-apache-need-to-export-path-opt-ruby-bin-every-time-before-starting-apache/180774/1 "2009-12-28T22:20:42Z")

</div>

Hi,  
I have installed apache 1.3 and ruby 1.8. I am running some ruby files  
through the browser.

Before I start apache I always have to do:  
export PATH=/opt/ruby/bin:$PATH

If I dont export the ruby path (I have installed ruby under /opt/ruby)  
and start apache, then I get an internal server error every time I  
access the file.

If I export the path manually and then restart apache I am able to  
access the ruby file just fine.

Is there a way to set up this variable through apache?

thanks.

---

<div class="post-metadata">

**Author:** ![adad](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/9e8a1a/32.png) [@adad](https://www.ruby-forum.com/u/adad)\
**Post date:** [December 28, 2009, 11:19pm UTC](https://www.ruby-forum.com/t/ruby-apache-need-to-export-path-opt-ruby-bin-every-time-before-starting-apache/180774/2 "2009-12-28T23:19:50Z")

</div>

On Dec 28, 2009, at 13:20 , ad wrote:

> Is there a way to set up this variable through apache?

[http://httpd.apache.org/docs/2.2/mod/mod\_env.html#setenv](http://httpd.apache.org/docs/2.2/mod/mod_env.html#setenv)

---

<div class="post-metadata">

**Author:** ![adad](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/9e8a1a/32.png) [@adad](https://www.ruby-forum.com/u/adad)\
**Post date:** [December 29, 2009, 2:35am UTC](https://www.ruby-forum.com/t/ruby-apache-need-to-export-path-opt-ruby-bin-every-time-before-starting-apache/180774/3 "2009-12-29T02:35:54Z")

</div>

On Dec 28, 5:19 pm, Ryan D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> On Dec 28, 2009, at 13:20 , ad wrote:
> 
> > Is there a way to set up this variable through apache?
> 
> [mod\_env - Apache HTTP Server Version 2.2](http://httpd.apache.org/docs/2.2/mod/mod_env.html#setenv)

Looks like there is a bug in mod\_env which doesnt take the modified  
path.  
[https://issues.apache.org/bugzilla/show\_bug.cgi?id=43906](https://issues.apache.org/bugzilla/show_bug.cgi?id=43906)

I eventually modified apachectl script and added the path in the  
configuration section.  
PATH=$PATH:/opt/ruby/bin ;  
export PATH

---

<div class="post-metadata">

**Author:** ![adad](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/9e8a1a/32.png) [@adad](https://www.ruby-forum.com/u/adad)\
**Post date:** [December 29, 2009, 7:40am UTC](https://www.ruby-forum.com/t/ruby-apache-need-to-export-path-opt-ruby-bin-every-time-before-starting-apache/180774/4 "2009-12-29T07:40:51Z")

</div>

On Dec 28, 2009, at 17:35 , ad wrote:

> [43906 – SetEnv does not allow PATH override](https://issues.apache.org/bugzilla/show_bug.cgi?id=43906)
> 
> I eventually modified apachectl script and added the path in the  
> configuration section.  
> PATH=$PATH:/opt/ruby/bin ;  
> export PATH

you could modify /etc/profile instead.
