LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices

Reply
 
LinkBack Search this Thread
Old 01-30-2003, 09:09 AM   #1
Greenman
Member
 
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

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

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, 01:07 PM   #2
mire
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, 04:42 PM   #3
crabboy
Moderator
 
Registered: Feb 2001
Location: Atlanta, GA
Distribution: Slackware
Posts: 1,822

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, 05:09 AM   #4
Greenman
Member
 
Registered: Jan 2003
Posts: 34

Original Poster
Rep: Reputation: 15
Post

This is what I get form my phpinfo

mysql
MySQL Support enabled
Active Persistent Links 0
Active Links 0
Client API version 3.23.54
MYSQL_MODULE_TYPE external
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, 02:50 PM   #5
jstu
Member
 
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, 08:49 AM   #6
Greenman
Member
 
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

G
 
Old 10-31-2003, 07:22 PM   #7
Robin01
Member
 
Registered: Aug 2003
Posts: 104

Rep: Reputation: 15
Hello,

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, 02:00 AM   #8
Greenman
Member
 
Registered: Jan 2003
Posts: 34

Original Poster
Rep: Reputation: 15
Hi

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

G
 
Old 12-27-2003, 05:35 AM   #9
Tafta
Member
 
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?
 
  


Reply


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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


All times are GMT -5. The time now is 02:09 PM.

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