Upgrading php from 5.3.0 to 5.3.1 breaks connection to mySQL

Posted on 2011-10-20
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
    LVL 33

    Expert Comment

    Do you need to upgrade from 3.0 to 3.1?

    Aren't there more recent upgrades?

    Or is WAMP restricted somehow?
    LVL 42

    Author Comment

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

    Accepted Solution

    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.
    LVL 82

    Assisted Solution

    by:Dave Baldwin
    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:
    LVL 42

    Author Comment

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

    Expert Comment

    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 42

    Author Closing Comment

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

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Join & Write a Comment

    Suggested Solutions

    One of the features I've come to appreciate about Windows 7 and Windows Server 2008 R2 is the ability to pin applications to the task bar. As useful a feature as I've found this, it does have some quirks.  For example, have you ever tried pinning an…
    Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
    The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
    The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

    728 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

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now