Skip to content

CODExperiments

Doing it MY way!

  • Home
  • 2010
  • August
  • 12
  • Windows 7 and PHP/MySQL

Windows 7 and PHP/MySQL

Posted on August 12, 2010January 2, 2015 By Zoon 1 Comment on Windows 7 and PHP/MySQL
PHP, Programming

Just spend a few hours getting Windows 7, Apache, PHP and MySQL up and running.

It should have been fairly easy, but there was a small problem.

While all the subparts worked independendly, PHP was unable to connect to the MySQL database.

MySQL was installed on localhost just to make it easy. However, this is were the trouble began. If you look in the hosts file in Windows 7 (c:\Windows\system32\drivers\etc\hosts) you will notice, that an important line has been commented out:
[sourcecode language=”php”]
# 127.0.0.1 localhost
[/sourcecode]

Now since this line is missing/commented out, PHP can’t find the IP for localhost. Remove the # sign, and save the file. PHP should be able to connect just fine now 🙂

[ad name=”Google Adsense-1″]

As a note, you might run into trouble editing the file. Simply find Notepad in you start menu, right click and select “Run as administrator”. Notepad can now edit and save the changes made to the file.

I hope this blogpost saves someone else a bit of time.

Tags: MySQL PHP Windows 7

Post navigation

❮ Previous Post: You want salt with that?
Next Post: HTML 5 Geolocation API ❯

You may also like

Programming
Newshosting.com quick review
March 29, 2012
Programming
NZB Completion Checker bug fix released!
February 14, 2012
Programming
Dynamically load combobox using jQuery
April 8, 2011
Programming
NZBcc Alpha release imminent
October 31, 2011

One thought on “Windows 7 and PHP/MySQL”

  1. zoonman says:
    August 16, 2010 at 19:03

    Please, see php.ini, [MySQL] section,
    you may setup mysql.default_host variable to 127.0.0.1
    And when you try to mysql_connect() define server to 127.0.0.1

Leave a Reply

You must be logged in to post a comment.

Downloads

Get it while it's HOT:
NZBcc 1.2.2.0

Downloads
might be ad supported. If so, click in top right corner to continue when the counter reaches 0.

Support NZBcc



Sign up to Dropbox using this link

Archives

  • March 2016
  • September 2014
  • July 2014
  • January 2014
  • August 2013
  • January 2013
  • December 2012
  • November 2012
  • September 2012
  • August 2012
  • June 2012
  • May 2012
  • March 2012
  • February 2012
  • January 2012
  • December 2011
  • November 2011
  • October 2011
  • August 2011
  • July 2011
  • April 2011
  • January 2011
  • December 2010
  • November 2010
  • August 2010
  • July 2010
  • April 2010
  • March 2010
  • January 2009

Tag Cloud

AJAX Android Articles C# Download FMV Giganews HLSL HTML HTML5 Javascript jQuery MPEG Decoding MySQL Netflix NZB NZBcc PHP SQL Usenet Windows 7 XNA

Copyright © 2025 CODExperiments.

Theme: Oceanly News Dark by ScriptsTown