PHP/MySQL Issue

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
MrNemo
Forum Newbie
Posts: 7
Joined: Sun Dec 14, 2008 11:41 am

PHP/MySQL Issue

Post by MrNemo »

I have the newest php(3.1.1) installed at c:\php with IIS running the web server. I have tested php and it is installed and running correctly showing me the contents of a phpinfo file. I have mysql installed to current default location at c:\program files\ etc. All this is setup on XP SP2 with no firewall and connections opened up on router to allow 3306. I can login to mysql via the command line with the user root and the password I set at install. However, I get this message after I hit ok. Whether I submit correct credentials or not. Note, I am the admin of this box.

PHP has encountered an Access Violation at 0101AC5A

Sometimes it shows that the page cannot be displayed. Has anyone seen this error and may know the problem? I've looked into my windows event viewer and I have an error under System with Source being WAM and problem listed:

I've tried changing the connection type to config, http, and cookie. Still no luck. I do have MySQL Administrator Tools and can connect to my MySQL via Administrator and Browser and what not. I'm stuck! Please help!

The HTTP server encountered an unhandled exception while processing the ISAPI Application '
php5ts!zend_mm_shutdown + 0x1140
php5ts!_efree + 0x39
'.

I havn't received this message in awhile. Friends can also view my login page. I feel safe I can provide that to the public. It's located at http://nemosolutions.mine.nu/phpadmin.
Phpinfo.php shows that mysql is installed. In fact, it can be reached at http://nemosolutions.mine.nu/phpinfo.php if anyone cares to see my config to help. I would really appreciate the help as I'm wanting to get a job I applied for and they user php with mysql as their primary web development. I believe I covered everything. I will post a reply if I realize I forgot something heh. Thanks again for any help!

I changed my extension from mysql to msyqli, restarted mysql and now I get this:
#1045 - Access denied for user 'user'@'localhost' (using password: YES)
I modified my config.inc.php to a different user but to no avail

I've also just tried a simple php file to connect to my mysql.

<?php
mysql_connect("localhost", "some_user", "some_pass") or die(mysql_error());
echo "Connected to MySQL<br />";
mysql_close($dbh);
?>

I still get that same access violation...
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: PHP/MySQL Issue

Post by califdon »

You're not alone. Even though I have used PHP and MySQL for several years on a Linux local computer and have all sorts of applications running on my hosted server and elsewhere, and used to have it working on my XP machine, when I replaced my Windows machine about a year ago and reinstalled everything, I had the same problem that you described. I'm using Apache web server and it works fine with PHP as long as I don't try to connect to MySQL. I can also access MySQL just fine from the command line. I'm embarrassed to admit that I just gave up and didn't spend more time solving the problem, since I don't really have to use it on this machine. So I'm afraid I can't give you any help, but I did want to let you know that you're not the only one in the world that has run into this. I will watch this thread with interest, hoping that someone will come up with the solution.
MrNemo
Forum Newbie
Posts: 7
Joined: Sun Dec 14, 2008 11:41 am

Re: PHP/MySQL Issue

Post by MrNemo »

I have your solution. I have fixed it and also got it working on a friends computer from scratch. Message me and I'll be happy to walk you through everything.
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: PHP/MySQL Issue

Post by Benjamin »

MrNemo wrote:I have your solution. I have fixed it and also got it working on a friends computer from scratch. Message me and I'll be happy to walk you through everything.
How about you post the solution here so that others can benefit?
MrNemo
Forum Newbie
Posts: 7
Joined: Sun Dec 14, 2008 11:41 am

Re: PHP/MySQL Issue

Post by MrNemo »

I will happily do that! :)
MrNemo
Forum Newbie
Posts: 7
Joined: Sun Dec 14, 2008 11:41 am

Re: PHP/MySQL Issue

Post by MrNemo »

What I did to fix my issue was go back to Apache and get away from IIS. Since IIS is in ISAPI, it seems apparent that it causes a lot of issues with PHP and MySQL. At first, my Apache wouldn't interpret the PHP correctly but I fixed that by enabling it in the conf file. So I had PHP working and MySQL working independently again and to get them to talk; I moved php_mysql.dll and php_mysqli.dll to the Windows/System and Windows/System32 folder. One other thing that screwed me up was the php5apache2_2.dll. Even though it was in the directory, Apache wouldn't see it. I had to go with the php5apache2.dll in order for it to work. Not sure why but alas, it did the trick. I copied my php.ini to the Windows folder. Restarted the computer and then ran phpinfo.php and that showed I had MySQL and MySQLi installed and enabled.
I ran a php file with these contents:

Code: Select all

<?php
mysql_connect("localhost", "some_user", "some_pass") or die(mysql_error());
echo "Connected to MySQL<br />";
mysql_close($dbh);
?>
It then said it was connected. :) I hope I helped someone or at least shed some light on something that someone may have missed or forgotten. Thanks for reading!
jimmytehbanana
Forum Newbie
Posts: 1
Joined: Tue Sep 08, 2009 3:58 pm

Re: PHP/MySQL Issue

Post by jimmytehbanana »

So, using an alternative to IIS is not an option for me. I have tracked this particular problem to the php_mysql.dll extension. I am running Windows XP Professional SP3, IIS 5.1, PHP 5.2.8, and mySQL Server 5.1

IIS is configured using the php5isapi.dll ISAPI module and is required to use this.

phpinfo(); works fine.

When I uncomment php_mysql.dll and access an instance of MediaWiki hosted on my local computer I get the access violation error described above. However, if I leave this particular extension commented out then it works fine (I get a MediaWiki error explaining the need for mySql to be enabled).

My office has several developers and it works on the majority of their computers.

Any other possible solutions to this problem? I am about to upgrade to 5.2.9 to see if this fixed the problem but we need it to work for version 5.2.8 as this is the version that is required to be used.
MrNemo
Forum Newbie
Posts: 7
Joined: Sun Dec 14, 2008 11:41 am

Re: PHP/MySQL Issue

Post by MrNemo »

My PC with this configuration has been dead for awhile. My replacement pc is too slow for me to set that environment up again. When I get a new computer, I will re-do this again. I can possibly help you with this though. I'll see what I can do.
User avatar
Darhazer
DevNet Resident
Posts: 1011
Joined: Thu May 14, 2009 3:00 pm
Location: HellCity, Bulgaria

Re: PHP/MySQL Issue

Post by Darhazer »

There is error in your code:

Code: Select all

mysql_connect("localhost", "some_user", "some_pass") or die(mysql_error());
echo "Connected to MySQL<br />";
mysql_close($dbh);
Should be:

Code: Select all

$dbh = mysql_connect("localhost", "some_user", "some_pass") or die(mysql_error());
echo "Connected to MySQL<br />";
mysql_close($dbh);
You should identify if the connect function is the one that causes the problem, or the close. First try the code above, because there is a reported bug about mysql_close() with null argument. If this do not resolve the issue, try commenting mysql_close() to check if connect is successful.

P.S. Just seen that the quoted post is old. But jimmytehbanana, post your code, and same rules apply for you.
Post Reply