I also goy the ORA-1245 error using ora_logon, but setting the ORACLE_HOME var so it showed up in both the Apache Environment and Environment sections in phpinfo didn't help the situation. The full error was "Warning: Oracle: Connection Failed: ORA-12545: Connect failed because target host or object does not exist in /path/to/script on line xx." Turns out I had the oracle client installed (which is required) and I had the environment correct (which is required), but I didn't have a local tnsnames.ora file setup, so the connection couldn't find the correct binaries to connect to oracle. Creating the tnsnames.ora file on the local server (db server is remote) and using the proper syntax of "ora_logon("user@tnsentry", "password");" worked for me. Note: ORACLE_HOME and ORACLE_SID were set in the script using putenv.