[mod_python] environment variables not visible?

Damjan gdamjan at mail.net.mk
Sat Mar 29 03:55:34 EST 2003


>   SetEnv SYBASE /server/sybase/ASE_12501_2
>   SetEnv LD_LIBRARY_PATH
> /server/sybase/ASE_12501_2/OCS-12_5/lib:/usr/local/lib
>   SetEnv SYBASE_OCS /server/sybase/ASE_12501_2/OCS-12_5
>   SetEnv SYBASE_ASE /server/sybase/ASE_12501_2/ASE-12_5
> 
> Note the SetEnv directives are used in addition to setting the environment
> with os.environ, but neither of these approaches work.  I am not familiar
> enough with the internals of mod_python, but it seems perhaps
> run_spyceModpy::spyceMain is the mon_python handler and perhaps it is
> somehow forgetting the environment variables.  Does this seem like a likely
> possibility to you?

I had a similar problem with Apache, PHP and ORACLE. I tried the SetEnv
approach too...

The catch is that SetEnv just sets some Apache-specific internal
environment - that has nothing to do with the UNIX/OS environment.

I've also tried to solve the problem by putting putenv("ORACLE_HOME=...") 
in the PHP code. And with that sometimes it worked and sometimes it
didn't. 

Last I've found that I must set the environment prior to starting the 
apache process. I've ended up with:

    env - ORACLE_HOME=/usr/share/oracle \
           /usr/sbin/apachectl start

in my "/etc/rc.d/rc.httpd" script, and a note to everyone never to call 
"apachectl" directly but to always call "/etc/rc.d/rc.httpd".

In the end the conclusion is that these proprietary products SUCK, it so
much simpler with MySQL or PostgreSQL.



-- 
Damjan Georgievski



More information about the Mod_python mailing list