ID:               8434
 Updated by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
 Status:           Duplicate
 Bug Type:         IIS related
 Operating System: Win 2K Server
 PHP Version:      4.0.4
 New Comment:

we're having nearly the same problem in our company. we're using iis 4
with nt, not 2k... shortly after a reboot the whole iis crashes (sort
of). we are using asp and php in different webs. asp is down if the iis
crashes. after deactivating mysql the server will work again... that's
what we've encountered here today. i would be glad if someone could
mail me some more information regarding this ACCESS VIOLATION topic...


Previous Comments:
------------------------------------------------------------------------

[2001-04-16 06:33:56] [EMAIL PROTECTED]

ANother Access violation in IIS bug.

-James

------------------------------------------------------------------------

[2001-01-08 10:05:52] [EMAIL PROTECTED]

Well, that _is_ a good question: I have absolutely no idea which
instruction causes the problem !

As said in my report, the error can appear on any of my 30+ scripts on
the site. The error does not have a preference for any of the scripts
either. It just appears _randomly_ on any of the scripts at a random
time and at random frequency. I sometimes have the error 2 to 5 times a
day, and sometimes it will not appear for 2 days at all. I know that
doesn't help you much, but that's about as precise as I can be.

That's why I gave you all the information necessary to rebuild an exact
copy of 1 of my scripts and see _if_ you get the error at all. It will
be necessary though that you test it on the same platform as I run it:
Win 2K Server with IIS 5.0 and PHP-4.0.4 as ISAPI (php4isapi.dll). The
database runs on a separate server (Win NT4 Server SP6).

Hope you find a clue where to start looking (as a novice, I'd say in
the .DLL). If you need any further information, do not hesitate !


Greetings,

Steven

------------------------------------------------------------------------

[2001-01-08 08:59:28] [EMAIL PROTECTED]

can you please cut down the code to the min. needed to reproduce it?

------------------------------------------------------------------------

[2000-12-27 07:27:56] [EMAIL PROTECTED]

Still having same bug in PHP-4.0.4 Win ISAPI module...
Randomly showing error "PHP has encountered an Access Violation at
01292466" (the number changes every time the error occurs) upon call to
PHP ISAPI engin. The error can occur on any of my 30+ scripts on this
site.

This problem persists since at least 3.0.3pl1. When will this nightmare
be over ?? I have to switch back to a CGI environment, which slows down
PHP execution far too much...

Restarting IISAdmin does get the engine running properly again... until
the next "Access Violation"...

Almost all of the bug reports concerning this error have not even been
assigned to anyone. Does this mean you're not going to try to get rid
of this problem ?

If you have any questions regarding the script below, do not hesitate
to contact me!

All in all: thanks for bringing us PHP and keep up the good work !

Steven VAN POECK

One piece of code on which the error occurs:
--------------------------------------------
include( "common.php" );

// Call session (if any)
session_save_path("tmp");
session_start();
// Empty basket
$sql = "DELETE FROM panier WHERE client_id='$user'";
mysql_pconnect( $db_host, $db_user, $db_pass );
$result = mysql_db_query( $db_dag, $sql );
check_error( $result );

// Set user state to "D" (deconnected)
$sql = "UPDATE client SET state='D' WHERE id='$user'";
mysql_pconnect( $db_host, $db_user, $db_pass );
$result = mysql_db_query( $db_dag, $sql );
check_error( $result );

// destroy session (if any)
session_destroy();

// Get highest client ID
$sql = "SELECT MAX(id) AS max_id FROM client";
mysql_pconnect( $db_host, $db_user, $db_pass );
$result = mysql_db_query( $db_dag, $sql );
check_error( $result );
$data = mysql_fetch_object( $result );
$last_client = $data->max_id;
// Define new client ID
if( substr($last_client, 1) < 50000000 ){
        $numero_client = P50000101;     /* For very first client */
}else{
        $numero_client = "P".(substr($last_client, 1) + 1);
}
// Get password of the day
$today = date("Y-m-d", time());
$mdp = create_pass();
// Define timestamp for expiration time
$exp_time = time()+1800;

$sql = "INSERT INTO client VALUES( '$numero_client', PASSWORD('$mdp'),
'$today', '$today', '0', 'DP', '$exp_time', 'C')";
mysql_pconnect( $db_host, $db_user, $db_pass );
$result = mysql_db_query( $db_dag, $sql );
check_error( $result );

// Initialise session
session_save_path( "tmp" );
session_register("user");
$user = $numero_client;
session_register("key");
$key = $mdp;
session_register("type");
$type = "p_";
session_register( "cadeau_1" );
$cadeau_1 = 0;
// Send user to the site
header(
"Location:/pcgi/display_rubr.php?".SID."&rubr=".urlencode(${$type."rubr_def"})
);
-------------------------------------------------------
The function "create_pass()":
-------------------------------------------------------
function create_pass(){
global $db_host, $db_user, $db_pass, $db_adm;
$alpha = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k',
'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
'w', 'x', 'y', 'z');
$n = 0;
$flag = 0;
// Select all passwords
$today = date("Y-m-d", time());
$sql = "SELECT * FROM mdp_jour";
mysql_pconnect( $db_host, $db_user, $db_pass );
$result = mysql_db_query( $db_adm, $sql );
while( $data = mysql_fetch_object( $result ) ){
  // Verify if today's password already exists          
  // If so, use that one
  if( date("Y-m-d", time()) == $data->date ){
        $pass = $data->mdp;
        $flag = 1;
  }
}
if( $flag != 1){
// No password for today yet
// So have to make one
        while( $n < 4 ){
        reset( $alpha );
        mt_srand((double)microtime()*1000000);
        $pass = mt_rand(0, 25);
        $password .= $alpha[$pass];
        $n++;
        }
        // Select all passwords
        $sql = "SELECT * FROM mdp_jour";
        mysql_pconnect( $db_host, $db_user, $db_pass );
        $result = mysql_db_query( $db_adm, $sql );
        while( $data = mysql_fetch_object( $result ) ){
                // Verify if created password already exists
                // If so, recreate another password
                if( eregi( $data->mdp, $password ) ){
                        create_pass();
                }
        }
        // If not, generated password is unique. Write to DB
        if( $flag == 0 ){
                $pass = $password;
                $sql = "INSERT INTO mdp_jour VALUES('', '$today', '$password')";
                mysql_pconnect( $db_host, $db_user, $db_pass );
                $result = mysql_db_query( $db_adm, $sql );
                check_error( $result );
        }
}
return $pass;
}
----------------------------------------------------------

You'll need 2 databases:
DB1 ($db_dag in the script):
------- Table "panier":
Field   Type    Null    Key     Default Extra   Privileges
id      int(11) unsigned
zerofill                PRI             auto_increment  
select,insert,update,references
client_id       varchar(10)                     0               
select,insert,update,references
produit_ref     varchar(50)                                     
select,insert,update,references
produit_prix_ttc        float(5,2)
unsigned                        0               select,insert,update,references
prix_gift       enum('1','0')                   1               
select,insert,update,references
produit_n       int(3) unsigned                 0               
select,insert,update,references
expire  int(13)                 0               select,insert,update,references

-------- Table "client":
Field   Type    Null    Key     Default Extra   Privileges
id      varchar(10)             PRI                     
select,insert,update,references
pass    varchar(255)                                    
select,insert,update,references
crea    date                    0000-00-00              
select,insert,update,references
mod     date                    0000-00-00              
select,insert,update,references
visits  int(5) unsigned
zerofill                MUL     0               select,insert,update,references
type    enum('DP','DAG')                        DP              
select,insert,update,references
expire  int(13)                 0               select,insert,update,references
state   enum('C','D')                   D               
select,insert,update,references

DB2 ($db_adm in the script):
------- Table "mdp_jour":
Field   Type    Null    Key     Default Extra   Privileges
id      int(5) unsigned zerofill                        0               
select,insert,update,references
date    date                    0000-00-00              
select,insert,update,references
mdp     char(5)                                 select,insert,update,references


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=8434&edit=1

Reply via email to