From: darren at misterdoom dot com
Operating system: Vista Home Premium
PHP version: 5.2.8
PHP Bug Type: *Web Server problem
Bug description: mysql_connect call crashes web server
Description:
------------
I have a really strange problem. I've recently re-installed my computer
and set up IIS7, PHP and MySQL so that I could carry on working on my
website.
I did a quick test with phpinfo(); and everything seemed to be working
fine. Then set up 2 blank documents and started working on opening a
connection to a database, which is when all the trouble started. On viewing
the page, I would get the following message "PHP has encountered an Access
Violation at 01FCAC5A" and windows would also produce an error message
stating that IIS had been stopped. If I comment out the mysql_connect line
it worked fine.
I read some things about a possible problem with the php5isapi.dll, so I
installed Apache 2.2.1.1 web server, set up PHP, but got exactly the same
result.
Reproduce code:
---------------
file 1 (index.php)
<?php
require("farq.php");
?>
<html>
<head>
<title>Site Administration</title>
<?php
// If cookie, redirect
?>
</head>
<body>
<!-- If no cookie, show form. -->
<form action="index.php" method="post">
<input name="username" maxlength="255">
<input name="password" maxlength="255">
<input type="submit">
</form>
</body>
</html>
File 2 (farq.php)
<?php
$conn = mysql_connect('localhost', 'dbuser', 'dbpass') or die ('Error
connecting to mysql');
echo "conncected";
mysql_select_db("dbname", $conn) or die ("Could not select to main
database");
?>
Expected result:
----------------
I would expect to see connected followed by a form.
Actual result:
--------------
in the browser:
Internet Explorer cannot display the webpage
Windows also pops up the alert box:
Apache HTTP Server stopped working and was closed
If I comment out the line "$conn = mysql_connect('localhost', 'dbuser',
'dbpass') or die ('Error connecting to mysql');" The page displays
correctly.
--
Edit bug report at http://bugs.php.net/?id=47283&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=47283&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=47283&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=47283&r=trysnapshot60
Fixed in CVS:
http://bugs.php.net/fix.php?id=47283&r=fixedcvs
Fixed in CVS and need be documented:
http://bugs.php.net/fix.php?id=47283&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=47283&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=47283&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=47283&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=47283&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=47283&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=47283&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=47283&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=47283&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=47283&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=47283&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=47283&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=47283&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=47283&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=47283&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=47283&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=47283&r=mysqlcfg