Contact Yart for a relaxed conversation
Your Name * Message *
Your Email *  
Your Phone   
Our Phone:        03 8685 8718 (within Australia)
61 3 8685 8718 (outside Australia)
Contact Yart

Melbourne Content Management and Flash developers

 

for designers, agencies and your website

Resources / Programming / PHP mySQL Installation Problems IIS 5
Install PHP and mySQL on Windows XP Pro With IIS 5

I have been installing mySQL and PHP since 1998. You'd think I know something about it but eveytime I do it again it can be a nightmare. I generally do an installation every year or so which means I've forgotten what I did the previous time. Considering that options keep changing, it can be a nightmare to get these two working. I used to have a specific check list, but because the PHP install kept changing, I have laid down a few general guidelines below.

php

1. I generally start here http://www.php.net/manual/en/install.windows.iis6.php using the non-thread-safe build of PHP. I don't worry about the fast CGI extensions for my development machine.

2. Your first php script should be:

echo(phpinfo());

This will tell you where the php.ini is as well as which modules have been installed.

3. Make sure you remove old php.ini's from c:\windows and c:\windows\system32 to avoid confusion.

4. If it doesn't work, make sure the virtual directory execute permissions are set to Scripts and Executables if you are using the php-cgi.exe. These need to be set on the virtual directory you are configuring. Make sure mappings are present for this directory as well. I used to set these for the Default Web Site but this is not sufficient.

5. After you have php running, you need to check you can create mySQL databases and connect to them with:

$link = mysql_connect('localhost', 'root', 'password');

if (!$link) {
    die('
Could not connect: ' . mysql_error());
}
echo '
Connected successfully';

$dbname = 'TestWordPress';
$db = mysql_select_db($dbname);

echo '
db is '.$db;

mysql_close($link);

phpinfo();

mySQL

1. If reinstalling mySQL, you need to uninstall the old version first. This is tricky. See this post http://serverfault.com/questions/88473/how-to-completely-remove-mysql-from-windows and this video http://www.channels.com/episodes/show/6310023/Completely-remove-MySQL-server-for-Windows

2. Once the installation is complete, make sure to you run the MySQL Instance Configuration Wizard. Then install mySQL WorkBench.

3. To create a database in mySQL WorkBench does the following:

  • Double click on the instance of mySQL under SQL Development.
  • Click on the icon Create A New Schema in the bottom right window.
  • The name you enter here is the databse you are creating.

See also http://stackoverflow.com/questions/4975713/how-do-you-create-a-database-in-mysql-workbench-that-you-can-connect-to-with-php

4. The connection test could look like:

$link = mysql_connect('localhost', 'root', 'arbuzas');

if (!$link) {
    die('
Could not connect: ' . mysql_error());
}
echo '
Connected successfully';

$dbname = 'test_mysql';
$db = mysql_select_db($dbname);

echo '
db is '.$db; //make sure $db is a number when you run this

mysql_close($link);



The latest at Yart
Search: