Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 502723
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T06:19:14+00:00 2026-05-13T06:19:14+00:00

Seems like a beginner question but I can’t seem to figure it out …

  • 0

Seems like a beginner question but I can’t seem to figure it out …

I have a fresh Windows 7 x64 / Apache 2.2 / PHP 5.2 / MySQL 5 x64 installation.
Actually I tried both IIS and Apache.

But this PHP Code does not work:

<?
$hostname = "localhost";
$username = "xxx";
$password = "xxx";

$db = mysql_connect($hostname,$username,$password) or die("die");
?>
  • I can connect OK to the MySQL database using direct command line, using of course the same login/password.
  • I can access the MySQL database through the network with still the same login/password.
  • PHP is working otherwise (echo("hello world") does work).
  • The MySQL extension is enabled in php.ini. In fact, if I disable it I get Call to undefined function mysql_connect().
  • Windows Firewall disabled.
  • No error message. It just doesn’t return anything. After 600 seconds, it times out:

        Fatal error: Maximum execution time of 60 seconds exceeded in
            C:\Ampache\try.php on line 6
    

Any clue?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T06:19:14+00:00Added an answer on May 13, 2026 at 6:19 am

    Wait Wait Wait … I think I found it …

    RTM they said 🙂 It’s all at http://php.net/manual/fr/function.mysql-connect.php :

    Bruce Kirkpatrick – 28-Oct-2009 05:48 :
    On Windows Vista or above, an entry in the Windows/System32/drivers/etc/hosts file causes mysql_connect() connections to “localhost” to timeout and never connect. This happens on php 5.3 and above since it now uses mysql native driver which has changed it connection behavior compared to libmysql.dll in previous versions. It is not a PHP bug, but definitely a configuration issue for users on new windows systems.

    To get around this, you must remove the entry like this:
    ::1 localhost

    and make sure you still have:
    127.0.0.1 localhost

    Also, you could change the code to connect to the ip instead, but that is inconvenient if you have many web sites.

    This issue occurs on Windows Vista, Windows 7 and Windows Server 2008.

    In fact it works with

    $host = "127.0.0.1";
    

    Thanks for your interest !

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Seems like a simple enough question but I can't seem to find the answer.
This seems like a pretty beginner question; however, I have no idea what the
Seems like as really simple thing to do, but I just can't track it
This might seem like a silly question, but after asking some questions on stackoverflow
this is a bit of a beginner's question, but I've searched everywhere and can't
Seems like a simple problem: I have an SVN repo inside our firewall. I
Seems like this should be obvious, but how do I send arrow key presses
Seems like this should be simple, but powershell is winning another battle with me.
Total beginner question about jQuery: I have a Form that contains several TextBoxes (input
This is a beginner question, but it's been frustrating me... I am using C#,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.