|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #51342 Access Violation with MySQL comand
Submitted: 2010-03-21 12:30 UTC Modified: 2010-03-21 16:29 UTC
From: jon dot halling at bilnavet dot com Assigned:
Status: Not a bug Package: Reproducible crash
PHP Version: 5.2.13 OS: Win XP SP3
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: jon dot halling at bilnavet dot com
New email:
PHP Version: OS:


 [2010-03-21 12:30 UTC] jon dot halling at bilnavet dot com
I get the error message "PHP has encountered an Access Violation at [some address]" when I execute mysql_connect() in a php-file accessed by web browsers. Same result even if the MySQL-server is shut down.

Running Win XP SP3 and all the latest patches, and running Windows built in IIS webserver, has tested multiple browsers. The php.ini is standard except for extension php_mysql.dll activated. PHP installation dir is C:\Program\PHP\ and file is located in C:\Inetpub\wwwroot\work\db_test.php (http://localhost/work/db_test.php). Have checked that all files and folders have write access.

The same file accessed from command prompt is not experiencing any problems, so I have problem generating backtrace according to your instructions. Please instruct how I can gather more information if necessary.

Test script:
echo "BOO ";
$open = mysql_connect($host, $user, $pwd);
echo "FOO";

Expected result:

Actual result:
BOO PHP has encountered an Access Violation at 0183AC6A


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2010-03-21 13:59 UTC]
-Status: Open +Status: Bogus
 [2010-03-21 13:59 UTC]
Don't use libmysql from MySQL installation but the one we provide. See the countless reports here to find how to fix it (PATH).
 [2010-03-21 15:18 UTC] jon dot halling at bilnavet dot com
I already have added the dir to PATH according to instructions on (linked from

This is what my PATH looks like:
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program\QuickTime\QTSystem\;C:\Program\MySQL\Server\bin;C:\Program\PHP\ext;C:\Program\Delade filer\DivX Shared\;C:\Program\Delade filer\Acronis\SnapAPI\

The file php_mysql.dll in folder ext has version (all files are from the installation package, I have not changed anything).

Is there anything more I have to do? What have I missed? Please explain.
 [2010-03-21 15:23 UTC]
'C:\Program\MySQL\Server\bin;C:\Program\PHP\ext' is totally wrong.

You have to put C:\Program\PHP\ in your PATH, not the extension_dir. Then it is exactly what you should not do, having mysql dir first in your PATH.

 [2010-03-21 16:29 UTC] jon dot halling at bilnavet dot com
Got it working, thank you! Having /ext added to PATH was a mistake by me!

Some thoughts of mine though:
- If the order of PATH entries for PHP and MySQL is important that could be better documented. The documentation ( clearly states that the information shall be added to the end (placing it after MySQL entries if it already exists).
- The default extension dir in php.ini could be changed to
extension_dir = "./ext"
Since this corresponds with the file structure in the .zip installation file. This will make it work on first try rather then having to change it manually.

Thanks again for the support!
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Thu Apr 09 21:01:23 2020 UTC