Re: PHP has encountered an Access Violation at 73342FC3.
| From: | Matthew Beers | Date: | Thu, 07 Sep 2000 18:54:34 +0000 |
| Subject: | Re: PHP has encountered an Access Violation at 73342FC3. | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-2707@lists.php.net to get a copy of this message | ||
Most of the time an Access Violation is caused by the program trying to access
uninitialized memory, or bad pointers. The number usually refers to the address
of the instruction where the program crashed. The question is whether you have
discovered another instance where this happens or if it is a known issue. There
are two ways (there may be more) that I know of to cause php/mssql to blow up:
1) not explicitly specifying a link identifier to mssql_close()
sample code:
mssql_connect($SERVER, $USER, $PASS);
$res = mssql_query($sql);
mssql_close();
This will cause an access violation. With this you just need to use
explicitly use a link identifier.
2) Using mssql_fetch_row in a nested while loop
sample code:
$link = mssql_connect($SERVER, $USER, $PASS);
$res1 = mssql_query($sql, $link);
while ($rs = mssql_fetch_row($res1) {
$res2 = mssql_query($sql2, $link);
while ($rs2 = mssql_fetch_row($res2)) {
//do something
}
}
mssql_close($link);
This code will cause an access violation, and even better, will most likely
crash IIS. However, it only causes violations when the web server and the sql
server are on different machines. Interestingly enough, this case does not
occur if you use mssql_fetch_array(). It has something to do with the
creation of the hash and its initialization when using names and not only the
field index.
Do you have a short script which duplicates the problem for us to look at? And
have you tried running php from the command line to see if the problem continues
to happen (as suggested by Michael Rudel)? You can do this by running
php -f <name of the script>
Good luck,
Matt