Go Job Hunting at the LQ Job Marketplace
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 01-30-2003, 10:09 AM   #1
Registered: Jan 2003
Posts: 34

Rep: Reputation: 15
undefined function: mysql_connect

I am running Redhat8 MySql 3.23.53 PHP 4.2.2
and unable to get PHP to pass data to MySql
I am getting the following error when I run the scrypt below in a browser

Fatal error: Call to undefined function:
mysql_connect() in /var/www/html/test1.php3 on line 2

$link = mysql_connect("localhost", "user", "password")
or die("Could not connect");
print ("Connected successfully");

The odd thing is that I can run PHPMySQL fine and manage my databaseds logging in as this user.
So PHP is interacting whti MySQL in the sence fine.
I am not sure where I am doing whong, any ideas????
Old 01-30-2003, 02:07 PM   #2
LQ Newbie
Registered: Nov 2002
Location: Zemun, Serbia
Distribution: DEBIAN
Posts: 18

Rep: Reputation: -2
phpmysql ? do you mean phpmyadmin ?

This looks like your .so or .dll is not loaded.
Old 01-30-2003, 05:42 PM   #3
Registered: Feb 2001
Location: Atlanta, GA
Distribution: Slackware
Posts: 1,823

Rep: Reputation: 120Reputation: 120
call the phpinfo() method in a .php file and load it through your browser. See if you have a mysql section. it's possible that you either don't have mysql support or it is not configured correctly.
Old 01-31-2003, 06:09 AM   #4
Registered: Jan 2003
Posts: 34

Original Poster
Rep: Reputation: 15

This is what I get form my phpinfo

MySQL Support enabled
Active Persistent Links 0
Active Links 0
Client API version 3.23.54
MYSQL_SOCKET /var/lib/mysql/mysql.sock
MYSQL_INCLUDE -I/usr/include/mysql
MYSQL_LIBS -L/usr/lib/mysql -lmysqlclient

Directive Local Value Master Value
mysql.allow_persistent On On
mysql.default_host no value no value
mysql.default_password no value no value
mysql.default_port no value no value
mysql.default_socket no value no value
mysql.default_user no value no value
mysql.max_links Unlimited Unlimited
mysql.max_persistent Unlimited Unlimited
Old 01-31-2003, 03:50 PM   #5
Registered: Jan 2002
Distribution: slackware
Posts: 193

Rep: Reputation: 30
I know in redhat 7.3 there is a seperate package called php-mysql that needs to be installed for mysql support whether 8 is the same I dont know.
Old 02-01-2003, 09:49 AM   #6
Registered: Jan 2003
Posts: 34

Original Poster
Rep: Reputation: 15
Yeah I think you are right Jstu
I have loaded php-mysql-4.2.2-8.0.5.i386 which did give me the
mysql module when I did a php -m but it did not fix my original Fatal error: Call to undefined function:
So I went and downloaded php 4.3.0 and installed it which then knocked out the php-mysql module so I went to reinstall this module and now I am getting the error program already installed
And I am unable to uninstalled it, phew this is hard work but
With the help of you good folks I will get there

Old 10-31-2003, 08:22 PM   #7
Registered: Aug 2003
Posts: 104

Rep: Reputation: 15

I know its been awhile but did u resolve your issue with php connecting to mysql.. i was just reading your posting but no resolution was entered..
i'm having the same problem and wondering what the fix was....
Old 11-03-2003, 03:00 AM   #8
Registered: Jan 2003
Posts: 34

Original Poster
Rep: Reputation: 15

Well after a lot of trying to avoide it I reinstalled my box and it was fine.

Not a very technical solution but it is the quickest way I have found of fixing this problem.

This has happened to me twice in the past with redhat 8 I dont know if it is a bug with me or redhat

It may be better with 9?

Good Luck

Old 12-27-2003, 06:35 AM   #9
Registered: Jan 2003
Location: Bandung, Indonesia
Distribution: Mandrake, SUSE, RedHat
Posts: 55

Rep: Reputation: 15
I have the same problem here and reinstalling seems to be a solution (i've configured my linux and updated many thing, loosing them is not an option). Is there any site where i can browse to solve this or do somebody have the solution please?


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Dlopen function - UNDEFINED REFERENCE mamthababu Programming 1 07-19-2005 11:20 AM
Call to undefined function domxml_open_mem() apt Programming 2 04-01-2005 04:25 AM
Call to undefined function: mysql_connect() SocialEngineer Linux - Software 2 11-16-2004 03:24 PM
Need help with PHP and MySQL: Undefined function... Mega Man X Programming 12 09-16-2004 12:07 AM
Glob(): Undefined Function? HappyDude Programming 0 11-05-2003 08:10 PM

All times are GMT -5. The time now is 01:27 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration