Oracle support in PHP?

Ryan Schmidt ryandesign at macports.org
Mon Dec 17 02:09:10 PST 2007


On Dec 16, 2007, at 16:33, John Korchok wrote:

> The Instant Client still requires an environment variable TNS_NAMES  
> to point
> to the sqlnet.ora and tnsnames.ora files. The files allow abbreviated
> connection strings. For some reason, I was not able to set a  
> TNS_NAMES that
> the Instant Client would read (I tried setting it in the current user
> '.profile', in 'opt/local/apache2/bin/envvars' to get the Apache  
> user and
> finally '/private/etc/profile' to make it system-wide. Nothing  
> worked, the
> Instant Client gives every appearance of not reading TNS_NAMES at  
> all. I
> finally gave up and set verbose connection strings:
>
> $con = oci_connect('yourusername', 'yourpassword',
> '(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=serverurloripaddress) 
> (PORT=portnu
> mber))(CONNECT_DATA=(SID=servicename)(SERVER=DEDICATED)))');
>
> It works! Macports PHP Oracle is a reality!

Splendid! :-)

I'm not sure how they intend for you to set the TNS_NAMES environment  
variable. I was not familiar with /opt/local/apache2/bin/envvars but  
that sounded promising. If that is still important to you, have you  
tried using SetEnv within the httpd.conf?

http://httpd.apache.org/docs/2.2/mod/mod_env.html#setenv



More information about the macports-users mailing list