Jump to content

Archived

This topic is now archived and is closed to further replies.

Daen

Fatal error on oci_parse()

Recommended Posts

I'm running XAMPP on my machine (localhost), and Oracle on another server:
ApacheFriends XAMPP (basic package) version 1.5.2

+ Apache 2.2.0
+ PHP 5.1.2 + PHP 4.4.2-pl1 + PEAR

Ok, here's my code:

test.php:
[code]
<?php
    include('include/connectORA.php');

    echo "<html>\n<body>\n";
    
    echo "Attempting to connect to Oracle database.<br>\n";
    
    $conn1 = connectORA();
    
    if(!$conn1)
        echo "Error connecting to database.<br>\n";
    else
        echo "Successful!<br>\n";
    
    echo "<br>Attempting to select data from database.<br>\n";
    
    $table = "PERSON";
    
    $sql = "SELECT * FROM ".$table;
    
    $stmt = oci_parse($conn1, $sql);   // <-- has problem right here
    oci_execute($stmt);
    
    echo "Results: <br>\n";
    
    $row = oci_fetch_assoc($stmt);
    
    print_r($row);
        
    echo "</body>\n</html>";
?>[/code]

connectORA.php
[code]<?php
    function connectORA()
    {
        $db = "MYNAME";
        return ocilogon("mydb", "mypass", $db);
    }
?>[/code]

When I run it in Firefox, Apache gives me the following error "Apache HTTP Server has encountered a problem and needs to close." Then it tells me that the document has no data in it, and Apache keeps running afterward. Kinda strange it tells me it crashed, and then doesn't.

If I comment out the lines after $sql = "..."; then it works just fine, and I even get a connection successful notice. If I uncomment oci_parse(), then it gives me the error again.

Does anybody know what might be causing this?

Am I maybe getting a bad connection, even though $conn1 isn't null?

I appreciate any help.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.