ID: 5814 User Update by: [EMAIL PROTECTED] Status: Closed Bug Type: ODBC related Operating system: NT4 SP6a PHP Version: 4.0.1pl2 Description: ODBC connection to Oracle fails Hi, again! I have examined the problem further, and the solution is: When using the CGI-mode of PHP, the TNSNAMES.ORA and SQLNET.ORA must NOT contain DOS/WINDOWS CR/LF, but only UNIX LFs. In the ISAPI mode, this does not matter at all. Frank Previous Comments: --------------------------------------------------------------------------- [2001-01-12 05:15:45] [EMAIL PROTECTED] After changing the server OS to Windows 2000 SP1, using IIS 5.0 instead of Apache and PHP 4.0.3, the error did not occur any more. However, we did not examine exactly what did solve the problem, the new OS, the IIS or the new PHP version. When I have time, I will examine this further, at the moment, I am just glad to have a working solution. Thanks! --------------------------------------------------------------------------- [2001-01-11 17:09:33] [EMAIL PROTECTED] did you encounter this bug in later (preferrably 4.0.4) versions of PHP? --------------------------------------------------------------------------- [2000-07-28 21:38:16] [EMAIL PROTECTED] Just an addition: The same bug occurs using Windows98 and Apache Web Server. The connection to Oracle via ODBC works with php3 and other ODBC-clients and fails with php4, where TNS cannot resolve the Oracle alias. Regards, Frank --------------------------------------------------------------------------- [2000-07-28 16:09:21] [EMAIL PROTECTED] This is the c function that works, and it shows no big difference to the odbc_sqlconnect function used by php4: void myodbcconnect() { int rc; SQLHANDLE henv,hdbc; SQLAllocEnv(&henv); SQLAllocConnect(henv, &hdbc); rc = SQLConnect(hdbc,(unsigned char*)dsn,strlen(dsn),(unsigned char*)uid,strlen(uid),(unsigned char*)pwd,strlen(pwd)); if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { MessageBox(hWnd,"","Fehler",IDOK); SQLFreeConnect(hdbc); } else MessageBox(hWnd,"OK","",IDOK); } --------------------------------------------------------------------------- [2000-07-28 14:06:42] [EMAIL PROTECTED] No, both php3 and php4 run as CGI, and with the same user. Also, everyone has full access to the tnsnames.ora. I have configured Apache the way that scripts ending with .php4 are executed by php4 and scripts ending with .php3 by php3. A script, run as "test.php4" fails, the same run as "test.php3" succeeds. Everything runs as CGI, not as Apache module. I have written a small test-program with C, and there the connection using SQLConnect works, as well as with php3. Somehow, in php4 the same function call (SQLConnect) returns SQL_ERROR. In php3 and my test-program, SQLConnect finds the missing parameters DBQ and ASY from the ODBC-driver and can resolve the DBQ setting, in php4 it also finds the DBQ and ASY parameters, but cannot resolve the DBQ, though there is no obvious difference in the environment (same users, same machine, same browser). Anyhow, the php_odbc.c source does not show me any hint why this behaviour occurs, and it appears to be a different environment, but then the same occurs on different machines. Always, php3 works, php4 does not work, other ODBC-clients work. One idea is: in php3, the SQLConnect runs from the exe, in php4 from a dll (even in the CGI-version), and the TNS-resolution does not work there? That's the only difference I have found so far. If i Find more, I'll update this report. Best regards, Frank --------------------------------------------------------------------------- The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online. Full Bug description available at: http://bugs.php.net/?id=5814 -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]