10 Replies Latest reply: Apr 13, 2012 1:02 PM by Gogala Mladen RSS

    PHP program works with Oracle db 11.2.0.1 but exits sideways with 11.2.0.2

    user12036311
      Hi

      Our PHP developer told me that his PHP program works with Oracle database 11.2.0.1 but exits sideways without errors with database 11.2.0.2.

      The PHP environment is:
      Suse release 11, current kernel revision is: 2.6.32.36-0.5-default #1 SMP 2011-04-14 10:12:31 +0200 x86_64 x86_64 x86_64 GNU/Linux,
      PHP 5.2.14 with Suhosin-Patch 0.9.7 (cli) (built: Mar 10 2011 17:37:25)
      Copyright (c) 1997-2009 The PHP Group
      Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies
      with Suhosin v0.9.32.1, Copyright (c) 2007-2010, by SektionEins GmbH,
      Oracle full Client 11.2.0.2,
      OCI8 1.4.6 stable,
      Appache Server version: Apache/2.2.10 (Linux/SUSE)

      I contacted the Oracle Tech Support, they told me that because we are not using the mod_php provided by Oracle http server, they could not provide support from their side. They told me to follow the documentation "How to install and use PHP 5 with Oracle HTTP Server 11g" to use Oracle HTTP server instead of Apache Server for our PHP environment.

      I am wondering if anyone encouters the same problem and find a fix/workaround for it? Because the same PHP program works just fine with the 11.2.0.2 Oracle database, our testing database but not 11.2.0.1 Oracle database, our production database. I don't know it's the database upgrade (from 11.2.0.1 to 11.2.0.2) cuasing the problem or our PHP environment/setup won't work with a 11.2.0.2 database.

      I am wondering if anyone has any ideas on why it's happening and know a solution for it. Thank you.
        • 1. Re: PHP program works with Oracle db 11.2.0.1 but exits sideways with 11.2.0.2
          user12036311
          Correction: Because the same PHP program works just fine with the 11.2.0.1 Oracle database, our production database but not 11.2.0.2 Oracle database, our test database.
          • 2. Re: PHP program works with Oracle db 11.2.0.1 but exits sideways with 11.2.0.2
            cj
            If you can identify an OCI-related error or DB error than we will be able to get Oracle Support to look at the error. PHP OCI8 uses the OCI API; the OCI development team have contributed to OCI8 and they will be able to assist.

            The Oracle DB 11.2.0.3 patch was released on support.oracle.com today for Linux 32 & 64 bit. Instant Client has not yet been bundled. But since you're using the full client it might be a quick, useful test to try your app with 11.2.0.3.

            To identify a cause check all the normal trace files in the stack on client & server machines, including in the 11g oradiag_* directories. Try and minimize a testcase.
            • 3. Re: PHP program works with Oracle db 11.2.0.1 but exits sideways with 11.2.0.2
              user12036311
              Hi cj,

              Thank you for the reply.

              We did collect the database trace files (by using alter session set sql_trace=TRUE) and sent to Oracle support.
              No Oracle errors found in these trace files on the database servers (our database servers are running on AIX machines).
              With 11.2.0.2 database, the PHP program just stopped at some point. With 11.2.0.1 database the PHP program procceeds and generates more trace files without errors in them.
              Our developer told me that his PHP program has no problem connecting to the database and run some SQL commands, but it terminates when collections are used to handle bulk data operations with the 11.2.0.2 database.

              We will collect the database client side trace files (by setting the trace parameters in sqlnet.ora on the client Linux machine) to see if we can catch any OCI and/or DB errors. Thank you for your suggestion.

              Do you know is there a way to catch errors on the Web Server (Apache Server) level and/or on the PHP level? Our PHP developer told me no errors found on our PHP environment. Which makes the troubleshooting very difficult.

              Thank you.
              • 4. Re: PHP program works with Oracle db 11.2.0.1 but exits sideways with 11.2.0.2
                FlyingGuy
                Try turning on oci_internal_debug http://www.php.net/manual/en/function.oci-internal-debug.php
                Also in php.ini turn on all the error checking http://php.net/manual/en/errorfunc.configuration.php

                This should get you some more info and let you know if the failure is someplace on the web server. Don't forget to check your apache logs.
                • 5. Re: PHP program works with Oracle db 11.2.0.1 but exits sideways with 11.2.0.2
                  user12036311
                  Thank you, FlyingGuy. I will work with our developer to catch more info. for troubleshooting.
                  • 6. Re: PHP program works with Oracle db 11.2.0.1 but exits sideways with 11.2.0.2
                    user12036311
                    After more testings done by our developer, he told me that his PHP script works if he uses Oracle Client 11.2.0.1 with Oracle database 11.2.0.1 and uses Oracle Client 11.2.0.2 with Oracle database 11.2.0.2. When it's not working (Oracle client version and Oracle database version are different), the Oracle Error is :
                    Errors in file :
                    OCI-30757: Message 30757 not found; product=RDBMS; facility=OCI

                    Since the developer now can make his PHP script work. I am going to mark this question answered. Thank everyone for your help!
                    • 7. Re: PHP program works with Oracle db 11.2.0.1 but exits sideways with 11.2.0.2
                      FlyingGuy
                      Well I wish we could have been of more help, but I did manage to discover that the error has to do with being unable to fetch type information when dealing with objects. So if your developers script trying to move objects around?
                      • 8. Re: PHP program works with Oracle db 11.2.0.1 but exits sideways with 11.2.0.2
                        cj
                        If I had to guess, I say it sounds like the developer is using
                        persistent connections and modifying SQL types as part of the
                        development process.

                        Hopefully the production application won't do this, since it can lead
                        to inconsistencies when the client (aka PHP) process information about
                        the type doesn't match the updated server description. In your case
                        it seems to have caused an error and the PHP process has had to abort.

                        During this phase of development you might want to use non-persistent
                        connections or restart Apache after each type change.
                        • 9. Re: PHP program works with Oracle db 11.2.0.1 but exits sideways with 11.2.0.2
                          FlyingGuy
                          Hey CJ,

                          Nice call. I didn't think about that, but it is locked in the memory banks now.

                          Now with persistent connections is there a way to flush the cash to avoid this sort of thing?

                          Best
                          • 10. Re: PHP program works with Oracle db 11.2.0.1 but exits sideways with 11.2.0.2
                            Gogala Mladen
                            You have changed ORACLE_HOME. How do you set ORACLE_HOME when you start Apache? The right way is to set the home in /etc/sysconfig/httpd like this:

                            mgogala@mladen ~]$ head /etc/sysconfig/httpd
                            +# Configuration file for the httpd service.+

                            +#+
                            +# The default processing model (MPM) is the process-based+
                            +# 'prefork' model. A thread-based model, 'worker', is also+
                            +# available, but does not work with some modules (such as PHP).+
                            +# The service must be stopped before changing this variable.+
                            +#+
                            export ORACLE_HOME=/oracle/product/11.2.0/client
                            export LD_LIBRARY_PATH=/oracle/product/11.2.0/client/lib

                            You can check by doing this: php -r 'phpinfo();'|grep -i oracle

                            If ORACLE_HOME, LD_LIBRARY_PATH and ORACLE_BASE aren't defined, there is an installation problem.