ocilogon won't connect in PHP 5 but ok in PHP4

windows

Guest
I have an application that I'm converting from PHP4 to PHP5. In one of the scripts I am trying to connect to a remote Oracle database.

What I've noticed is that I can connect perfectly fine on a server running PHP4 and when I test the same script on a server running PHP5 I get an Oracle error of ORA-12541: TNS:no listener.

Both servers are running the same version of Mac OS X Server. The only difference is the PHP version running. I've read the description of ocilogon for PHP5 and it says that ocilogon is an alias for oci_connect. So tried oci_connect and I get the exact same error.

Beyond the difference of the version of PHP I'm running, I can't seem to figure out what might be the problem.

Is there something different with PHP4 and PHP5 oci8 extension?

Any tips to documentation that I can follow through with?

rmbHave you done a phpinfo() on both servers to make sure the information in the OCI table on the PHP5 server matches the information listen on the PHP4 server?Also, note that PHP 5 has a bunch of new oci8-relevant php.ini settings that need to be at least checked and possibly fiddled with.Are absolutely all other things exactly the same?

I assume you are talking about on the same machine. Is ORA_HOME set to the same place? Is the contents of your tnsnames.ora exactly the same in both cases?

Are both versions of PHP linked against the exact same OCI library?

Of course I am assuming that you can connect to the databasewith the normal oracle command line tools (e.g. with sqlplus) ?

MarkI checked the phpinfo on both machines and both are set the same way. The only difference that I clearly know of is that with PHP 5 installer that I used I did not need to manually configure to include the oci extension since this was done for me by the installer.

With the PHP 4 installation, I had to install the oci modules and change the php.ini file to change the directory path for the loadable extensions. I had to do this because the PHP 4 installer does not include the oci module.

Both 4 and 5 clearly show both oci8 extensions loaded.

In regards to the tsnnames.ora file, I don't use one since I connect with the server with the sample code:

$ora_db = "(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = $ora_db_host)(PORT = $ora_db_port))(CONNECT_DATA = (SID = $ora_db_sid)))";

$c = oci_connect($ora_db_user, $ora_db_pswd, $ora_db);

I'm not too familar with Oracle databases but is there any logs that I can check that can tell me if Oracle is getting my connection request?

Or is there anything in PHP besides printing the ocierror() to view any error codes?You should ensure that you can connect to the database from both machines, with the same settings, with the Oracle command line client (sqlplus).

If you are unable to do this, there is no chance of connecting with PHP.

Are you sure you've got the same version of the Oracle libraries installed in the same place, which is in the relevant paths and library paths, on both machines?

Name resolution might be an issue - do both machines have the same name resolution, DNS and hosts file settings?

Setting error_reporting(E_ALL) is always a good idea; PHP will probably show some more error messages if you do this (ocierror() might give the same info).

MarkHmmm... Its a wild guest but
php5 i do oci_connect
php4 ocilogon
<!-- m --><a class="postlink" href="Http://www.wolfpac.net">Http://www.wolfpac.net</a><!-- m -->
Thanks
 
Back
Top