PHP5 and mysql_connect()

Discussion in 'PHP' started by phantom, Oct 10, 2007.

  1. #1
    Just set up a development system here at home.


    Can't get mysql_connect() to work with PHP any idea what I need to do to get this to work?
     
    phantom, Oct 10, 2007 IP
  2. YIAM

    YIAM Notable Member

    Messages:
    2,480
    Likes Received:
    240
    Best Answers:
    0
    Trophy Points:
    280
    #2
    YIAM, Oct 10, 2007 IP
  3. phantom

    phantom Well-Known Member

    Messages:
    1,509
    Likes Received:
    32
    Best Answers:
    0
    Trophy Points:
    140
    #3
    Sorry in my first post I should have said PHP5


    here is the error I get


    Fatal error: Call to undefined function mysql_connect()


    I am pretty sure its a PHP5 issue because the same code works flawlessly in PHP4
     
    phantom, Oct 10, 2007 IP
  4. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #4
    MySQL is just an extension, that works with pretty much any version of PHP. If you get this error, it means you don't have it installed correctly, or not at all.

    If you don't have access to the server to install things yourself, have a look at MySQLi - www.php.net/mysqli

    With some luck you have this installed at least.
     
    nico_swd, Oct 11, 2007 IP
  5. phantom

    phantom Well-Known Member

    Messages:
    1,509
    Likes Received:
    32
    Best Answers:
    0
    Trophy Points:
    140
    #5
    Thanks for that nico.......while it didn't say I needed to do it that link lead me to figure out I need to install more packages.

    It turns out I needed to apt-get install php5-mysql and apt-get install php5-mysqli packages.

    Thanks!
     
    phantom, Oct 11, 2007 IP