1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Rep Power

    Call to undefined function mysql_connect() in /Users/praveenvasireddy/localhost/test/

    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 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:


        if (!


    '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.
  2. #2
  3. Mad Scientist
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Oct 2007
    North Yorkshire, UK
    Rep Power
    try installing apache, mysql and php by downloading and installing xampp

    Then, if you're new to PHP bypass the whole mysql_* functions and concentrate on PDO (PHP Data Objects) - its a neater, cleaner set of objects and functions to use when interfacing to a database
    I said I didn't like ORM!!! <?php $this->model->update($this->request->resources[0])->set($this->request->getData())->getData('count'); ?>

    PDO vs mysql_* functions: Find a Migration Guide Here

    [ Xeneco - T'interweb Development ] - [ Are you a Help Vampire? ] - [ Read The manual! ] - [ W3 methods - GET, POST, etc ] - [ Web Design Hell ]

IMN logo majestic logo threadwatch logo seochat tools logo