===============================
My Blog: http://www.blog.arun-prabha.com/
My Home: http://www.arun-prabha.com
===============================
I ran the . /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/oracle_env.sh
command in a terminal and it went fine (no errors). I then ran this small PHP script named hello.php:
<?php
$db=OCILogon("username", "pwd","XE");
?>
I got the following error when I tried http://localhost/hello.php in a browser:
Warning: ocilogon() [function.ocilogon]: ORA-12154: TNS:could not resolve the connect identifier specified in /var/www/hello.php on line 2.
Any idea?
===============================
My Blog: http://www.blog.arun-prabha.com/
My Home: http://www.arun-prabha.com
===============================
Thanks, I just installed OCI on my Ubuntu Dapper. Now to see if it works... at least it appears when I do a phpinfo() !!!
Just one thing: on the instructions at the beginning of this topic it says you have to unzip two zip files. It should also be noted that the contents of both zip files should be directly under /opt/oracle/instantclient... I lost some minutes wondering why it didn't work and the reason was that the "unzip" command creates folders called something like "instantclient-sdk-linux32-10.2.0.2-20060331.zip_FILES"...
i had to set up the LD_LIBRARY_PATH with a :
SetEnv LD_LIBRARY_PATH /opt/oracle/instantclient
in apache.
export LD_LIBRARY_PATH=/opt/oracle/instantclient/ may still work but then you gotta be more precise for what user you do this.
more about this at http://www.phpfreaks.com/forums/inde...5498.msg382340
I tried doing that, but Apache is disconnecting and throwing a segmentation fault. How can I fix that?
Thank you! The best Howto I've user used!
I used the pecl oci install
A couple of things in case anyone else comes up against them;
When I unzipped instant client the root directory was /opt/oracle/instantclient/instantclient_10_2 so I had to use this as the root folder I gave to the pecl install
pecl gave me an error saying that the oci8 install was hitting its memory limit, to get round this edit the command line at the bottom of /usr/bin/pecl to include the statement -d memory_limit=20M
Worked fine for me after that.
Hell all,
I really enjoy distribution ubuntu 6.10 for it's simplicity so I want to share my few commands howto for setting up apache for connection to remote oracle database:
root@roleta:/home/rollyboy# uname -a
Linux roleta 2.6.17-11-generic #2 SMP Thu Feb 1 19:52:28 UTC 2007 i686 GNU/Linux
root@roleta:/home/rollyboy#
apt-get install oracle-xe-client #ofcourse you need to set up your /etc/apt/sources.list
it will install oracle client to /usr/lib/oracle/xe/app/oracle/product/10.2.0/client/ (oracle home directory)
apt-get install php-pear
apt-get install build-essential
In next step you will be asked for oracle home directory, put there the path mentioned above
pecl install oci8
echo "extension=oci8.so" >> /etc/php5/cli/php.ini
echo "extension=oci8.so" >> /etc/php5/apache2/php.ini
/etc/init.d/apache2 restart
#######simple pease of php code for connection to remote databse
if(!($conn = oci_connect(USERNAME,PASS,SERVER_NAME.":".PORT_NUM BER."/".SEVICE_NAME)))
{
DisplayErrMsg(sprintf("error connecting to host %s, by user %s",
SERVER_NAME, USERNAME)) ;
exit() ;
}
Thank you so much!
A little add-on:
The last parameter is the SID
Difference between service_name and database_name?Code:oci_connect("user", "password", "10.0.0.x:1521/sid")
Last edited by docker; August 22nd, 2007 at 02:16 PM. Reason: complement
Greetings everybody.
First of all let me congratulate you all for the maintenance of this extraordinary forum. You can see that by my low number of posts... I rarely need to ask something.
Now for the big question...
When I try to do "pecl install oci8", I get a "Oracle Instant Client SDK header files not found" error.
Could you please provide some info regarding this item?
Best regards,
CFK
Problem solved!
There was a directory mismatch somewhere, making impossible to the script to find InstantClient libraries and Oracle SDK.
My final directory arrangement ended up like this:
/opt/oracle/instantclient/instantclient (before /opt/oracle/instantclient/instantclient_11_1)
/opt/oracle/instantclient/sdk (before /opt/oracle/instantclient/instantclient_11_1/sdk)
After this, I ran the command pecl install oci8 and gave the following information:
instantclient,/opt/oracle/instantclient/instantclient
Then everything was working fine in PHP right after adding the extra line to load the OCI8 extension.
Best Regards,
CFK
Bookmarks