|
-
Aug 19th, 2003, 04:32 AM
#1
Thread Starter
Fanatic Member
Undefined Function Error MySQL_Connect
I have a problem when trying to use mysql_connect. Apache returns and undefined function 'MySQL' error. I have just loaded RH linux 8 and php is processing requests and the MySQL daemon is running and active - I am able to use the db fine.
Any ideas on how to solve this would be appreciated.
In terms of what version of apache I am using, I need to find out. I am wrking right now but will reply in 5 hours.
Thanks in advance
mike
-
Aug 19th, 2003, 08:20 AM
#2
Frenzied Member
also need the version of mysql and php
-
Aug 20th, 2003, 03:29 PM
#3
Stuck in the 80s
The exact error message would probably also help.
-
Aug 21st, 2003, 04:15 AM
#4
Thread Starter
Fanatic Member
UNDEFINED function 'mysql_connect' error on line8. The version of the httpd server is version 2.0
Sorry I did not respond earlier but i am having dns errors this side that mkes it impossible to view some web sites.
Could there be a shared module that is missing? Until now I have been working with MS only but have been called on to develop a site using PHP. I learnt PHP in a week but learning about configuring apache and mysql looks like that could take a while longer. Thanks for your replies
-
Aug 21st, 2003, 09:32 AM
#5
Frenzied Member
for one you still didn't tell us the version of php.
and I highly doubt it you learned php in a week, maybe the fundamentals but not the whole thing. 
if you are using php5.0 then mysql has been taken out of it. you have to install the module and get it working. also what version of mysql is installed? you did install mysql didn't you?
-
Aug 21st, 2003, 11:37 AM
#6
Stuck in the 80s
I learned PHP in a week, if it was even that long. Is that hard to believe?
Coming from a Perl, C++, and JavaScript background, I picked it up right away.
Granted, learning to work with MySQL and cookies probably took an 8th day, but that doesn't count.
-
Aug 21st, 2003, 12:01 PM
#7
Originally posted by phpman
and I highly doubt it you learned php in a week, maybe the fundamentals but not the whole thing.
So, much does one need to know to know a language?
I've never learned the "whole thing" about VB.... don't care to.... but I know enough to feel like I've learned VB....
Same w/ PHP, granted it might have taken me more than a week, but I attribut that to only being able to dedicate a couple of hours at a time, but I've gotten the hang of PHP pretty well.... again, I don't know it all, nor do I care to, but I know enough....
-
Aug 21st, 2003, 12:46 PM
#8
Frenzied Member
boy you guys are missing the point. I have been working in php for a year and a half and I don't know it all. I learn something new each day.
it is easy to learn php, granted, but you don't know it. you know all the functions and have used them? I bet not. that is learning php.
when I here "I have learned php in a week" I think it means you know it all. sure you know how to use it but you don't know it.
so according to you guys I can say
<?php
echo "hello";
?>
means I know php?? that is not even knowing it.
-
Aug 21st, 2003, 12:50 PM
#9
Stuck in the 80s
I think you're missing the point.
Are you trying to tell me that I don't know English? Because I'm pretty damn sure I don't know half the words in the English language, but I seem to speak it just fine.
No, I don't know ALL of PHP, but I know a damn lot. And if I ever came across something I didn't know, I'm sure it wouldn't take me more than an hour to figure it out.
-
Aug 21st, 2003, 01:05 PM
#10
Frenzied Member
everybody knows the fundamentals of anything. doesn't mean you know it all.
if you told me you learned php in a week you should be able to tell me everything about it, right? that is my meaning of learned it in a week.
everything would have been fine if they said I understand php pretty good or I know the fundamentals of php.
lets not nit pick there hobo, you knew what I meant.
-
Aug 21st, 2003, 01:10 PM
#11
Stuck in the 80s
No, I didn't, actually.
So if I were to tell you "I learned English", you would tell me that I didn't?
Has anyone learned anything, then? Besides stuff like: "I learned how to pronounce 'the'"?
-
Aug 21st, 2003, 01:21 PM
#12
Frenzied Member
totally different scenrio. english is far different than php, granted it is similiar in some ways eg. your learning a new language, BUT, english doesn't have boundaries, php does.
english has slang, php doesn't. so don't compare english to php.
my version of learning something is totally different than yours, apparently. so lets just leave it as that.
-
Aug 21st, 2003, 01:26 PM
#13
Stuck in the 80s
Learn: To gain knowledge, comprehension, or mastery of through experience or study.
I believe I have mastered PHP through experience and study. Therefor I have learned it.
And I believe my comparison was very valid, whether you accept it or not.
-
Aug 24th, 2003, 02:21 PM
#14
Hyperactive Member
commin back to the question guys..
i have the same prob with php 4.3.2 and mysql 4
give us a solution...
-
Aug 24th, 2003, 02:42 PM
#15
I learned PHP in an hour 
Once you know 1 language like C++, you can pick up alot of any other language within minutes to hours.
Learning all the functions is another story. You don't need to learn them all and if you do learn them all, well nice job.
Who really cares if you do know all of the functions or not. If you don't, you can write your own and if you can write functions, you're good to go.
Originally posted by deane034
commin back to the question guys..
i have the same prob with php 4.3.2 and mysql 4
give us a solution...
Post the code you used, same with the other guy. It says error on line 8, SO POST LINE 8!
-
Aug 25th, 2003, 06:25 AM
#16
Thread Starter
Fanatic Member
I had a DNS error here and wasn't able to connect to the site for a few days sadly.
hi phpman: The mysql server is running - I use MySQL for my VB apps every day. I can open a terminal window and execute scripts. in Linux without any hassles.
Is there a site around where I can learn about how to configure the mysql module into apache so that it can work ... Then I can ask more questions if needed. I have been searching for a mysql module in the apache directory but the RH installer did not seem to install it properly to work with apache.
The line of code read:
mysql_connect("localhost");
...and there are no permissions on the database. I was logged in as root admin.
Admittedly I don't know enough about sessions and security, but you guys will teach me, won't you?. I took a year before I stopped crawling in VB which was my first 4GL language, and no doubt is will be the same with php. In C,C++,PhP and other languages there are also a lot to learn, so I credit you all as being excellant in what you do and hopefully I will become as good as all of you!
-
Aug 25th, 2003, 08:23 AM
#17
Frenzied Member
apache has nothing to do with mysql, it is php tha tmakes the connection. what version of php do you have?
-
Aug 25th, 2003, 09:58 AM
#18
Stuck in the 80s
Did you try creating a phpinfo page to see if you even have MySQL support?
Create a page with this in it:
And see if there's a MySQL category anywhere. If not, then you probably don't have the MySQL modules installed for PHP.
-
Aug 25th, 2003, 09:59 AM
#19
Stuck in the 80s
The manual also gives this bit of information:
By using the --with-mysql[=DIR] configuration option you enable PHP to access MySQL databases. If you use this option without specifying the path to MySQL, PHP will use the built-in MySQL client libraries. With PHP 4 MySQL support is always enabled; if you don't specify the configure option, the bundled libraries are used.
Users who run other applications that use MySQL (for example, running PHP 3 and PHP 4 as concurrent apache modules, or auth-mysql) should always specify the path to MySQL: --with-mysql=/path/to/mysql. This will force PHP to use the client libraries installed by MySQL, avoiding any conflicts.
-
Aug 29th, 2003, 07:47 AM
#20
Thread Starter
Fanatic Member
Some output from phpinfo();
Running php 4.4.2
Zend Engine v1.2.0
Compiled Modules:
Yp
XML
wddx
sysvshm
sysvsem
standard
sockets
shmop
session
pspell
posix
pcre
openssl
ncurses
iconv
gmp
gettext
gd
ftp
exif
domxml
dio
dbx
dba
curl
ctype
calendar
bzz
bcmath
zlib
imap
ldap
The exact error call: Call to undefined funtion mysql_connect() in /var/www/html/feedback.php on Line 9
Line 9:
%conn = mysql_connect("localhost");
There are no compiled in modules despite the fact that I am using version 4.2.2. I appreciate the comments despite the fact that I have taken yonks to respond - I learn programming at home and program at work, if that provides explanation. It seems that I need to compile a MySQL module into php. Any pointers here...?
Many Thanks
Mike
-
Aug 29th, 2003, 11:59 AM
#21
Member
Are you using just
Code:
mysql_connect("localhost");
? You may need a username and password, if you've just installed it then there will be user "root" with a blank password:
Code:
mysql_connect("localhost", "root", "");
After that you choose a database to work with:
Code:
mysql_connect("localhost", "root", "");
mysql_select_db("mydb");
<edit />
Doh! Wasn't thinking If its undefined then there's no point to try alternate ways 
For mysql, try configuring PHP with mysql:
./configure --with-mysql
-
Sep 1st, 2003, 01:51 AM
#22
Thread Starter
Fanatic Member
I will have a look at the configure option 2night and report back tomorrow.
Thanks again.....
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|