Find the answer to your Linux question:
Results 1 to 5 of 5
First off, I am using CentOS 5. I am getting this error when I try to connect to my MySQL database from a PHP page. "Fatal error: Call to undefined ...
  1. #1
    Just Joined! jason.frost's Avatar
    Join Date
    Aug 2007
    Location
    Ohio
    Posts
    15

    PHP error when connecting to MySQL

    First off, I am using CentOS 5.

    I am getting this error when I try to connect to my MySQL database from a PHP page.

    "Fatal error: Call to undefined function mysql_connect() in /usr/local/htdocs/test.php on line 11"

    I have found instances on the Internet where other people had the same problem but from everything I've read, none of it appears to do anything for me.

    I have read that I need the "extension=mysql.so" in my php.ini file and to uncomment it but it's not in there and I don't even have the "mysql.so" file.

    Many people have said to install the MySQL "devel" package, which I have also done and it is still not adding the file.

    I have also tried running the PHP ./configure again with the "--with-mysql".

    After all of these I still can't seem to get any further than I was when I found out I had a problem.

    If anyone can provide some assistance I would appreciate it. Thank you.

  2. #2
    Just Joined! jason.frost's Avatar
    Join Date
    Aug 2007
    Location
    Ohio
    Posts
    15
    I've tried running "./configure --with-mysqli=/usr/bin. But after running a little bit it says "mysql_config not found". HOW? It's right in the directory!

    That must cause the whole thing to fail because it ends with:
    "configure: error: Please reinstall the mysql distribution"

  3. #3
    Just Joined!
    Join Date
    Mar 2011
    Posts
    6
    If you have installed mysql rpms
    Check if mysqld is running (3306 )
    else restart the Service
    then try recompling the php with ./configure --with-mysql=/usr/bin/mysql

  4. #4
    Just Joined! jason.frost's Avatar
    Join Date
    Aug 2007
    Location
    Ohio
    Posts
    15
    Quote Originally Posted by kratozrulz View Post
    If you have installed mysql rpms
    Check if mysqld is running (3306 )
    else restart the Service
    then try recompling the php with ./configure --with-mysql=/usr/bin/mysql
    Well I did try the ./configure again with the path "/usr/bin/mysql" and it worked this time however it didn't fix the problem.

    I looked and I don't have a "my.cnf" file. Does the config file go by another name? How could it install with out putting the config file on the computer?

  5. #5
    Just Joined!
    Join Date
    Mar 2011
    Posts
    6
    Quote Originally Posted by jason.frost View Post
    Well I did try the ./configure again with the path "/usr/bin/mysql" and it worked this time however it didn't fix the problem.

    I looked and I don't have a "my.cnf" file. Does the config file go by another name? How could it install with out putting the config file on the computer?
    IF there is a missing my.cnf file you may create one in /etc/
    with syntax

    [mysqld]
    datadir=/var/lib/mysql
    socket=/var/lib/mysql/mysql.sock
    old_passwords=1
    max_connections=1500
    [mysql.server]
    user=mysql
    basedir=/var/lib

    [mysqld_safe]
    log-error=/var/log/mysqld.log
    pid-file=/var/run/mysqld/mysqld.pid

    & restart the mysql server.
    Try login to mysql thru command promt
    using mysql -u username -ppassword

    hope this helps you

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...