Error with PHP: undefined function: mysql_connect()
5 answers - 2348 bytes -

Please help. Newbie running Centos 4.2 with mySQL & PHP (binary RPM
install) as per versions given below. Getting error in vegadns package
(DJB TinyDNS GUI) :
Fatal error: Call to undefined function: mysql_connect()
in /
Some diagnostics I ran for info on version etc.:
[root@soochak src]# mysqladmin -u root ping
mysqld is alive
[root@soochak src]# mysqladmin -u root debug
[root@soochak src]# mysqladmin -u root status
Uptime: 200575 Threads: 1 Questions: 11 Slow queries: 0 : 13
Flush tables: 1 tables: 2 Queries per second avg: 0.000
[root@soochak src]# mysqladmin -u root version
mysqladmin Ver 8.41 Distrib 4.1.12, for redhat-linux-gnu on i686
Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
This software comes with ABSLUTELY N WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL license
Server version 4.1.12
Protocol version 10
Connection Localhost via UNIX socket
UNIX socket /home.dbdata/mysql/mysql.sock
Uptime: 2 days 7 hours 43 min 15 sec
Threads: 1 Questions: 12 Slow queries: 0 : 13 Flush tables: 1
tables: 2 Queries per second avg: 0.000
[root@soochak src]# php
PHP 4.3.9 (cgi) (built: Nov 10 2005 20:38:14)
Copyright (c) 1997-2004 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies
051122 16:52:26 mysqld started
051122 16:52:29 InnoDB: Started; log sequence number 0 43634
/usr/libexec/mysqld: ready for connections.
Version: '4.1.12' socket: '/home.dbdata/mysql/mysql.sock' port: 3306
Source di stribution
Status information:
Current dir: /home.dbdata/mysql/
Running threads: 1 Stack size: 196608
Current locks:
lock: 0x8dd82a8:
lock: 0x8db2f40:
Key caches:
default
Buffer_size: 8388600
Block_size: 1024
Division_limit: 100
Age_limit: 300
blocks used: 4
not flushed: 0
w_requests: 4
writes: 4
r_requests: 7
reads: 4
handler status:
read_key: 2
read_next: 0
read_rnd 0
read_first: 2
write: 2
delete 0
update: 0
Table status:
tables: 13
tables: 2
files: 4
streams: 0
Alarm status:
Active alarms: 0
Max used alarms: 1
Next alarm time: 0
[root@soochak log]#
No.1 | | 2519 bytes |
| 
Hello.
From my experience on RH based systems you should install appropriative
rpm (it is php-mysql-5.0.4-10.4 in Fedora, for example).
Sanjay Arora wrote:
Please help. Newbie running Centos 4.2 with mySQL & PHP (binary RPM
install) as per versions given below. Getting error in vegadns package
(DJB TinyDNS GUI) :
Fatal error: Call to undefined function: mysql_connect()
in /
Some diagnostics I ran for info on version etc.:
[root@soochak src]# mysqladmin -u root ping
mysqld is alive
[root@soochak src]# mysqladmin -u root debug
[root@soochak src]# mysqladmin -u root status
Uptime: 200575 Threads: 1 Questions: 11 Slow queries: 0 : 13
Flush tables: 1 tables: 2 Queries per second avg: 0.000
[root@soochak src]# mysqladmin -u root version
mysqladmin Ver 8.41 Distrib 4.1.12, for redhat-linux-gnu on i686
Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
This software comes with ABSLUTELY N WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL license
Server version 4.1.12
Protocol version 10
Connection Localhost via UNIX socket
UNIX socket /home.dbdata/mysql/mysql.sock
Uptime: 2 days 7 hours 43 min 15 sec
Threads: 1 Questions: 12 Slow queries: 0 : 13 Flush tables: 1
tables: 2 Queries per second avg: 0.000
[root@soochak src]# php
PHP 4.3.9 (cgi) (built: Nov 10 2005 20:38:14)
Copyright (c) 1997-2004 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies
051122 16:52:26 mysqld started
051122 16:52:29 InnoDB: Started; log sequence number 0 43634
/usr/libexec/mysqld: ready for connections.
Version: '4.1.12' socket: '/home.dbdata/mysql/mysql.sock' port: 3306
Source di stribution
Status information:
Current dir: /home.dbdata/mysql/
Running threads: 1 Stack size: 196608
Current locks:
lock: 0x8dd82a8:
lock: 0x8db2f40:
Key caches:
default
Buffer_size: 8388600
Block_size: 1024
Division_limit: 100
Age_limit: 300
blocks used: 4
not flushed: 0
w_requests: 4
writes: 4
r_requests: 7
reads: 4
handler status:
read_key: 2
read_next: 0
read_rnd 0
read_first: 2
write: 2
delete 0
update: 0
Table status:
tables: 13
tables: 2
files: 4
streams: 0
Alarm status:
Active alarms: 0
Max used alarms: 1
Next alarm time: 0
[root@soochak log]#
No.2 | | 2887 bytes |
| 
In PHP 4.1 you have to include the mysql.so extension. To do so, you have to
modify php.ini, extensions section
"sheeri kritzer" <awfief (AT) gmail (DOT) comwrote in message
@mail.gmail.com
Sounds like the binary you used did not have PHP compiled with the
MySQL libraries.
If you make a phpinfo() page, does the "Configure Command" section
show a parameter?
-Sheeri
11/24/05, Sanjay Arora <sanjay.k.arora (AT) gmail (DOT) comwrote:
Please help. Newbie running Centos 4.2 with mySQL & PHP (binary RPM
install) as per versions given below. Getting error in vegadns package
(DJB TinyDNS GUI) :
Fatal error: Call to undefined function: mysql_connect()
in /
Some diagnostics I ran for info on version etc.:
[root@soochak src]# mysqladmin -u root ping
mysqld is alive
[root@soochak src]# mysqladmin -u root debug
[root@soochak src]# mysqladmin -u root status
Uptime: 200575 Threads: 1 Questions: 11 Slow queries: 0 : 13
Flush tables: 1 tables: 2 Queries per second avg: 0.000
[root@soochak src]# mysqladmin -u root version
mysqladmin Ver 8.41 Distrib 4.1.12, for redhat-linux-gnu on i686
Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
This software comes with ABSLUTELY N WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL license
Server version 4.1.12
Protocol version 10
Connection Localhost via UNIX socket
UNIX socket /home.dbdata/mysql/mysql.sock
Uptime: 2 days 7 hours 43 min 15 sec
Threads: 1 Questions: 12 Slow queries: 0 : 13 Flush tables: 1
tables: 2 Queries per second avg: 0.000
[root@soochak src]# php
PHP 4.3.9 (cgi) (built: Nov 10 2005 20:38:14)
Copyright (c) 1997-2004 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies
051122 16:52:26 mysqld started
051122 16:52:29 InnoDB: Started; log sequence number 0 43634
/usr/libexec/mysqld: ready for connections.
Version: '4.1.12' socket: '/home.dbdata/mysql/mysql.sock' port: 3306
Source di stribution
Status information:
Current dir: /home.dbdata/mysql/
Running threads: 1 Stack size: 196608
Current locks:
lock: 0x8dd82a8:
lock: 0x8db2f40:
--
Key caches:
default
Buffer_size: 8388600
Block_size: 1024
Division_limit: 100
Age_limit: 300
blocks used: 4
not flushed: 0
w_requests: 4
writes: 4
r_requests: 7
reads: 4
--
handler status:
read_key: 2
read_next: 0
read_rnd 0
read_first: 2
write: 2
delete 0
update: 0
Table status:
tables: 13
tables: 2
files: 4
streams: 0
Alarm status:
Active alarms: 0
Max used alarms: 1
Next alarm time: 0
[root@soochak log]#
>
>
>
>
No.3 | | 2678 bytes |
| 
Sounds like the binary you used did not have PHP compiled with the
MySQL libraries.
If you make a phpinfo() page, does the "Configure Command" section
show a parameter?
-Sheeri
11/24/05, Sanjay Arora <sanjay.k.arora (AT) gmail (DOT) comwrote:
Please help. Newbie running Centos 4.2 with mySQL & PHP (binary RPM
install) as per versions given below. Getting error in vegadns package
(DJB TinyDNS GUI) :
Fatal error: Call to undefined function: mysql_connect()
in /
Some diagnostics I ran for info on version etc.:
[root@soochak src]# mysqladmin -u root ping
mysqld is alive
[root@soochak src]# mysqladmin -u root debug
[root@soochak src]# mysqladmin -u root status
Uptime: 200575 Threads: 1 Questions: 11 Slow queries: 0 : 13
Flush tables: 1 tables: 2 Queries per second avg: 0.000
[root@soochak src]# mysqladmin -u root version
mysqladmin Ver 8.41 Distrib 4.1.12, for redhat-linux-gnu on i686
Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
This software comes with ABSLUTELY N WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL license
Server version 4.1.12
Protocol version 10
Connection Localhost via UNIX socket
UNIX socket /home.dbdata/mysql/mysql.sock
Uptime: 2 days 7 hours 43 min 15 sec
Threads: 1 Questions: 12 Slow queries: 0 : 13 Flush tables: 1
tables: 2 Queries per second avg: 0.000
[root@soochak src]# php
PHP 4.3.9 (cgi) (built: Nov 10 2005 20:38:14)
Copyright (c) 1997-2004 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies
051122 16:52:26 mysqld started
051122 16:52:29 InnoDB: Started; log sequence number 0 43634
/usr/libexec/mysqld: ready for connections.
Version: '4.1.12' socket: '/home.dbdata/mysql/mysql.sock' port: 3306
Source di stribution
Status information:
Current dir: /home.dbdata/mysql/
Running threads: 1 Stack size: 196608
Current locks:
lock: 0x8dd82a8:
lock: 0x8db2f40:
--
Key caches:
default
Buffer_size: 8388600
Block_size: 1024
Division_limit: 100
Age_limit: 300
blocks used: 4
not flushed: 0
w_requests: 4
writes: 4
r_requests: 7
reads: 4
--
handler status:
read_key: 2
read_next: 0
read_rnd 0
read_first: 2
write: 2
delete 0
update: 0
Table status:
tables: 13
tables: 2
files: 4
streams: 0
Alarm status:
Active alarms: 0
Max used alarms: 1
Next alarm time: 0
[root@soochak log]#
>
>
>
>
No.4 | | 377 bytes |
| 
From: "Ciprian Constantinescu" <cc (AT) dmoon-ebusiness (DOT) com>
In PHP 4.1 you have to include the mysql.so extension. To do so, you have
to
modify php.ini, extensions section
better, add that extension runtime because otherwise it will just consume
computer resources, and maybe not every PHP program will need to connect to
MySQL.
Teddy
No.5 | | 374 bytes |
| 
This solution is valid, but not advisable. If you run your server in a
production environment, you shouldn't allow the dl function, as your users
could activate any extension
better, add that extension runtime because otherwise it will just
consume
computer resources, and maybe not every PHP program will need to connect
to
MySQL.
Teddy