Upgrading php from 5.3.0 to 5.3.1 breaks connection to mySQL

Posted on 2011-10-20
Medium Priority
Last Modified: 2013-12-12

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

Question by:Chris Stanyon
  • 3
  • 3
LVL 35

Expert Comment

ID: 37003697
Do you need to upgrade from 3.0 to 3.1?

Aren't there more recent upgrades?

Or is WAMP restricted somehow?
LVL 45

Author Comment

by:Chris Stanyon
ID: 37003853
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.

LVL 35

Accepted Solution

Norie earned 750 total points
ID: 37003958
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.
Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

LVL 84

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 750 total points
ID: 37004370
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
LVL 45

Author Comment

by:Chris Stanyon
ID: 37005436
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

LVL 35

Expert Comment

ID: 37005608
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.
LVL 45

Author Closing Comment

by:Chris Stanyon
ID: 37008170
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.

Featured Post


Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
Unable to change the program that handles the scan event from a network attached Canon/Brother printer/scanner. This means you'll always have to choose which program handles this action, e.g. ControlCenter4 (in the case of a Brother).
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
This Micro Tutorial will give you a introduction in two parts how to utilize Windows Live Movie Maker to its maximum editing capability. This will be demonstrated using Windows Live Movie Maker on Windows 7 operating system.
Suggested Courses
Course of the Month16 days, 7 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question