14 Replies Latest reply on Jul 19, 2012 5:13 AM by cj

    PHP and Oracle 11g

      I am installing and configuring PHP on an Oracle Application Server with OAM, OID and Forms and Reports. Do I need the Oracle Client if I am using DAD's?
        • 1. Re: PHP and Oracle 11g
          The PHP OCI8 extension and PDO_OCI adapter use Oracle Call Interface APIs. If you use either of these two layers, you will need to build PHP with Oracle libraries which have these APIs. These libraries are included in the Oracle Database $ORACLE_HOME/lib directory, or are available with Oracle Client (installed via Oracle Installer), or in Oracle Instant Client (installed via ZIP or RPM).

          For some notes on installing with OHS, see https://blogs.oracle.com/opal/entry/building_php_53_with_oracle_ht or info on the older version is in the Underground PHP & Oracle Manual.
          • 2. Re: PHP and Oracle 11g
            I'm following the article:
            starting with:
            Download the FastCGI component mod_fcgid-2.3.6-win32-x86.zip
            from httpd.apache.org/download.cgi#mod_fcgid
            since I already have OHS.
            However when I Unzip the latest version of mod_fcgid for my OS the mod_fcgid.so and mod_fcgid.pdb files never appeared.
            What do I do now?
            • 3. Re: PHP and Oracle 11g
              You possibly got the source code? The http://httpd.apache.org/download.cgi page doesn't have a link to the current Window's fcgid binaries (perhaps they are waiting for a build of the latest version?) If you look at links to other Apache Window binaries, you can navigate to that directory and locate the 2.3.6 fcgid binary zip, e.g. from http://apache.cs.utah.edu//httpd/binaries/win32/

              Let us know how it goes with OHS. I'm curious to know if it works on Windows.
              • 4. Re: PHP and Oracle 11g

                Appreciate you trying to help us with this.

                We followed this... http://www.oracle.com/technetwork/articles/dsl/inst-php-apache-windows-098333.html

                But, when we restarted the HTTP server, we received this error in the log:

                Apache.exe: Syntax error on line 206 of D:\\oracle\\product\\fmwfr\\frinst1\\config\\OHS\\ohs1/httpd.conf: Cannot load D:/oracle/product/fmwfr/Oracle_FR1/ohs/modules/mod_fcgid.so into server: %1 is not a valid Win32 application.

                Any ideas?

                • 5. Re: PHP and Oracle 11g
                  Do we need to install Instant Client since our db is on a different server?
                  • 6. Re: PHP and Oracle 11g
                    We got that error message after we tried to restart the OHS server after placing the mod_fcgid.so into the
                    ...\Oracle_FR1\ohs\modules folder and pointing to this file in the
                    ...\frinst\config\OHS\ohs1\httpd.conf file.
                    • 7. Re: PHP and Oracle 11g
                      Yes you will need Instant Client if you have no Oracle database libraries on the machine where PHP is installed.

                      You could try the old non-fastcgi installation, but I suspect you'll have similar binary compatibility issues. These are common on Windows. The OHS, mod_fcgid and PHP binaries are all built separately, giving potential binary version issues as the tool chains vary. For a while PHP binaries were not compatible with Apache binaries at all. People commonly see 32 bit vs 64 bit issues too.

                      My best bet for you would be to install standalone Apache with PHP using a different port, and set up a reverse proxy to it from OHS or vice versa.

                      My favorite option is to use Linux.
                      • 8. Re: PHP and Oracle 11g
                        Is Zend Core an option?
                        • 9. Re: PHP and Oracle 11g
                          Zend Server is a convenient way to install PHP & Apache. It's not integrated with OHS in anyway. ZS is the successor to Zend Core.
                          • 10. Re: PHP and Oracle 11g
                            I struggled with getting conned to oracle for a while until I figured it out. We run IIS 6 on Windows 2003. You need to set up the instant client libaries in a folder (set the path in your windows environment variables) then you need to install Visual Studio C++ express. PHP will not install oci8 properly because there are missing dll files which installing VS C++ express will fix. once you see oci8 come up in you phpinfo() you should be good to go. You should be able to connect like this...

                            define('ORACLE_PASSWORD', 'your_password');

                            // IP - PORT - DATABASE INSTANCE

                            define('ORACLE_HOST','123.456.789.123:4567/dev'); // Testing

                            //OPEN ORACLE CONNECTION

                            $conn = oci_connect(ORACLE_USERNAME, ORACLE_PASSWORD, ORACLE_HOST);
                            • 11. Re: PHP and Oracle 11g
                              We are still trying to get the test page to come up using the mod_fastcgi that came with OHS. Besides adding the line:
                              LoadModule fastcgi_module ".../modules/mod_fastcgi.so" what else does the httpd.conf file have to me modified?
                              • 12. Re: PHP and Oracle 11g
                                Can we use mod_php (DSO) instead of mod_fastcgi or mod_fcgid? Can we downlaod php4 and install the dll's in an apache folder to do this with OHS present and if not is there anyway that we can get mod_php to work?
                                • 13. Re: PHP and Oracle 11g
                                  Can we get mod_php (DSO) to work with OHS and if so how would we do that? The mod_php module with php4 loads many dll's in a httpd file in an apache folder and the apache that comes with OHS loads many modules in a httpd file in an ohs1 folder so how could we get mod_php to work if possible?
                                  • 14. Re: PHP and Oracle 11g
                                    I expect it won't work but it should be simple to test. The last customer who tried this didn't succeed - and migrated to Linux.