12 Replies Latest reply on Jan 16, 2008 2:57 AM by 617872

    Problem installing PHP5, Oracle 10g client, Apache 2 and a few other bits.

    517478
      I'm trying to create a script that will build a Fedora 4 server with Apache, MySQL, APC, PHP and Oracle 10g connectivity. The MySQL database is there because the Oracle database I'm connecting to is a large production databse in another country so I'll only be doing SELECTs, putting the data into MySQL and manipulating it locally.

      However, I'm having problems acheiving this. As I said, all I'll ever do is SELECTs so I don't need to install the full client. However, if you read http://www.oracle.com/technology/tech/php/htdocs/inst_php_apache_linux.html it says I can acehive this by downloading some RPMs but they don't seem to exist anymore. So I'm downloading the ZIP files for the client and the SDK, setting ORACLE_HOME to point to the extracted files and getting the standard:

      checking OCI8 libraries dir... lib32
      checking Oracle version... configure: error: Oracle-OCI8 needed libraries not found

      My conlcusion after 2 days of messing around and tweaking is that I'm not downloading the correct files. Doesn't help that Oracle's own instructions suggest downloading files that don't exist but I can't find any instructions to acheive what I'm trying to do.

      Can anyone point me in the direction of some instructions for installing the necessary parts without installing the whole client - it used to be possible before the RPMs disappeared.

      Thanks

      Steve
        • 1. Re: Problem installing PHP5, Oracle 10g client, Apache 2 and a few other bi
          164043
          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.
          • 2. Re: Problem installing PHP5, Oracle 10g client, Apache 2 and a few other bi
            517478
            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!

            Steve
            • 3. Re: Problem installing PHP5, Oracle 10g client, Apache 2 and a few other bi
              514663
              You're trying to install the Instant Client and downloaded it from:

              http://www.oracle.com/technology/tech/oci/instantclient/index.html

              I assume?
              • 4. Re: Problem installing PHP5, Oracle 10g client, Apache 2 and a few other bi
                517478
                Yes, and I followed the instuctions at the bottom (setting LD_LIBRARY_PATH)
                • 5. Re: Problem installing PHP5, Oracle 10g client, Apache 2 and a few other bi
                  514663
                  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?
                  • 6. Re: Problem installing PHP5, Oracle 10g client, Apache 2 and a few other bi
                    517478
                    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                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
                    • 7. Re: Problem installing PHP5, Oracle 10g client, Apache 2 and a few other bi
                      392393
                      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
                      • 8. Re: Problem installing PHP5, Oracle 10g client, Apache 2 and a few other bi
                        517478
                        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

                        tree /oracle/OraHome1

                        so I can compare it with what I've got?

                        Thanks

                        Steve
                        • 9. Re: Problem installing PHP5, Oracle 10g client, Apache 2 and a few other bi
                          392393
                          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.

                          ~Jer
                          • 10. Re: Problem installing PHP5, Oracle 10g client, Apache 2 and a few other bi
                            518090
                            Hi user514475,

                            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
                            Thorsten
                            • 11. Re: Problem installing PHP5, Oracle 10g client, Apache 2 and a few other bi
                              522808
                              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 \
                              --prefix=/opt/php/5.1.4 \
                              with-libxml-dir=/usr with-xml \
                              --with-sapdb=/opt/sapdb/interfaces/odbc \
                              --with-mysql \
                              --enable-track-vars \
                              --with-gd \
                              --with-gettext \
                              --with-openssl \
                              --enable-magic-quotes \
                              --enable-memory-limit \
                              --enable-calendar \
                              --with-zlib-dir=/usr/lib \
                              --with-oci8=instantclient,/opt/instantclient_10_2

                              The ORA_HOME and TNS_ADMIN export are really only necessary for Apache startup environment and I didn't use it during compilation.
                              • 12. Re: Problem installing PHP5, Oracle 10g client, Apache 2 and a few other bi
                                617872
                                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:
                                http://www.oracle.com/technology/software/tech/oci/instantclient/htdocs/linuxsoft.html

                                Install the packages:
                                rpm -Uvh oracle-instantclient-basic-11.1.0.1-1.i386.rpm
                                rpm -Uvh oracle-instantclient-devel-11.1.0.1-1.i386.rpm

                                Export a variable in your bash profile to the library dir (replace 11.1.0.1 with whatever version you have):
                                echo "export LD_LIBRARY_PATH=/usr/lib/oracle/11.1.0.1/client/lib/" >> ~/.bashrc
                                export LD_LIBRARY_PATH=/usr/lib/oracle/11.1.0.1/client/lib/

                                Check to see if that worked:
                                echo $LD_LIBRARY_PATH

                                You should see "/usr/lib/oracle/11.1.0.1/client/lib/".

                                Install PHP
                                ---------------

                                Get the PHP source code from:
                                http://www.php.net/downloads.php

                                Unzip the source:
                                tar -xvf php-5.2.5.tar.bz2
                                cd php-5.2.5

                                Configure PHP:
                                ./configure --with-oci8=instantclient,/usr/lib/oracle/11.1.0.1/client/lib

                                (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):
                                make
                                make install

                                Configure Apache
                                -------------------------

                                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!

                                Cheers,

                                Matt