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

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
XeniaM
Forum Newbie
Posts: 1
Joined: Thu Sep 04, 2008 10:05 pm

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

Post 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.
User avatar
susrisha
Forum Contributor
Posts: 439
Joined: Thu Aug 07, 2008 11:43 pm
Location: Hyderabad India

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

Post 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();
}
 
Post Reply