Fatal error: Call to undefined function mysql_connect() in /Users/praveenvasireddy/localhost/test/test2.php on line 2
I am a newbie to LAMP stack. I beleive I have setup apache,php and mysql correctly.
Modified php.ini to include mysql.default_socket = /tmp/mysql.sock
Modified httpd.conf to enable php module.
When I run a webpage with phpinfo(), below is a snippet from the same.
| 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
$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.
MacBook Pro with Retina display, OS X Mountain Lion (10.8.2)