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 ...
- 03-22-2011 #1
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.
- 03-24-2011 #2
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"
- 03-24-2011 #3Just 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
- 03-25-2011 #4
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?
- 03-25-2011 #5Just Joined!
- Join Date
- Mar 2011
- Posts
- 6
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


Reply With Quote
