Forum Moderators: coopster

Message Too Old, No Replies

Problem connecting to MySQL in localhost

Problem connecting to MySQL in localhost

         

simkeechai

5:15 am on Nov 24, 2006 (gmt 0)

10+ Year Member



hi there,

I am totally new to php and i am using Dreamweaver 8. I am trying to create a page to initiate connection to the MySQL Server 5.0 at localhost, but the browser returns me this error message:

"Fatal error: Call to undefined function mysql_connect() in c:\Inetpub\wwwroot\My_PHP\connect_to_mysql.php on line 11"

The testing code i was trying as below:

<?php
$connection = mysql_connect('localhost', 'root', 'password');
if (!$connection) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($connection);
?>

More information of what i am using:
MySQL Server V.5.0.18-nt
PHP Version 5.1.4
Server_Name/HTTP_Host: localhost
Server_Software: Microsoft-IIS/5.1
Windows XP SP2

Please help me to solve my problem. Please tell me if you need more details.

Thank y'all very much!

eelixduppy

5:20 am on Nov 24, 2006 (gmt 0)



PHP 5 doesn't have mysql enabled as default. Check your php.ini file and uncomment the line.

Refer to this thread on Installing a new web server: Apache2, PHP5, MySQL4 and PHPmyAdmin [webmasterworld.com] for more information.

Good luck!

simkeechai

5:40 am on Nov 24, 2006 (gmt 0)

10+ Year Member



hi there, the thread you suggested is for Apache server, right? Should i use same settings to Microsoft IIS5.1?

eelixduppy

5:46 am on Nov 24, 2006 (gmt 0)



Oops...I missed that detail :)

The steps for enabling mysql in the php.ini are the same. Uncomment this line in your php.ini:


extension=php_mysql.dll

simkeechai

8:25 am on Nov 24, 2006 (gmt 0)

10+ Year Member



hi there,

have you tried installing PHP 5.2.0? I tried this version, but i couldn't get the test page run as well. In the testing page, i only wanted to show phpinfo(); :(

Please help. Thanks!

eelixduppy

4:56 am on Nov 25, 2006 (gmt 0)



You may also want to refer to the documentation on Installations of PHP with IIS [us3.php.net].

If phpinfo() isn't working then there is something wrong with your PHP installation although from your first post you have a PHP-generated error; I wonder what's going on here. A little fishy, I might add. ;)