title: Cannot connect to MySQL through PHP
body: <p>Seems like a beginner question but I can't seem to figure it out ...</p>
  
  <p>I have a fresh Windows 7 x64 / Apache 2.2 / PHP 5.2 / MySQL 5 x64 installation.<br>
  Actually I tried both IIS and Apache. </p>
  
  <p>But this PHP Code does not work: </p>
  
  <pre><code>&lt;?
  $hostname = "localhost";
  $username = "xxx";
  $password = "xxx";
  
  $db = mysql_connect($hostname,$username,$password) or die("die");
  ?&gt;
  </code></pre>
  
  <ul>
  <li>I can connect OK to the MySQL database using direct command line, using of course the same login/password.</li>
  <li>I can access the MySQL database through the network with still the same login/password. </li>
  <li>PHP is working otherwise (<code>echo("hello world")</code> does work).</li>
  <li>The MySQL extension is enabled in php.ini. In fact, if I disable it I get <code>Call to undefined function mysql_connect()</code>. </li></li>
  <li>Windows Firewall disabled.</li>
  <li><p>No error message. It just doesn't return anything. After 600 seconds, it times out: </p>
  
  <pre><code>    Fatal error: Maximum execution time of 60 seconds exceeded in
          C:\Ampache\try.php on line 6
  </code></pre></li>
  </ul>
  
  <p>Any clue?</p>