Jump to content

PHP cannot connect to mysql


argmosys

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.