Currently, php_oci8.dll is generally used for PHP and Oracle connections.
However, when I wrote the PHP code debugging, I encountered a strange problem, that is, only the data can be successfully obtained for the first time after each boot, but I did not try it any more and gave an error message directly.Warning: ociexecute () [function. ociexecute]: OCIStmtExecute: ORA-24324: service handle not initialized. The PHP code at that time was as follows (this code obtained data from Oracle and generated a form ):
$ OraUser = "VISITOR ";
$ Oracle ass = "123456 ";
$ OraDB = "company ";
$ Conn =OCILogon($ OraUser, $ oraPass, $ oraDB );
If (! $ Conn ){
Exit;
}
$ Stmt = OCIParse ($ conn, "select * from visitor. employee ");
If (! $ Stmt ){
Exit;
}
OciExecute ($ stmt );
Echo "<table width = 75% border = '1' cellspacing = '0' cellpadding = '1'> \ n ";
Echo "<br/> <tr> \ n <td> name </td> <td> gender </td> <td> employee ID </td> <td> salary </td> <td> Department </td> <td> Date of Birth </td> <td> company Date of entry </td> \ n </tr> \ n";
While ($ row = oci_fetch_array ($ stmt, OCI_ASSOC + OCI_RETURN_NULLS )){
Echo "<tr> \ n ";
Foreach ($ row as $ item ){
Echo "<td>". ($ item! = Null? Htmlentities ($ item, ENT_QUOTES): "& nbsp;"). "</td> \ n ";
}
Echo "</tr> \ n ";
}
Echo "</table> \ n ";
OCIFreeStatement ($ stmt );
OCILogoff ($ conn );
After reading the materials, someone found a bug in PHP5 in an inconspicuous place in an English forum,Replacing the OCILogon function with oci_new_connect can solve the problem..
At that time, it was okay.
When I did everything and apache was split, I found that some PHP Web pages missed OCILogoff after I used the database, that is, the connection was not released. I guess this is the crux of the problem, because all these PHP files are connected to the same account, resulting in conflicts, andOci_new_connectCreating a connection clearly avoids this problem.
So, I think,If all web pages are safely released after the connection is used, the above problems should be avoided.. However, I have no chance to verify it. If a comrade encounters such a problem, try it.