argmosys Posted December 6, 2009 Share Posted December 6, 2009 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 More sharing options...
argmosys Posted December 6, 2009 Author Share Posted December 6, 2009 Sorry, failed to mention that the error i keep recieiving: Call to undefined function mysql_connect() Link to comment https://forums.phpfreaks.com/topic/184182-php-cannot-connect-to-mysql/#findComment-972404 Share on other sites More sharing options...
corbin Posted December 6, 2009 Share Posted December 6, 2009 Have you read: http://www.phpfreaks.com/forums/index.php/topic,95378.0.html ? Link to comment https://forums.phpfreaks.com/topic/184182-php-cannot-connect-to-mysql/#findComment-972405 Share on other sites More sharing options...
argmosys Posted December 6, 2009 Author Share Posted December 6, 2009 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. Link to comment https://forums.phpfreaks.com/topic/184182-php-cannot-connect-to-mysql/#findComment-972410 Share on other sites More sharing options...
argmosys Posted December 7, 2009 Author Share Posted December 7, 2009 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. Link to comment https://forums.phpfreaks.com/topic/184182-php-cannot-connect-to-mysql/#findComment-972581 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.