You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by José Tremols <tr...@gmail.com> on 2015/11/24 19:57:12 UTC

Fwd: Problem with apr dbd authentication, Oracle, oci8 and PHP

Hello,



I've been fighting with this problem for a week.



Problem's definition:



My php-oracle code fails without any logging information after using the
DBDriver directive on a virtual host configuration in order to authenticate
a site using an oracle database using apr_dbd_oracle



Configuration description:



I have installed oci8 in order to access an Oracle 11g database from php
5.4.16

My php pages work fine. I can connect, select, update, insert.

Here is the code of a simple php page named connect.php that I put under
Apache’s default site.

    <?php

    putenv("ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe");


putenv("LD_LIBRARY_PATH=/u01/app/oracle/product/11.2.0/xe/lib:/lib:/usr/lib:/lib64:/usr/lib64");

    $conn = oci_connect('havana', 'cdcdcdcdcdc', '//127.0.0.1/xe');



    $stid = oci_parse($conn, 'select table_name from user_tables');

    oci_execute($stid);



    echo "<table>\n";

    while (($row = oci_fetch_array($stid, OCI_ASSOC+OCI_RETURN_NULLS)) !=
false) {

        echo "<tr>\n";

        foreach ($row as $item) {

            echo "  <td>".($item !== null ? htmlentities($item, ENT_QUOTES)
: "&nbsp;")."</td>\n";

        }

        echo "</tr>\n";

    }

    echo "</table>\n";

    ?>



I access http://localhost/connect.php and it displays the list of the
user's tables



[image: Imágenes integradas 1]



I want to configure an authenticate site (nothing to do with the previous
page that is on the default site). This new site is defined on a virtual
host.



I downloaded apr and apr-util and I compiled them against my Oracle
instanclient that I’ve previously installed from Oracle’s rpm’s



Once I put the “DBDriver oracle” directive on my virtual host definition
for this site, my php code against the database stop working.

I try to access the same page http://localhost/connect.php without any
modification to the page and I have this error screen:



[image: Imágenes integradas 2]


I don't need to access the authenticated site. Just defining the virtual
host with the dbd authentication and restarting Apache makes my php
database related code stop responding

I don't even need to configure all the directives for the authentication.
I just put the DBDDriver oracle directive, restart Apache and php-oracle
doesn't work anymore

This is the virtual host definition:

            <VirtualHost *:80>
                ServerAdmin webmaster@havana.tld
                DocumentRoot "/srv/auth"
                ServerName auth.havana.tld
                ErrorLog "/var/log/httpd/auth.havana.tld-error_log"
                CustomLog "/var/log/httpd/auth.havana.tld-access_log" common
                DBDriver oracle
                DBDParams "user=havana pass=crosemont server=127.0.0.1:1521"
                DBDPersist on

            <Directory "/srv/auth">
                AuthType Basic
                AuthName "Havana"
                AuthBasicProvider dbd
                Require valid-user
                AuthDBDUserPWQuery "SELECT p_client FROM client WHERE
n_client = %s"
            </Directory>
        </VirtualHost>

Configuration:
    -Apache 2.4.6 Over CentOS 7
    -Oracle 11g 11.2.0 database

    -PHP 5.4.16

    -apr-1.5.2

    -apr-util-1.5.4


I would appreciate any help.

Best regards,
José