Re: [PHP-DB] Php, Oracle on Mac, with strange behaviour
[email protected] (Grant Croker)
| Newsgroups | php.db |
|---|---|
| Organization | Ingres Corp |
| Message-ID | <[email protected]> |
On/El 16/03/09 09:23, chris smith wrote/escribió: > On Mon, Mar 16, 2009 at 6:51 PM, Mark Halling-Brown > <[email protected]> wrote: > >> Thanks for your replies. >> In my desperation, I declared those environment variables in as many places >> as I could think of. The script (Although I know I shouldnt), php.ini and >> also the apache httpd.conf file: >> >> SetEnv ORACLE_HOME /opt/oracle/instanceclient >> SetEnv DYLD_LIBRARY_PATH /opt/oracle/instanceclient >> SetEnv LD_LIBRARY_PATH /opt/oracle/instanceclient >> SetEnv ORACLE_BASE /opt/oracle/instanceclient >> >> But given that it works on the command line, but not through the browser, I >> think that the environment variables must be set correctly. >> > > Did you restart apache after doing this? > > The env variables are set correctly for your user, but not apache's > (which is the problem). > > > Does the mac have an /etc/environment file? That should cover all users. Unfortunately not although with the stock/supplied Apache web server there is a plist file you can edit to add environment settings. Edit |/System/Library/LaunchDaemons/org.apache.httpd.plist, adding the relevant environment variable key/value information:| <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>EnvironmentVariables</key> <dict> <key>DYLD_LIBRARY_PATH</key> <string>path goes here</string> <key>ORACLE_HOME</key> <string>path goes here</string> <key>ORACLE_BASE</key> <string>path goes here</string> </dict> <key>Label</key> <string>org.apache.httpd</string> . . . </dict> </plist> Then you use PassEnv in Apache to pass these values through to PHP. The SetEnv directive in Apache is not the same as "setenv" or "export" in csh/bash/etc. Apache maintains its own symbol table for environment variables. Unless the OCI8 extension calls apache_getenv those declarations will have no effect. regards grant -- Grant Croker - Ingres PHP and Ruby maintainer http://blogs.planetingres.org/grant Generally, old media don't die. They just have to grow old gracefully. Guess what, we still have stone masons. They haven't been the primary purveyors of the written word for a while now of course, but they still have a role because you wouldn't want a TV screen on your headstone.