Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

oci_connect Blank Page in PHP

UPDATE (5/21/2010) SUCCESS!

So after MUCH $head->desk()'ing, I've solved it.

Remember kids, be wary of the instant client version you use, dependent on the virtualization settings!

I had been installing the generic Instant Client (not aware our ESX servers sit on AMD processors, not Intel) and that worked fine internally (the CentOS install was 32-bit since our internal ESXi servers aren't 64-bit). Well lo-and-behold, even if you have a 32-bit install running on a virtualized server which is sitting on an AMD64, it still matters what instant client you install.

It was the last thing I thought to check but as it appears, everything is running fine now.

I would like to thank everyone who helped me run through every possible test to figure this out but in the end, it was my fault for not realizing the differences in the virtualizations.


UPDATE (5/21/2010) I thought this bug had escaped me when I installed it on a new VM internally but I have now found a narrowing link.

I was trying to install this on our production server when I posted this. After a week of no progress and in need to get back to development, I outfitted a VM on our internal server with a brand new install of Crap... CentOS, and fresh installs of instant client and oci8.

Worked perfectly.

However we just uploaded an exact copy of the VM to our production servers and it magically no longer works. Tried reinstalling everything, no avail.

So the only things I could narrow it down to is a firewall issue (although I get the same issue when trying 127.0.0.1) or possibly an ESX (our production servers) server issue, internal servers are running ESXi.

Any thoughts?

UPDATE (3/8/2010) I installed Xdebug and have it tracing my code. This is the output I am getting:

TRACE START [2010-03-08 17:53:05]
    0.2090     327864   -> {main}() /data/aims3/http/octest.php:0
    0.2091     327988     -> ini_set(string(14), string(1)) /data/aims3/http/octest.php:3
    0.2093     327920     -> error_reporting(long) /data/aims3/http/octest.php:4
    0.2094     328048     -> oci_connect(string(8), string(8), string(25)) /data/aims3/http/octest.php:6

The trace halts at that point.

I have installed everything the same way on a local server and it works fine. To say I am at a complete loss would be putting it lightly.


*NOTE: I ran make test and it returned FAIL on every test. I never ran this on my working machine to see if it reports the same errors. Any idea why make test would report FAIL but make doesn't report any error?

I've installed the Oracle Instantclient with no reported errors along with the OCI8 PECL package and at a loss. Whenever I try to open a connection with oci_connect, it halts my entire PHP script.

EXAMPLE:

<?php
ini_set ("display_errors", "1");
error_reporting(E_ALL);
echo "before";
$conn = oci_connect("username", "password", "host");
echo "after";
?>

Returns a complete blank page. The module is loaded (seen in phpinfo) and everything installed with no errors.

I am at a complete loss.

CentOS: 5.4

Apache: 2.2.3

PHP: 5.3.1

InstantClient: 11.2

oci8: 1.4.1

Any thoughts?

NOTES

Apache Error Log reports nothing

Attempted Debugging:

1:

<?php
ini_set ("display_errors", "1");
error_reporting(E_ALL);
echo "before";
if(!function_exists('oci_connect')) die('Oracle Not Installed');
echo "after";
?>

Returns:

beforeafter

2:

Changing host to //host

Returns:

Same error

like image 980
Bryan Avatar asked Oct 15 '22 08:10

Bryan


2 Answers

Is there anything in Apache's error_log? Is this mod_php or FastCGI or normal CGI PHP? What happens if you run the script via the command line?

You could also try setting PHP's error log and looking in there.


EDIT1: Try:

echo "before";
if(!function_exists('oci_connect')) die('Oracle Not Installed');

And post the results...


EDIT2: I'm really not sure. My best bet is this info from the PHP manual:

The most common problem with installing OCI8 is not having the Oracle environment correctly set. This typically appears as a problem using oci_connect() or oci_pconnect(). The error may be a PHP error such as Call to undefined function oci_connect(), an Oracle error such as ORA-12705, or even an Apache crash. Check the Apache log files for startup errors and see the sections above to resolve this problem.

Anyone else have any ideas to help out Bryan?

like image 98
Josh Avatar answered Nov 03 '22 00:11

Josh


Bryan,

I am going to be honest: I tried this two years ago and failed miserably. :) I could not get the OCI functions to work for anything by compiling myself.

But in the interest of getting it done I looked for an alternate solution and found it in Zend Core for Oracle. All I did was download, run the installer, and it was done. It installs Apache/PHP, MySQL (optional), and the InstantClient for you.

Now as Zend Server, it is basically the same product. I realize that this may not be the solution you hoped for, but if it works...

Zend Server

like image 26
TomWilsonFL Avatar answered Nov 03 '22 01:11

TomWilsonFL