This content has been marked as final. Show 12 replies
Most likely, your $ORACLE_HOME isn't defined and exported from the user root.
When linking with Oracle RDBMS, ORACLE_HOME is the the most important
environment variable to define. I have FC4 with Oracle 10.2.0.2, Apache 2.0.54, PHP 5.1.4 and the latest OCI8 driver. Works like a charm. I have a small Oracle DBA package on
my page that I wrote in PHP5 and it works like a charm.
I don't want to install the client. ORACLE_HOME is set and I've pointed it in and around various directories where libclntsh.so resides, installed from the downloads on OTN (the client and SDK packages) but it won't compile.
I'm absolutely 101% confident that ORACLE_HOME isn't the problem. The main problem is the out of date instruction on OTN!
You're trying to install the Instant Client and downloaded it from:
Yes, and I followed the instuctions at the bottom (setting LD_LIBRARY_PATH)
This might sound silly, but if you are installing from a shell prompt, are you making that the path for ORACLE_HOME is not wrapping and breaking into 2 lines in the shell?
Can you paste the .configure you are using?
It's very simple at the moment...
./configure with-apxs2=/usr/local/apache2/bin/apxs with-mysql-sock=/tmp/mysql.sock with-mysql=/usr/local/mysql with-zlib with-zlib-dir with-curl enable-track-vars with-config-file-path=/usr/local/apache2/conf enable-trans-id enable-mbstring enable-sockets with-openssl with-oci8=$ORACLE_HOME enable-sigchild --disable-cgi
Simple is good :) Here's mine, it's running Apache 2.2, PHP 5.1.4, Oracle 10g R2. Maybe if you spell out the oracle home rather than using a variable it would work better?
./configure enable-ftp mandir=/usr/share/man with-bz2 with-curl with-png with-zlib with-mysql enable-calendar enable-dbx enable-dio with-jpeg enable-inline-optimization with-inifile with-flatfile with-gmp disable-memory-limit with-apxs2=/usr/local/apache2/bin/apxs with-oci8=/oracle/OraHome1 with-openssl with-imap with-kerberos with-imap-ssl
I prefer simple.
When you say "Oracle 10g R2" do you mean you have installed the client? This is my problem - I can compile PHP if I install the client - that always works. But I don't want to install the client, just the necessary bits to make it work with PHP.
In the past I've done this with the RPMs and it's worked. But if I downlaod the ZIPs (client and SDK as the RPMs have disappeared) and point to that directory - where libclntsh.so lives - it just won't compile. So I'm guessing I'm still missing something BUT the only instructions I can find are for installing the RPMs.
If you haven't installed the client and have used the zips, could you do a
so I can compare it with what I've got?
Sorry, I'm actually running the server... so that's even less like what you want ;)
I would recommend using the instant client, that's the smallet subset of Oracle that I was able to compile against. I think you're going to need at least the core oci libraries.
I think installing the "oracle instant client" basic and sdk packages is the minimum, you have to before running ./configure over your php-sources.
You can then use "--with-oci8=instantclient,/path/to/ora_instant_client"
I don't think, that you can in an easy way compile PHP to support only "SELECT" on a ORACLE database, because you then have to rewrite the whole extension (oci8), and this makes IMHO no sense.
By the way the Oracle Instant Client is not as big as you seem to believe;-)
Greetings from Hamburg
After following some ideas from this thread I've got a working Apache 2.0.58 / PHP 5.1.4 + Oracle instant client 10.2.0.2 (zip version). I've found the trick is after extracting all zip files to a single directory (e.g. /opt/instantclient_10_2, if all your zip files are in /opt), this symlink must be made otherwise PHP complains:
checking for Oracle (OCI8) support... yes
checking Oracle Instant Client directory... /opt/instantclient_10_2
checking Oracle Instant Client SDK header directory... /opt/instantclient_10_2/sdk/include
checking Oracle Instant Client version... configure: error: Link from /opt/instantclient_10_2/libclntsh.so to libclntsh.so.10.1 not found
So I did:
ln -s libclntsh.so.10.1 libclntsh.so
then it configures and compiles fine.
btw here's my configuration settings, I found have to use 'instantclient' in the oci8 clause.
./configure --with-apxs2=/opt/apache/current/bin/apxs \
with-libxml-dir=/usr with-xml \
The ORA_HOME and TNS_ADMIN export are really only necessary for Apache startup environment and I didn't use it during compilation.
I also had a few problems installing OCI8 with Apache2 and PHP 5.2.5 on OpenSUSE 10.2. Here is what I did to get it working:
Note: Install all of this as the root user
Install Oracle Instant Client
Download the Basic and the SDK Instant Client RPM packages from:
Install the packages:
rpm -Uvh oracle-instantclient-basic-22.214.171.124-1.i386.rpm
rpm -Uvh oracle-instantclient-devel-126.96.36.199-1.i386.rpm
Export a variable in your bash profile to the library dir (replace 188.8.131.52 with whatever version you have):
echo "export LD_LIBRARY_PATH=/usr/lib/oracle/184.108.40.206/client/lib/" >> ~/.bashrc
Check to see if that worked:
You should see "/usr/lib/oracle/220.127.116.11/client/lib/".
Get the PHP source code from:
Unzip the source:
tar -xvf php-5.2.5.tar.bz2
(Note that I have removed a number of options for clarity)
Make and install PHP (Note that step can take a while depending on what else you are doing):
Edit the Apache configuration file:
vim /etc/apache2/httpd.conf (might be in /usr/local/apache/conf)
Comment out the old PHP4 module and add in the new module:
#LoadModule php4_module modules/libphp4.so
LoadModule php5_module modules/libphp5.so
Remove the old handler and enter in the new file types:
#AddHandler php-script php php3
AddType application/x-httpd-php .php .phtml .php3
AddType application/x-httpd-php-source .phps
Restart apache and you should be good to go!