Windows XP Pro v2002 SP2
Apache 2.2.4
MySQL 5.0.37-community-nt
MySQL Client 5.1.11
PHP 5.2.1
Before you tell me to google the solution to this, I already did. The problem is widespread and pervasive in the WAMP community and seems to have many different causes, each of which requires a different solution. I have tried a number of solutions, such as disabling Win32 AcceptEx, MMAP, & Sendfile, and installing different versions of PHP and the php_pdo_mysql.dll driver. Nothing seems to work. Further, the PHP developers generally seem too quick to dismiss this bug as bogus or unreproduceable in the numerous bug reports I've viewed.
The problem:
My login script has recently started crashing and restarting Apache. The error log says (you've probably seen this before - everyone else apparently has):
[Fri Apr 27 12:16:43 2007] [notice] Parent: child process exited with status 3221225477 -- Restarting.
[Fri Apr 27 12:16:44 2007] [notice] Apache/2.2.4 (Win32) PHP/5.2.1 configured -- resuming normal operations
[Fri Apr 27 12:16:44 2007] [notice] Server built: Jan 9 2007 23:17:20
[Fri Apr 27 12:16:44 2007] [notice] Parent: Created child process 2384
[Fri Apr 27 12:16:44 2007] [notice] Child 2384: Child process is running
[Fri Apr 27 12:16:44 2007] [notice] Child 2384: Acquired the start mutex.
[Fri Apr 27 12:16:44 2007] [notice] Child 2384: Starting 250 worker threads.
[Fri Apr 27 12:16:44 2007] [notice] Child 2384: Starting thread to listen on port 80.
The Windows popup error message yields the following:
szAppName: httpd.exe
szAppVer: 2.2.4.0
szModName: php_pdo_mysql.dll
szModVer: 5.2.1.1
offset : 000024ba
and generously offers to schlep these files off to Microsoft:
C:\DOCUME~1\CECILP~1\LOCALS~1\Temp\WER2a69.dir00\httpd.exe.mdmp
C:\DOCUME~1\CECILP~1\LOCALS~1\Temp\WER2a69.dir00\appcompat.txt
Here's the relevant portion of the script. The login function excerpted here is a class method. The other database-intensive methods of said class work fine, so I'll not cloud the issue by presenting the full class declaration. $Database is declared in my main script as follows:
The login function, to which $Database is passed as a reference:PHP Code:try {
$Database = new PDO('mysql:host=localhost;dbname=database','username','password',array(PDO::ATTR_PERSISTENT => true));
$Database->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION);
}
catch(PDOException $e) {
die($e->getMessage());
}
The member table structure:PHP Code:public function login($username,$password,&$db) {
try {
$query = $db->prepare("SELECT count(*) FROM member WHERE username=?");
$query->bindParam(1,$username);
$query->execute();
$result = $query->fetch(PDO::FETCH_ASSOC);
$count = $result['count(*)'];
}
catch (PDOException $e) {
$this->error = "Error: Session::login failed. " . $e->getMessage();
return false;
}
if ($count == 0) {
$this->error = "Error: Unknown nickname.";
return false;
}
try {
$query = $db->prepare("SELECT id,password,is_active,is_admin,is_mod,joined,last_login FROM member WHERE username=? LIMIT 1");
$query->bindParam(1,$username);
$query->execute();
$result = $query->fetch(PDO::FETCH_ASSOC);
$user_id = $result['id'];
$is_admin = ($result['is_admin'] == "Y");
$is_mod = ($result['is_mod'] == "Y");
$joined = $result['joined'];
$last_login = $result['last_login'];
$login_time = mktime();
$stored_pwd = $result['password'];
$acct_active = ($result['is_active'] == 'Y');
}
catch (PDOException $e) {
$this->error = "Error: Session::login failed. " . $e->getMessage();
return false;
}
if ($password != $stored_pwd) {
$this->error = "Error: Incorrect password.";
return false;
}
if (!$acct_active) {
$this->error = "Error: Inactive account.";
return false;
}
try {
$query = $db->prepare("UPDATE member SET last_login=? WHERE id=?");
$query->bindParam(1,$login_time);
$query->bindParam(2,$user_id);
$query->execute();
}
catch (PDOException $e) {
$this->error = "Error: Session::login failed. " . $e->getMessage();
return false;
}
if (($aff_rows = $query->rowCount()) === 0) {
$this->error = "Error: No rows affected updating member in Session::login.";
return false;
}
$this->set('logged_in',true);
$this->set('user_id',$user_id);
$this->set('username',$username);
$this->set('login_time',$login_time);
$this->set('is_admin',$is_admin);
$this->set('is_mod',$is_mod);
$this->set('last_login',$last_login);
$this->error = false;
return true;
} // end function login
CREATE TABLE `member` (
`id` int(11) unsigned NOT NULL auto_increment,
`username` varchar(24) NOT NULL,
`password` varchar(32) NOT NULL,
`email` varchar(255) NOT NULL,
`is_active` enum('Y','N') NOT NULL default 'N',
`is_admin` enum('Y','N') NOT NULL default 'N',
`is_mod` enum('Y','N') NOT NULL default 'N',
`joined` int(11) unsigned NOT NULL,
`last_login` int(11) unsigned NOT NULL default '0',
PRIMARY KEY (`id`),
UNIQUE KEY `USERNAME` (`username`),
UNIQUE KEY `email` (`email`)
) ENGINE=MyISAM AUTO_INCREMENT=9 DEFAULT CHARSET=latin1;
I have been seeking a solution for two days and am almost ready to abandon PDO and rewrite the whole application using the old MySQL extension. Any help would be greatly appreciated.






Bookmarks