Problem with PHP OCI extension and Oracle connection


Recently I had a serious problem with PHP OCI extension and Oracle. I have written many applications running from the same box and connection to the same Oracle database and all of them was working fine excepting this one.

The connection work successfully, but when the scripts execture the query it fails and return this warning :

Warning: ociexecute(): OCIStmtExecute: ORA-03114: not connected to ORACLE in /usr/local/apache/htdocs/script.php on line 152

There was no high load on the Oracle server, and the problem is that the same code sometimes work and sometimes not. In the Oracle manual I found that the error ORA-03114 mean that there was problem in connection between the two servers. The network have been tested, everything was perfect.

In the mean time I solved the problem by saving the failed queries in a mysql database, and with a cron check every 5 minutes to run again these queries. But I don’t think it could solve the problem in the long time.