Jump to content


Photo

PHP 5.3.1 not working well with MySQL on Windows 7


  • Please log in to reply
3 replies to this topic

#1 PacFox

PacFox

    Newbie

  • Member
  • Pip
  • 2 posts
  • Main OS: Windows Vista

Posted 14 December 2009 - 09:35 AM

I tried out the latest version (Nano-5.5) of Uniform Server and found that it would timeout while trying to connect to anything using MySQL other than phpMyAdmin in the admin panel. After much fiddling around I was able to pinpoint the problem down to PHP 5.3.1 after I switched it with PHP 5.3.0 from Nano-5.1 and found I could connect again. I've only tested on Windows 7 (I use the Professional x64 version) so I don't know if it happens on other OSs.

This is the code that I used to test (works with 5.3.0, timeout on 5.3.1):
<?php
error_reporting(0);
$connect = mysql_connect("localhost", "root", "root");
$connect;
echo "Connection was ";
if (!$connect) { echo "not"; } echo " successful.";
?>


#2 SnowyOwl

SnowyOwl

    Newbie

  • Member
  • Pip
  • 1 posts
  • Main OS: Windows Vista

Posted 20 January 2010 - 11:04 AM

A useful post, thank you. I was finding the same problem using Windows 7 (64-bit) Home Premium and Nano-5.5.

I switched to Nano-5.1 and I can now connect to MySQL using php.

I have found that in Nano-5.1 the 'Server Status' component of the control panel does not work however because LIBEAY32.dll is missing.

#3 Ric

Ric

    Project Manager

  • Admin
  • PipPipPipPipPip
  • 1,535 posts
  • Gender:Male
  • Location:Cambridge,UK
  • Interests:Electronics
    Internet in general
    Open source projects
  • SourceForge IDmpgcan
  • Wiki ID: Ric
  • Main OS: Windows XP

Posted 20 January 2010 - 06:18 PM

There is a bug in 5.3.1

PhpMyAdmin works because it uses 127.0.0.1 instead of localhost it also uses extension mysqli

I think the bug ignores localhost and tries to connect to the MySQL server using IPV6.

Change your test code to
<?php
error_reporting(0);
$connect = mysql_connect("127.0.0.1:3306", "root", "root");
$connect;
echo "Connection was ";
if (!$connect) { echo "not"; } echo " successful.";
?>
Just wondering it that works.

I would be interested to see if 5.6 beta works? It uses 5.3.2RC1, which may have fixed this bug.

All the best
Ric ;)

#4 PacFox

PacFox

    Newbie

  • Member
  • Pip
  • 2 posts
  • Main OS: Windows Vista

Posted 12 February 2010 - 07:41 PM

I have tried changing localhost to 127.0.0.1 and it does indeed work. On the subject of it being a PHP bug I've found this and this suggesting it's not going to be fixed.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users