Call to undefined function: mysql_connect()

  • Willy
  • Graduate
  • Graduate
  • Willy
  • Posts: 199

Post 3+ Months Ago

I am running a redhat 8 server, with php 4.2 (came with install) and i rpm'd mysql client/server 4.0.13. My problem is that apache / php is not recognizgin my mysql connects. WHen i look in php info i see that it is built --with-mysql

I've read around a lot, and it seems there should be a php-mysql rpm, i in fact found the one for the versions ihave but it needs a libmysqlclient.so.10 dependancy

as i try to solve this dependancy i just get cross dependancys :(

~justin
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • Bigwebmaster
  • Site Admin
  • Site Admin
  • User avatar
  • Posts: 9090
  • Loc: Seattle, WA & Phoenix, AZ

Post 3+ Months Ago

So are you saying when you try to install the dependency, it then says that it needs the other first?

Try installing both at the same time if this is the case, all on the same line. That way they won't complain that they need the other first, as they will both have each other. So for example you could go something like

rpm -ivh libmysqlclient.rpm php-mysql.rpm

(Note, I am guessing on the rpm names)

Hopefully I understood you right. Let me know.
  • Willy
  • Graduate
  • Graduate
  • Willy
  • Posts: 199

Post 3+ Months Ago

Nice, the rpm's installed succesfully with the 2 in one line technique. I'm still getting the connect error however!!

i got htis warning on the RPM : warning: /etc/php.d/mysql.ini created as /etc/php.d/mysql.ini.rpmnew

after the connect was still not working i renamed these files so that .ini.rpmnew was just .ini ... The .ini file contains only one line :
; Enable mysql extension module
extension=mysql.so

when i run locate on my box i can only find "/var/lib/mysql/mysql.sock"

~j
  • Bigwebmaster
  • Site Admin
  • Site Admin
  • User avatar
  • Posts: 9090
  • Loc: Seattle, WA & Phoenix, AZ

Post 3+ Months Ago

Do you have MySQL actually running? You can check a few ways:

/etc/rc.d/init.d/mysqld status

or

ps auxw | grep mysql

and see if you have any processes running. In order for your scripts to work the MySQL daemon has to be going. Also are you sure you are using the right username and password in your scripts to connect to the MySQL database you had created for that script?
  • Bigwebmaster
  • Site Admin
  • Site Admin
  • User avatar
  • Posts: 9090
  • Loc: Seattle, WA & Phoenix, AZ

Post 3+ Months Ago

What exactly does your phpinfo tell you. Paste it here.
  • Willy
  • Graduate
  • Graduate
  • Willy
  • Posts: 199

Post 3+ Months Ago

Ok, i cant find mysql in that rcd./init
This is where i run all my deamos from which is iwerd. I know i rpm'd mysql, and previously went in and made a table. I guess i just assumed it to be up and running correctly.

i was going to rule out the username / password thing because php dosent even recognize mysql, but i guess i dont HAVE to with this stupid issue.

i deff ran:
rpm -Uvh MySQL-client-4.0.13-0.i386.rpm and
rpm -Uvh MySQL-server-4.0.13-0.i386.rpm
does redhat packet manager auto put these things in rc.d???

i'm kinda hung up on idiocy now, files i have located :
/etc/rc.d/rc3.d/S20mysql
*thought that would start it at boot??
/usr/sbin/mysqld
*appears to be doing nothing...

mysql itself appears to be in /usr/bin/mysql
when i run it ::
[root@localhost bin]# ./mysql
ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

well, things felt like they were getting lcose, now i feel a turn ofr the worse has happend... Any suggestions?

~justin

ohh and php.info can be seen at http://www.brahh.com
  • Bigwebmaster
  • Site Admin
  • Site Admin
  • User avatar
  • Posts: 9090
  • Loc: Seattle, WA & Phoenix, AZ

Post 3+ Months Ago

pintoumd wrote:
ohh and php.info can be seen at http://www.brahh.com


That url says server not found for me.

Also did you check to see if any mysqld processes are even running by typing:

ps auxw | grep mysql

from a command console?
  • Willy
  • Graduate
  • Graduate
  • Willy
  • Posts: 199

Post 3+ Months Ago

I guess the internet is down over at the apartment...


i did run the process lookup command, and couldn't find mysql. It was giving me that funny connect msg a la the end of 2 posts ago when i tried to get on.

~justin
  • Bigwebmaster
  • Site Admin
  • Site Admin
  • User avatar
  • Posts: 9090
  • Loc: Seattle, WA & Phoenix, AZ

Post 3+ Months Ago

Hmm interesting, when you installed Redhat 8 are you sure you checked all the packages for MySQL ?

Also it just seems weird to me that you have this startup script:

/etc/rc.d/rc3.d/S20mysql

but you do not have anything located here:

/etc/rc.d/init.d/mysql

Try this. Goto the /etc/rc.d/rc3.d/ directory and type:

ls -la

and see where /etc/rc.d/rc3.d/S20mysql is linking to. If it is flashing it means its linking to a link that no longer exists. So post here where its linking and let us know if its flashing or not. Usually it would be linking to /etc/rc.d/init.d/mysqld

On my server you can see that it links there. When I type the ls -la command I can see that it shows:

S78mysqld -> ../init.d/mysqld

which means its linking to the actually mysqld script in the init.d directory.
  • Willy
  • Graduate
  • Graduate
  • Willy
  • Posts: 199

Post 3+ Months Ago

http://www.brahh.com should be up now
  • b_heyer
  • Web Master
  • Web Master
  • User avatar
  • Posts: 4581
  • Loc: Maryland

Post 3+ Months Ago

I had a problem like this in Mandrake 9 where it doesn't recognize "mysql_free_results()" haven't fixed it yet, kind of a bummer :(
  • Willy
  • Graduate
  • Graduate
  • Willy
  • Posts: 199

Post 3+ Months Ago

[root@localhost rc3.d]# ls /etc/rc.d/rc3.d/
K05saslauthd K50tux S09isdn S15httpd S26apmd S56rawdevices S95anacron
K15postgresql K70aep1000 S10network S17keytable S28autofs S56xinetd S95atd
K20nfs K70bcm5820 S12syslog S20random S45named S80sendmail S97rhnsd
K24irda S05kudzu S13portmap S24pcmcia S50vsftpd S85gpm S99local
K25squid S08iptables S14nfslock S25netfs S55sshd S90crond
[root@localhost rc3.d]# locate mysql | grep rc.d
/etc/rc.d/init.d/mysql
/etc/rc.d/rc0.d/K20mysql
/etc/rc.d/rc1.d/K20mysql
/etc/rc.d/rc2.d/K20mysql
/etc/rc.d/rc3.d/S20mysql
/etc/rc.d/rc4.d/K20mysql
/etc/rc.d/rc5.d/K20mysql
/etc/rc.d/rc6.d/K20mysql
  • Bigwebmaster
  • Site Admin
  • Site Admin
  • User avatar
  • Posts: 9090
  • Loc: Seattle, WA & Phoenix, AZ

Post 3+ Months Ago

Oh, you have a mysql startup script, its just called mysql and not mysqld. Try typing this in your command console:

/etc/rc.d/init.d/mysql status

and see what it says. If it says its not running type:

/etc/rc.d/init.d/mysql start

then type this again:

/etc/rc.d/init.d/mysql status

and make sure its going. Let me know your results.
  • Willy
  • Graduate
  • Graduate
  • Willy
  • Posts: 199

Post 3+ Months Ago

# ls /etc/rc.d/init.d/
aep1000 bcm5820 httpd keytable network portmap saslauthd syslog
anacron crond iptables killall nfs postgresql sendmail tux
apmd functions irda kudzu nfslock random single vsftpd
atd gpm isdn named nscd rawdevices squid xinetd
autofs halt kdcrotate netfs pcmcia rhnsd sshd

no mysql file in here...

on a locate i find the following:
/usr/bin/mysql

then

# /usr/bin/mysql status
ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
that poops out
same thing when i try to run it
i jsut tried to locate mysql.sock ... couldnt find it!?!

should i try re-rpming the mysql ? ? (i'm not exactly sure what command i use to overwrite a rpm install) ... Also, Mysql did not come with my redhat 8 installation. Only apache and php did {to clear up any confusion, i think you mentioned it in the previous msg}

thx
~justin
  • Bigwebmaster
  • Site Admin
  • Site Admin
  • User avatar
  • Posts: 9090
  • Loc: Seattle, WA & Phoenix, AZ

Post 3+ Months Ago

Did you install Redhat? or is did someone else? If you installed Redhat it comes with it, you might just have to make sure you check the packages to be installed. If you are able to reinstall the entire server I would do that and goto custom and make sure you select all packages you think you want.

If someone else installed the server or you do not have access to reinstall the server (or do not want to) then maybe reinstalling MySQL (if it was ever really installed) would be the best way. Type

man rpm

That should give you instructions on how to uninstall an RPM if you want to do that. If you cannot figure it out let us know.
  • Willy
  • Graduate
  • Graduate
  • Willy
  • Posts: 199

Post 3+ Months Ago

I installed rh myself. In fact this was the second install of it i did on the box. THe first one i did standard install, this one i picked custom specificly for the purpose of getting mysql and php. I told it i wanted databasing.. i dunnea what happend


~j
  • skittles239
  • Born
  • Born
  • skittles239
  • Posts: 4

Post 3+ Months Ago

It seems that MySql in indeed installed.
Try /usr/bin/safe_mysqld &
This should start mysql no problem
After entering the command, type ps ax
you should see a bunch of mysql processes running
  • Daemonguy
  • Moderator
  • Web Master
  • User avatar
  • Posts: 2700
  • Loc: Somewhere outside the box in Sarasota, FL.

Post 3+ Months Ago

That particular error most probably means that php was compiled without MySQL support. (In some cases the default is Postgres -- can't keep up with all the sundry Linux distros. )
You will need to enable it in the php config, then recompile.
You can find out if it is installed by making a page with just this on it:
<?php
echo phpinfo();
?>
Then look at the page.

More than likely, you do not have support compiled into php, and you'll have to add it to the config file.

Cheers.

Post Information

  • Total Posts in this topic: 18 posts
  • Users browsing this forum: No registered users and 11 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.