By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,710 Members | 1,613 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,710 IT Pros & Developers. It's quick & easy.

Please help me connect PHP to MySql - Newbie problem

P: n/a
Hello,

I'm a newbie at PHP and MySql, although I have wads of experience of
ASP, ASP.NET, SQL Server, etc.

I have just installed PHP 5.2.3 on a server (Windows Server 2003), as
well as MySql 5.0.45. Both of these work fine independently, but I can't
get PHP to connect to MySql.

The first (and probably most basic) problem is that when I run phpinfo()
I don't see any mention of MySql. I suspect that this is the cause of
the lack of connectivity.

I have removed the comments from the following two lines in php.ini
(which is in C:\Windows)...

extension=php_mysql.dll
extension=php_mysqli.dll

I've also got the following line in there...

extension_dir = "C:\Program Files\PHP\ext\"

which points to the folder containing the two DLLs mentioned above.

I've rebooted the machine a couple of times since making these changes.

As I said, when I run phpinfo(), it doesn't mention MySql at all.

Anyone any ideas? If I try to connect, nothing happens. No errors,
nothing. I tried the following sample script from
http://uk.php.net/manual/en/function.mysql-connect.php to test it...

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

(where I changed the user name and password obviously), but this didn't
produce anything. No message, no error, just a blank page.

TIA for any help

--
Alan Silver
(anything added below this line is nothing to do with me)
Jul 16 '08 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.