I am a newbie to LAMP stack. I believe I have setup apache,php and mysql correctly. I am using Mac Pro, and OS version is 10.8.2
While installation I modified php.ini to include mysql.default_socket = /tmp/mysql.sock
Modified httpd.conf to uncomment php module.
When I run a webpage with phpinfo(), below is a snippet from the same.
mysqlnd
mysqlnd enabled
Version mysqlnd 5.0.8-dev - 20102224 - $Id: 65fe78e70ce53d27a6cd578597722950e490b0d0 $
Compression supported
SSL supported
Command buffer size 4096
Read buffer size 32768
Read timeout 31536000
Collecting statistics Yes
Collecting memory statistics Yes
Tracing n/a
Code which fails is on line 2 of the test page.
PHP Code:
<?php
$con = mysql_connect("127.0.0.1","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
$fname = $_POST["fname"];
$lname = $_POST["lname"];
$add1 = $_POST["add1"];
...
...
FYI ... prior to setting up apache,php and mysql seperately I tried XAMPP and the same code back worked.
Please help me what need to get configured to make sure that php connects to localhost mysql.
Thank you in advance.