?
Solved

Call to undefined function: mysql_connect()

Posted on 2003-03-04
10
Medium Priority
?
373 Views
Last Modified: 2013-12-12
Hi,
I get the following error:
Call to undefined function: mysql_connect()
when I try to connect to a mysql DB.
I have gone through various postings and all point to the fact that PHP was compiled without mysql.
But here is what my phpinfo() shows me:
/configure' 'i386-redhat-linux' '--prefix=/us........
'--with-mysql=shared,/usr' '--with-pgsql=shared'..........
So you see, it is compiled with mysql. All RH 7.3 seem to be giving the same error. It's out-of-the-box RH 7.3 install.
Any help is greatly appreciated.

Thanks,
Bhavin.
0
Comment
Question by:bhavin_v
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
10 Comments
 
LVL 2

Expert Comment

by:laurly
ID: 8069987
if you scoll down in phpinfo() do you see mysql something like

MySQL Support enabled
Active Persistent Links 1
Active Links 1
Client API version 3.23.47
MYSQL_MODULE_TYPE external
MYSQL_SOCKET /tmp/mysql.sock
MYSQL_INCLUDE -I/server/mysql//include/mysql
MYSQL_LIBS -L/server/mysql//lib/mysql -lmysqlclient  


laurly
0
 
LVL 1

Expert Comment

by:spookje
ID: 8081508
Maybe you didn't install the mysql-server itself although
your php-module for apache supports mysql.

Verify this with the command (for RedHat):

rpm -qa | grep mysql

It has to show mysql-versionnumber.

If you need mysql, try:

http://www.mysql.com/downloads/mysql-3.23.html

Also install the mysql-client btw. Very handy - then
you can enter queries in shell mode when you develop code.
0
 
LVL 1

Expert Comment

by:spookje
ID: 8081530
My output on the rpm command show this btw:

$rpm -qa | grep mysql
mysql-server-3.23.54a-4
mod_auth_mysql-1.11-10
mysql-3.23.54a-4
mysqlclient9-3.23.22-6
mysql-devel-3.23.54a-4
php-mysql-4.2.2-8.0.7
0
WordPress Tutorial 3: Plugins, Themes, and Widgets

The three most common changes you will make to your website involve the look (themes), the functionality (plugins), and modular elements (widgets).

In this article we will briefly define each again, and give you directions on how to install them.

 

Author Comment

by:bhavin_v
ID: 8082850
Laurly
I don't see that in phpinfo(). Any idea what is wrong?
Spookie,
I do hve mysql running.
Thanks for you help!
0
 
LVL 1

Expert Comment

by:spookje
ID: 8083596
Perhaps your php.ini file is not ok?

grep -i mysql /etc/php.ini

should give a line like this to include the mysql
shared object into the php module:

extension=mysql.so

Anyway could you show us the output of above command?
0
 

Author Comment

by:bhavin_v
ID: 8083671
Yes, you are right. There isn't a
extension=mysql.so.

Where should I put it in php.ini?
Here is the o/p

;extension=php_mysql.dll
mysql.allow_persistent = On
mysql.max_persistent = -1
mysql.max_links = -1
; Default port number for mysql_connect().  If unset, mysql_connect() will use
; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the
mysql.default_port =
mysql.default_socket =
; Default host for mysql_connect() (doesn't apply in safe mode).
mysql.default_host =
; Default user for mysql_connect() (doesn't apply in safe mode).
mysql.default_user =
; Default password for mysql_connect() (doesn't apply in safe mode).
; *Any* user with PHP access can run 'echo cfg_get_var("mysql.default_password")
mysql.default_password =
0
 
LVL 1

Accepted Solution

by:
spookje earned 200 total points
ID: 8083782
Between the other extensions, the order in my php.ini
is like below, usually though it doesn't matter.

You need to restart apache after changing:

/etc/init.d/httpd restart

Good luck! :-)

;;;;;;;;;;;;;;;;;;;;;;
; Dynamic Extensions ;
;;;;;;;;;;;;;;;;;;;;;;
;
; If you wish to have an extension loaded automaticly, use the following
; syntax:
;
;   extension=modulename.extension
;
; For example, on Windows:
;
;   extension=msql.dll
;
; ... or under UNIX:
;
;   extension=msql.so
;
; Note that it should be the name of the module only; no directory information
; needs to go here.  Specify the location of the extension with the
; extension_dir directive above.

;extension=cpdf.so
;extension=curl.so
;extension=cybercash.so
;extension=db.so
extension=dbg.so
;extension=domxml.so
;extension=dotnet.so
;extension=exif.so
;extension=fdf.so
;extension=gd.so
;extension=gettext.so
;extension=ifx.so
extension=imap.so
;extension=interbase.so
;extension=java.so
extension=ldap.so
;extension=mhash.so
;extension=mssql65.so
;extension=mssql70.so
extension=mysql.so
;extension=oas.so
extension=odbc.so
;extension=oci8.so
;extension=oracle.so
;extension=pdf.so
;extension=pgsql.so
;extension=sablot.so
;extension=swf.so
;extension=sybase_ct.so
;extension=zlib.so
0
 

Author Comment

by:bhavin_v
ID: 8092455
Thanks. I tried enabling
extension=mysql.so
but to no avail. Same problem and no change in phpinfo() either. I am surprised that no one else has ran into this problem because it seems to be common on out-of-the-box RH7.3.
Any other ideas?
Thanks for all the help.
Bhavin.
0
 
LVL 33

Expert Comment

by:snoyes_jw
ID: 9682540
No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation in the Cleanup topic area:

Answered by spookje

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

snoyes_jw
EE Cleanup Volunteer
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
These days socially coordinated efforts have turned into a critical requirement for enterprises.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question