PHP4 for Windows2000 and MS SQL Server 7 (some tests and possible bugs)
| From: | Andre Couto | Date: | Sat, 24 Jun 2000 20:59:20 +0000 |
| Subject: | PHP4 for Windows2000 and MS SQL Server 7 (some tests and possible bugs) | ||
| Groups: | php.db php.dev php.windows | ||
| Request: | Send a blank email to php-db+get-607@lists.php.net to get a copy of this message | ||
Hi!
I've make some tests and I think that there are some bugs mainly at
the ISAPI version of php for Windows.
I'm using Windows 2000 Server with Microsoft SQL Server 7 and with
Oracle 8. Also IIS 5 and PHP4.
So, I was looking for support on Windows and I discover that the
PHP Group don't support Win32 binaries (only a few of them) and that I
have two options:
1- Compile the extensions with VC5 or VC6
2- Take the binaries from swwwing.com
Well. I don't have VC5 or VC6. So I am trying to use swwwing.com
binaries. (Thanks to Frank for the support)
How is my installation:
At the moment: I have downloaded the core files (php.exe, php4isapi.dll,
php4nts.dll, php4ts.dll, phpts.exe) and all the modules of version 4
from swwwing.com
I have renamed php.ini-dist to php.ini. I didn't make any changes at this
file. And I have copied all the core files and the modules to
c:\winnt\system32.
First Test
----------
I've tried to use the ISAPI DLL. It works fine if I didn't include any
extension DLL to it. (Well, I only test the extensions php_mssql70.dll and
php_oci8.dll). So I have configured the IIS to execute php4isapi.dll and
I have changed the php.ini to load the extension=php_mssql70.dll
I have also written a little test code:
----------------------------------------------------------------
<?php
//dl ("php_mssql70.dll");
$dbconn=mssql_connect("STRANGER","db_user","teste");
if (!$dbconn) die("error1");
var_dump($dbconn);
echo "<BR>";
$ret=mssql_select_db("generauction",$dbconn);
if (!$ret) die ("error2");
var_dump($ret);
echo "<BR>";
//exit
$cursor=mssql_query("SELECT * FROM status",$dbconn);
var_dump($cursor);
echo "<BR>";
if (!$cursor) die ("error3");
//exit
$array=mssql_fetch_row($cursor);
var_dump($array);
echo "<BR>";
echo $array[0]."-".$array[1];
mssql_close($dbconn);
?>
-----------------------------------------------------------------
Note that at this test I'm loading mssql extension at the php.ini and
that the dl line is commented.
Another important informations is the status table:
STATUS
Field Data Type
-------- ----------
stacod tinyint
stades varchar(20)
What is the result of the code???? (at the browser)
First Time:
resource(1) of type 2
bool(true)
resource(2) of type 1
array(2) { [0]=> string(1) "1" [1]=> string(5) "teste" }
1-teste
After Reload:
resource(1) of type 2
bool(true)
PHP has encountered an Access Violation at 00000000
After Another Reload:
resource(1) of type 2
bool(true)
resource(2) of type 1
array(2) { [0]=> string(1) "1" [1]=> string(5) "teste" }
1-teste
After another:
resource(1) of type 2
bool(true)
PHP has encountered an Access Violation at 00000000
... I did that really a lot!! And it always like that. One time it works
and the next time doesn't work. So, the error is NOT randomic.
And if you pay attention you can see another error. The Field stacod in table
STATUS is tinyint. It's not a string. And for the PHP it is a STRING.
SECOND TEST:
------------
The only change from the first test is that I have uncommented the first line
with "exit". So now the code only executes the mssql_connect() and the
mssql_select_db() functions. The query function is OUT.
What is the result???
resource(1) of type 2
bool(true)
It's always that. So, no errors here.
THIRD TEST:
-----------
I have used the same code. And I have commented the "exit" line again. The only
change now was in the SELECT clause at the query function. Instead of use the
status table I've used the client table. The difference is that the client table
was completely EMPTY.
What is the result???
resource(1) of type 2
bool(true)
resource(2) of type 1
bool(false)
-
And It's always like that. No errors here again!
I did that test with other tables. And the results was always like that. If a table
has data. The Access Violation occurs, if it is empty, no errors!
4TH TEST:
------------
Instead of loading the php_mssql70.dll from the php.ini file. I started to load it
from the code. So I have uncommented the line dl (php_mssql70.dll) from the code.
The test is again with the status table.
What is the result?
First Time:
resource(1) of type 16
bool(true)
resource(2) of type 15
array(2) { [0]=> int(1) [1]=> string(5) "teste" }
1-teste
After the reload:
resource(1) of type 19
bool(true)
resource(2) of type 18
array(2) { [0]=> int(1) [1]=> string(5) "teste" }
1-teste
Anther:
resource(1) of type 22
bool(true)
resource(2) of type 21
array(2) { [0]=> string(1) "1" [1]=> string(5) "teste" }
1-teste
Another:
resource(1) of type 25
bool(true)
resource(2) of type 24
array(2) { [0]=> int(1) [1]=> string(5) "teste" }
1-teste
Another:
resource(1) of type 28
bool(true)
resource(2) of type 27
array(2) { [0]=> int(1) [1]=> string(5) "teste" }
1-teste
Another:
resource(1) of type 31
bool(true)
resource(2) of type 30
array(2) { [0]=> string(1) "1" [1]=> string(5) "teste" }
1-teste
...And after a lot of reloads:
resource(1) of type 2116
bool(true)
resource(2) of type 2115
array(2) { [0]=> string(1) "1" [1]=> string(5) "teste" }
1-teste
...I stopped here.
Two VERY STRANGES things is happening here. The first of them is that the php
seems to be alocating a lot of resources. At the others teste this was not
ocurring.
And the other error is that sometimes the stacod fiels is integer and the others
is string!!!! Why????!!!
5TH TEST:
-----------
Now I have stopped to use the ISAPI DLL and started to use the phpts.exe the CGI
version from swwwing.com.
One note about that: I have to put the php.ini file in c:\winnt directory. The
others core files and modules was in c:\winnt\system32 and the ISAPI DLL have
read the php.ini file in the same directory but the phpts.exe only found it on
c:\winnt.
Well, after this little problem...
I have configured the php.ini to load the extension php_mssql70.dll. And I have
commented the line dl(php_mssql70.dll) in my code. And also configured the IIS to
execute the phpts.exe
What was the result???
resource(1) of type 2
bool(true)
resource(2) of type 1
array(2) { [0]=> string(1) "1" [1]=> string(5) "teste" }
1-teste
And it was always like that. Is was similar with the first test but now with no
Access Violation anymore.
But the error with the data type of the field stacod is happening again...
The stacod is not a string.
6TH TEST:
---------
At this step I stoped to load the mssql extension from the php.ini file and started
to load it from my code with the line dl(php_mssql70.dll). That's the only change.
What was the result:
resource(1) of type 16
bool(true)
resource(2) of type 15
array(2) { [0]=> int(1) [1]=> string(5) "teste" }
1-teste
And it was always like that after the reloads...
With this configuration, at this test, no errors were found.
----------------------------
Conclusion:
The best configuration appears to be currently to load the php CGI version (phpts.exe
from swwwing.com) and to load the extension at the code instead of using php.ini.
----------------------------
And the others configurations? What is happening? I don't know. But is appearing to bee bugs.