Page 1 of 1

mysql_connect(): not working with apache 2.2, no error msg

Posted: Thu Sep 04, 2008 10:07 pm
by XeniaM
I have installed mysql Server 5.0, Apache 2.2 and PHP on a localhost. I am running a simple connect.php script:
<?php
error_reporting(E_ALL);
echo "Trying to Connect to DB!!!";
$connx = mysql_connect('localhost', 'Xenia', 'password');
echo "Connected to DB!!!";
if(!$connx)
{
die("DB connection failed: " . mysql_error());
}
else {
echo "Connected to DB!!!";
}
?>

It prints out "Trying to Connect to DB!!!"... and nothing else after that..
My php.ini includes the lines:
[PHP_MYSQL]
extension=php_mysql.dll
MySQL server is running (I have run telnet localhost 3306 and connected)
I have executed GRANT ALL ON *.* TO Xenia@localhost IDENTIFIED BY "password"; just in case my used didn't have access.

The MySql service is running on apache...

What am I missing here? Any ideas would be really helpful. I am very new to this so this may be something obvious. :oops: Thanks in advance.

Re: mysql_connect(): not working with apache 2.2, no error msg

Posted: Fri Sep 05, 2008 6:28 am
by susrisha
try this one instead.. its the same but just have a gut feeling this will work..

Code: Select all

 
if(!$connx = mysql_connect('localhost', 'Xenia', 'password'))
{
echo mysql_error();
}