You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Jose Tremols <tr...@gmail.com> on 2015/11/24 04:43:33 UTC

[users@httpd] Problem with dbd authentication, Oracle, oci8 and PHP

Hello,

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

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 default site
I access http://localhost/connect.php and it displays the list of the 
user's tables
     <?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";
     ?>


The problem is that once I configure Apache dbd authentication for 
another 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:


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
     -An authenticated site configured to use dbd authenticacion against 
an Oracle 11g database
           I have compiled apr-1.5.2 libraries against Oracle instanclient

I would appreciate any help.

Best regards,
José