Upgrading php from 5.3.0 to 5.3.1 breaks connection to mySQL


I'm running WampServer on Windows 7 (x64) and everything has been working great. I'm setup with PHP 5.3.0 and MySQL 5.1.36

I've just added PHP 5.3.1 but when switching to this new version, I can no longer connect to MySQL using PHP. I've tried connecting with both mysql_connect and PDO.

My page tries to load and responds with "The Connection to the server was reset". Switching back to PHP 5.3.0 fixes the issue.

I've been searching for a resolution to this for a while and various topics point to a problem with localhost on windows 7, and suggest uncommenting the localhost line in hosts or connecting to the sql server with instead of localhost - I've tried all this and still don't get any joy.

Just can't pinpoint why it works with 5.3.0 but not 5.3.1

all the relevant extensions are loading fine in php (checked with phpinfo - mysql, pdo_mysql etc)

Baffled!! Any help appreciated

LVL 46
Chris StanyonAsked:
Who is Participating?
NorieVBA ExpertCommented:
How about Apache being the problem?

I've had a quick search and it seems to come up quite often when PHP 5.3.1 is causing problems.

Most of the 'solutions' were to switch back to the previous version.

How did you upgrade to/install the new version?

Sorry if that's a stupid question, only tried WAMP once and had some problems so switched to manually installing,

One thing I've just remembered, is the version you installed thread safe?

I had some problems in the past with that.
NorieVBA ExpertCommented:
Do you need to upgrade from 3.0 to 3.1?

Aren't there more recent upgrades?

Or is WAMP restricted somehow?
Chris StanyonAuthor Commented:
Not necessarily, but it's the latest version that's available as an update in the current version of WampServer that I'm using.

Going beyond 5.3.1 would mean an update of other packages ( or a manual php update ). If I can't figure out why it's happening, it may come to that.

Before comitting to other updates, I'm trying to figure out what the problem is in the first place. From looking into this already, I can't really figure out whether the problem is coming from PHP, MySQL or Windows 7. Different articles I've read suggest that it could be any, although nothing I've tried seems to help.

Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

Dave BaldwinFixer of ProblemsCommented:
I was just looking at the WAMP download page.  You can't do a manual update to a newer version of PHP because they changed compilers like everyone else has.  And it's not just PHP, Apache and everything else is compiled with VC9 in the newer versions.  So it's a complete update if you want to go past PHP 5.3.1.

And there is this bug report saying it won't be fixed: https://bugs.php.net/bug.php?id=50433
Chris StanyonAuthor Commented:
It seems that I've fixed the problem - PHP 5.3.1 is running fine and my scripts can connect to mysql, through both mysql_connect and PDO :)

Unfortunately, I'm not sure what I've done to fix it - it was late last night and I was looking at lots of different files and reading lots of differing articles - it all blurred into one !

It's seems that uncommenting localhost from my hosts file has done the trick (as discussed in various places across the 'net), although I'd already tried that without success.

In the host file there's a comment saying that localhost resolution is handled by DNS - I guess not !

@imnorie: I updated PHP using WampServers built in 'Get More Versions' feature. I haven't upgraded apache so there's no version to fall back to. As to thread-safe, I'm not sure - wamp didn't give me the option - just a link to download 1 file.

@DaveBaldwin: Yeah. If I need to go past 5.3.1, then I'll update my entire WAMP stack - but I was hoping to just update php. I'm trying to keep my apache and mysql version as they are  - it means my development server is setup the same as my production server (which I can't update). This ipv6 issues keeps coming up, but it didn't seem to fix my problem. Didn't matter whether I was connecting to localhost or

NorieVBA ExpertCommented:
Glad you got it sorted.

I always seem to forget to restart something or save something when I make changes to things like the host files.

Then I wonder why the change hasn't taken affect.
Chris StanyonAuthor Commented:
Thanks guys. I've split the points, not so much for the answers, but for taking the time to help. Always good to get other pointers to an acceptable resolution.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.