ID: 21928
User updated by: [EMAIL PROTECTED]
Reported By: [EMAIL PROTECTED]
-Status: Feedback
+Status: Open
Bug Type: ODBC related
Operating System: Win2k server
PHP Version: 4.3.0
New Comment:
One smart comment deserves another.
I figured out the bug, and I can reproduce, and I know how to get
around it, and the bug is in PHP.
1. The code string "$dbh = odbc_connect(); // yes I know it will
fail" was given to me to run by [EMAIL PROTECTED] Look down in the
post and you will see this. I only tried to follow his directions. So
keep your cracks to yourself until you read the whole post.
2. It is a SYSTEM DSN. I have created a MILLION DSNs in my lifetime,
and it is a SYSTEM DSN. I even tried it as a user DSN and it wouldn't
work. SYSTEM SYSTEM SYSTEMSYSTEM SYSTEM SYSTEMSYSTEM SYSTEM
SYSTEMSYSTEM SYSTEM SYSTEMSYSTEM SYSTEM SYSTEMSYSTEM SYSTEM
SYSTEMSYSTEM SYSTEM SYSTEMSYSTEM SYSTEM SYSTEMSYSTEM SYSTEM
SYSTEMSYSTEM SYSTEM SYSTEMSYSTEM SYSTEM SYSTEMSYSTEM SYSTEM
SYSTEMSYSTEM SYSTEM SYSTEM
3. Again, if you had read the entire post, you would have seen that
this DSN points to a MS SQL server database.
4. I see where many others have had this same issue. The Bug support
group continues to deny it as a bug. I wrote as many as I could and
asked if they had found a resolution. Everyone that wrote back said
they had not, and had given up. If they write me, I will walk them
through the work-around.
5. If you had not been such a smart $%&@, and I might have helped
everyone out by posting the details here on the real problem.
6. Am I stressed out? Maybe..... I spent the last 2 days having
everybody keep telling me that I configured a USER DSN when I did not
and having me run test scripts that would obviously fail.
7. SYSTEM DSN SYSTEM DSN SYSTEM DSN
Previous Comments:
------------------------------------------------------------------------
[2003-01-29 16:49:34] [EMAIL PROTECTED]
Um.... you issue an odbc_connect() call that you know will fail, then
try to pass the result (which is === FALSE by the way) to commands
which expect a valid resource and you're somehow SURPRISED by the
results you got?
Ignoring that walking contradiction for the moment....
The fact that it's happening on IIS only (and not command line)
suggests one of three posssible explanations:
(A) It's a User DSN created by your user account (hence visible to you
on the command line but not to the webserver who is running as
IUSER_GUEST or whatever) (yes I know you said it was system, but
please, check again as this is the most likely answer) Just for
giggles, try logging in as another user (non-administrator though) and
trying that sample script I provided earlier on the command line.
(B) There are one or more files (odbc.dlls) which are
unreadable/unexecutable by the IIS user (not terribly common, but at
least possible -- are you in the administrator group?)
(C) You're connecting to an ODBC datasource which requires built in NT
authentication (such as MSSQL) and you have no IUSR_GUEST account on
the SQL server which is somehow throwing an incorrect error message.
(highly bloody unlikely)
------------------------------------------------------------------------
[2003-01-29 12:23:53] [EMAIL PROTECTED]
This is what I ran from IIS
<?
$dbh = odbc_connect(); // yes I know it will fail
$res = odbc_data_source($dbh, SQL_FETCH_FIRST);
echo $res;
$res = odbc_data_source($dbh, SQL_FETCH_NEXT);
echo $res;
?>
These are the results.
Warning: Wrong parameter count for odbc_connect() in
c:\inetpub\wwwroot\survey\test.php on line 3
Warning: odbc_data_source(): supplied argument is not a valid ODBC-Link
resource in c:\inetpub\wwwroot\survey\test.php on line 4
Warning: odbc_data_source(): supplied argument is not a valid ODBC-Link
resource in c:\inetpub\wwwroot\survey\test.php on line 6
------------------------------------------------------------------------
[2003-01-29 07:19:09] [EMAIL PROTECTED]
kept as feedback until testing done...
------------------------------------------------------------------------
[2003-01-29 00:29:25] [EMAIL PROTECTED]
BTW: I am running MDAC 2.7 SP1
------------------------------------------------------------------------
[2003-01-29 00:27:09] [EMAIL PROTECTED]
I'll run your test in the morning. It might be notable that I can run
my script from the command line and have no problems connecting to the
ODBC DSN. But when I run it through IIS, it fails. I ran this same
script on my local win2k pro desktop and it works fine. This is only
happening on my win2k server. I searched the net and see lots of
people with this same issue, but cannot find a single one that has a
resolution.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/21928
--
Edit this bug report at http://bugs.php.net/?id=21928&edit=1