This content has been marked as final. Show 6 replies
Make sure ORACLE_HOME is set correctly and points to a valid ORACLE_HOME
Check the httpd.conf for PassEnv, SetEnv ( or ModifyEnv if you are using Oracle HTTP Server)
I have encountered the same problem too.
OCIHandleAlloc? OCI_HTYPE_SVCCTX: OCI_INVALID_HANDLE
However, after reading the FAQ titled "Setting Oracle environment variables prior to starting the web server", my problem was gone!!
Setting all Oracle environment variables before the web server starts is the only safe way to get PHP talking to Oracle. Setting the variables in PHP scripts or the httpd.conf file mostly does not work. "
So, add ORACLE_HOME, LD_LIBRARY_PATH environment in the same script with your Apache and it will work!
If you do not have access to change httpd.conf, or prefer not to, you can set these using PutEnv() in your PHP script. For example:
BTW, here's a quick document on doing basic tasks.
set these using PutEnv() in your PHP script.Please avoid doing this if possible. It may work in about 70% of
cases but for the other 30% of the time it causes odd errors because
Oracle may not get initialized correctly when Apache loads it. Your
scripts may even be running fine until you start calling a different
oci_ function and only then fail with odd Oracle messages. Errors
appear to be port, version and function specific.
 This even hit a core PHP developer recently when he was extending
P.S. the 70/30 split is a guess designed to frighten you to do the right thing.