Jump to content

Recommended Posts

I have ben trying to get php to connect to mysql for days now.  I have read most posts on this and nothing seems to work.

 

the environment is Windows 7 home premium, windows web expression 2.0,  IIS 6, php 5.3 and mysql 5.

 

I am using this on a laptop and only for local development.  I have a hosted website that utlizes php and mysql.

 

I have already tried to uninstall and reinstall php.  I installed on c:\php and C:\windows\php and still does not work.

Mysql does work as i connected to it and created a small test database.

 

When i test my connection i use the following code:

 

<?php

 

$host = 'localhost';

$user = 'root';

$pass = 'test1';

 

$conn = mysql_connect($host, $user, $pass) or die(mysql_error());

echo "Connected to MySQL<br/>";

?>

 

any help would be greatly appreciated.

 

thanks, argmosys

Link to comment
https://forums.phpfreaks.com/topic/184182-php-cannot-connect-to-mysql/
Share on other sites

yes, i have tried that.  When i apply those changes then i receive this error.

 

HTTP Error 408 - Request Timeout.

 

 

If i leave the php.ini file as when installed, i can at lease receive the undefined function call.  when i make the changes it does not even seem to acknowledge mysyql. 

 

mind boggling.

SOLVED!!  I found another article in this forum and reinstalled PHP using windows web platform installer. 

 

http://blogs.iis.net/bills/archive/2006/09/19/How-to-install-PHP-on-IIS7-_2800_RC1_2900_.aspx

 

With this method, i only had to ensure that the environment variable and php.ini had the correct path.

 

Once i made those changes PHP was able to connect to mysql.

 

Thanks all.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.