Thread: php5.2.5 not working with apache2.2.8 on solaris 9


Permlink Replies: 30 - Pages: 3 [ Previous | 1 2 3 | Next ] - Last Post: May 12, 2008 8:52 PM Last Post By: cj2 Threads: [ Previous | Next ]
samiahmad

Posts: 34
Registered: 10/04/01
Re: php5.2.5 not working with apache2.2.8 on solaris 9
Posted: Apr 30, 2008 11:55 AM   in response to: Ivan Kartik in response to: Ivan Kartik
Click to report abuse...   Click to reply to this thread Reply
Iam curious for your findings .. iam surprised though no one else answered as solaris 64 is a very common platform and I am sure tons of people must be using php on solaris64 .
I have downloaded 32 bit oracle client and will try to install it when I go home.
I am sure by then you would be done with your installation and we would have the answer :)

thanks again for your time
samiahmad

Posts: 34
Registered: 10/04/01
Re: php5.2.5 not working with apache2.2.8 on solaris 9
Posted: Apr 30, 2008 9:37 PM   in response to: samiahmad in response to: samiahmad
Click to report abuse...   Click to reply to this thread Reply
hi Ivan!

its working now after I compiled it with the 32 bit oracle instant client. I had to tweek a little bit to make the OCI8 extensions work as follows :

cd /opt/staging_php
cp ext/oci8/.libs/oci8.so /usr/local/apache/modules/oci8.so
chmod +x /usr/local/apache/modules/oci8.so
cp ext/oci8/.libs/oci8.lai /usr/local/apache/modules/oci8.la
chmod 755 /usr/local/apache/modules/oci8.so
samiahmad

Posts: 34
Registered: 10/04/01
Re: php5.2.5 not working with apache2.2.8 on solaris 9
Posted: Apr 30, 2008 10:41 PM   in response to: samiahmad in response to: samiahmad
Click to report abuse...   Click to reply to this thread Reply
Iam getting there slowly , oci8 extenstions are loaded but I think iam missing some env settings as I cant connect to a valid tns entry via this script

<?php
// Set Oracle Environment
PutEnv("ORACLE_HOME=/u03/oracle/10203");
PutEnv("TNS_ADMIN=/u03/oracle/10203/network/admin");
PutEnv("LD_LIBRARY_PATH=/instantclient_10_2:/u03/oracle/10203/lib");
$conn = oci_connect('SAMI', 'SAMI', 'emrep');
?>

Warning: oci_connect() [function.oci-connect]: ORA-12154: TNS:could not resolve the connect identifier specified in /usr/local/apache/htdocs/testoci.php on line 6

NOTE: from oracle account I can connect to "emrep" using sqlplus so i know its working.
samiahmad

Posts: 34
Registered: 10/04/01
Re: php5.2.5 not working with apache2.2.8 on solaris 9
Posted: May 1, 2008 12:34 PM   in response to: samiahmad in response to: samiahmad
Click to report abuse...   Click to reply to this thread Reply
hi Ivan you still working on this issue?
Ivan Kartik

Posts: 3,279
Registered: 10/21/03
Re: php5.2.5 not working with apache2.2.8 on solaris 9
Posted: May 2, 2008 12:47 AM   in response to: samiahmad in response to: samiahmad
Click to report abuse...   Click to reply to this thread Reply
hi Ivan you still working on this issue?
Yes.

Warning: oci_connect() [function.oci-connect]: ORA-12154: TNS:could not resolve the connect identifier specified in /usr/local/apache/htdocs/testoci.php on line 6
NOTE: from oracle account I can connect to "emrep" using sqlplus so i know its working.

How many Oracle clients (including instant clients) is installed on your system?

Note if you set enviroment for Oracle in "apachectl" or in apache configuration then you don't need to setup environment in PHP scripts.
samiahmad

Posts: 34
Registered: 10/04/01
Re: php5.2.5 not working with apache2.2.8 on solaris 9
Posted: May 2, 2008 8:50 AM   in response to: Ivan Kartik in response to: Ivan Kartik
Click to report abuse...   Click to reply to this thread Reply
I have oracle server running on this node in $ORACLE_HOME and then I put all the instant client (basic and SDK) libraries in /instantclient_10_2 directory and my LD_LIBRARY_PATH points to /instantclient_10_2:$ORACLE_HOME/lib

Iam not setting any env variables in apache , how do I do that?

and then I have an other question: on my laptop (win XP) where Iam running xampp flavour of apache+php+oracle , Iam not setting any variables on apache or in php but yet I have problems connecting to the database. how is that possible?

thanks for your help
cj2

Posts: 774
Registered: 01/10/01
Re: php5.2.5 not working with apache2.2.8 on solaris 9
Posted: May 2, 2008 10:58 AM   in response to: samiahmad in response to: samiahmad
Click to report abuse...   Click to reply to this thread Reply
Avoid PutEnv in scripts to set environment variables. There's a convoluted description of why not in http://www.oracle.com/technology/tech/php/htdocs/php_troubleshooting_faq.html#envvars
The bottom line is that when PHP starts, it may load and initialize OCI8 using different values than you put in your script.

Set environment variables in the shell that starts Apache; see the example in the above reference.

On Windows, you'll probably find that the registry has the correct values set. And/or the library loading differs.

A general reference is Underground PHP and Oracle Manual

-- cj
samiahmad

Posts: 34
Registered: 10/04/01
Re: php5.2.5 not working with apache2.2.8 on solaris 9
Posted: May 4, 2008 1:55 PM   in response to: cj2 in response to: cj2
Click to report abuse...   Click to reply to this thread Reply
ok then enviornment variables is not the issue cause I am setting all the enviornement variables in the root shell from where iam starting Apache, I removed the setting of variables from the php script but I am still getting the tns error.
Ivan Kartik

Posts: 3,279
Registered: 10/21/03
Re: php5.2.5 not working with apache2.2.8 on solaris 9
Posted: May 5, 2008 1:36 AM   in response to: samiahmad in response to: samiahmad
Click to report abuse...   Click to reply to this thread Reply
I have oracle server running on this node in $ORACLE_HOME and then I put all the instant client (basic and SDK) libraries in /instantclient_10_2 directory and my LD_LIBRARY_PATH points to /instantclient_10_2:$ORACLE_HOME/lib

So that means you have two oracle products on one machine. So that probably means your PHP (which is using instant client) gets ORA-12154.
And when you do test case using sqlplus (which is probably using Oracle server files/libraries and settings) it is working.

So there are several options:
1. you need to copy tnsnames.ora (from server install) and put it to one of expected (by instant client) locations: $HOME/.tnsnames.ora (Note Apache by default runs under user "nobody". Of course don't change it to "root"!), /etc/tnsnames.ora / $ORACLE_HOME/network/admin/tnsnames.ora (in your case /instantclient_10_2/network/admin/tnsnames.ora)
2. OR you need to set TNS_ADMIN variable with path to Oracle Server Home/network/admin directory. In this case your existing tnsnames.ora will be used for resolution.
samiahmad

Posts: 34
Registered: 10/04/01
Re: php5.2.5 not working with apache2.2.8 on solaris 9
Posted: May 5, 2008 1:03 PM   in response to: Ivan Kartik in response to: Ivan Kartik
Click to report abuse...   Click to reply to this thread Reply
hi Ivan!

I am not seeing any ORA-12154 errors from PHP.
I have already set TNS_ADMIN pointing to $ORACLE_HOME/network/admin

I have a feeling this error is not related to php not being able to find tnsnames.ora ,I think php5.2.5 oci8 module is messed up. I saw a posting where a guy upgraded from php5.0 to php5.2.5 and he was getting the exact same error and when he made to run php5.2.5 as CGI script the error was fixed. .whats your thoughts about it?
cj2

Posts: 774
Registered: 01/10/01
Re: php5.2.5 not working with apache2.2.8 on solaris 9
Posted: May 5, 2008 1:17 PM   in response to: samiahmad in response to: samiahmad
Click to report abuse...   Click to reply to this thread Reply
I believe your environment is still misconfigured (and so was the other guy's).

Have you run:
<?php phpinfo(); ?>
to see what environment variables are set?

At the risk of destabilizing where you currently have got to, I wonder if you really need Instant Client? PHP will link against a normal Oracle home.

-- cj
samiahmad

Posts: 34
Registered: 10/04/01
Re: php5.2.5 not working with apache2.2.8 on solaris 9
Posted: May 6, 2008 12:43 PM   in response to: cj2 in response to: cj2
Click to report abuse...   Click to reply to this thread Reply
yes phpinfo shows all the variables set.
I was in the impression that php only works with oracle basic client but if you say php5 will compile with a normal ORACLE_HOME i am going to try that.
can you give me a simple apache and php ./configure commands ? cause I have an impression that my problems could be of choosing something extra that I dont have or dont need. I just want to be able to compile oci8 .

thanks
cj2

Posts: 774
Registered: 01/10/01
Re: php5.2.5 not working with apache2.2.8 on solaris 9
Posted: May 6, 2008 1:15 PM   in response to: samiahmad in response to: samiahmad
Click to report abuse...   Click to reply to this thread Reply
For a configure command, see the bottom of page 79 in The Underground PHP and Oracle Manual
samiahmad

Posts: 34
Registered: 10/04/01
Re: php5.2.5 not working with apache2.2.8 on solaris 9
Posted: May 9, 2008 7:53 PM   in response to: cj2 in response to: cj2
Click to report abuse...   Click to reply to this thread Reply
Ivan you were testing it on solaris ,any luck ?
samiahmad

Posts: 34
Registered: 10/04/01
Re: php5.2.5 not working with apache2.2.8 on solaris 9
Posted: May 10, 2008 10:52 AM   in response to: samiahmad in response to: samiahmad
Click to report abuse...   Click to reply to this thread Reply
we can close this thread as I am going to use ZEND , which I installed and its working great.
thanks for your help.
Legend
Guru Guru : 2500 - 1000000 pts
Expert Expert : 1000 - 2499 pts
Pro Pro : 500 - 999 pts
Journeyman Journeyman : 200 - 499 pts
Newbie Newbie : 0 - 199 pts
Oracle ACE Director
Oracle ACE Member
Oracle Employee ACE
Helpful Answer (5 pts)
Correct Answer (10 pts)

Point your RSS reader here for a feed of the latest messages in all forums