We are using a Lumen 5.2.x (Laravel) application to get data from a Oracle Database. For that reason we use oci_connect()
to connect to the database. (Extra info: we use Oracle instantclient)
For a reason unknown, the application was not responsive and wouldn't return any data. After lots of hours debugging we found out that it got stuck in that very same method: oci_connect()
. Apparently the function did not return a 'time-out'-message or anything similar.
Later, it seemed the database moved to another host, which is the reason it couldn't connect. However, we expected a error, instead of a huge amount of waiting.
This is the reason we are trying to force a time-out to be set, until now this has not worked out.
Things we have tried:
Adding this to the connection string: (CONNECT_TIMEOUT=10)(RETRY_COUNT=3)
which is completely ignored.
Setting max_execution_time
and set_time_limit
to 1
Adding a sqlnet.ora
with settings:
TCP.CONNECT_TIMEOUT=10
SQLNET.INBOUND_CONNECT_TIMEOUT=10
SQLNET.OUTBOUND_CONNECT_TIMEOUT=10
Everything we have tried failed, does anyone know how to work around this bug? Any help is appreciated!
Edit: System info: Windows Server 2012 R2, IIS 8, PHP 5.6
below is laravel package used for oracle, you can try this,
laravel package for oracle
I copied the oracle array from oracle.php to the database.php config file and the issue has gone away.
Contents of my oracle.php file:
return [
'oracle' => [
'driver' => 'oracle',
'tns' => env('DB_TNS', ''),
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '1521'),
'database' => env('DB_DATABASE', ''),
'username' => env('DB_USERNAME', ''),
'password' => env('DB_PASSWORD', ''),
'charset' => env('DB_CHARSET', 'AL32UTF8'),
'prefix' => env('DB_PREFIX', ''),
],
];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With