#47283 [Fbk->Opn]: mysql_connect call crashes web server
ID: 47283
User updated by: darren at misterdoom dot com
Reported By: darren at misterdoom dot com
-Status: Feedback
+Status: Open
Bug Type: MySQL related
Operating System: win32 only - Vista Home Premium
PHP Version: 5.2.8
New Comment:
Yes, I am running MySql 5.1.11.
I have un-installed PHP 5.2.8 as I needed to continue working on my web
site. I now have PHP 5.2.5 installed, and the problem does not occur.
Previous Comments:
------------------------------------------------------------------------
[2009-02-06 13:46:53] pajoye@php.net
And you have installed mysql 5.1 right?
------------------------------------------------------------------------
[2009-02-06 13:25:57] kalle@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read
http://bugs.php.net/bugs-generating-backtrace.php
for *NIX and
http://bugs.php.net/bugs-generating-backtrace-win32.php
for Win32
Once you have generated a backtrace, please submit it to this bug
report and change the status back to "Open". Thank you for helping
us make PHP better.
------------------------------------------------------------------------
[2009-02-02 21:59:46] darren at misterdoom dot com
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 this bug report at http://bugs.php.net/?id=47283&edit=1
Thread (10 messages)