[Techtalk] Fatal error: Call to undefined function: mysql_connect()
Mike Clark
nuts at coconutisland.com
Sat Jan 25 06:52:51 EST 2003
Hi LinuxChix
On this machine PHP is unable to connect to MySQL.
Debian linux kernel 2.2.19
PHP version 4.0.3pl1,
MySQL distribution 3.22.32 on port 3306.
The PHP string
$link = mysql_connect( "localhost", "user", "password" )
produces this error message
Fatal error: Call to undefined function: mysql_connect()
The user & password are correct.
Replacing "localhost" with the IP number produces the same error.
Perl connects perfectly to mysql with the DBI module:
DBI->connect
PHP works perfectly with other functions.
phpinfo shows this configure command:
../configure' '--prefix=/usr' '--with-apxs=/usr/bin/apxs'
'--with-regex=system' '--with-config-file-path=/etc/php4/apache'
'--enable-calendar' '--with-db' '--without-dom' '--enable-filepro'
'--enable-ftp' '--with-gettext' '--enable-sysvsem' '--enable-sysvshm'
'--enable-track-vars' '--enable-trans-sid' '--disable-debug'
'--disable-static' '--with-gd=shared' '--with-imap=shared'
'--with-ldap=shared,/usr' '--with-mm' '--with-mhash=shared'
'--with-mysql=shared,/usr' '--with-regex=system' '--with-pcre-regex=/usr'
'--with-pgsql=shared,/usr' '--with-snmp=shared' '--enable-sockets'
'--with-ttf' '--enable-freetype-4bit-antialias-hack' '--with-t1lib'
'--with-xml=shared,/usr' '--with-yp' '--with-zlib'
these loaded modules:
mod_php4, mod_setenvif, mod_unique_id, mod_expires, mod_auth, mod_access,
mod_rewrite, mod_alias, mod_userdir, mod_cgi, mod_dir, mod_autoindex,
mod_include, mod_status, mod_negotiation, mod_mime, mod_log_config,
mod_macro, mod_perl, mod_so, http_core
Debian sometimes has some strange paths.
The /etc/my.cnf file shows
socket = /var/run/mysqld/mysqld.sock
This symbolic link has to be made after reboot, before mysql will work:
ln -s /var/run/mysqld/mysqld.sock /tmp/mysql.sock
I plugged this socket value into /etc/php4/apache/php.ini:
===================
; 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
; compile-time value defined MYSQL_PORT (in that order). Win32 will only
look
' at MYSQL_PORT.
mysql.default_port =
; Default socket name for local MySQL connects. If empty, uses the built-in
; MySQL defaults.
mysql.default_socket = /var/run/mysqld/mysqld.sock
; 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).
; Note that this is generally a *bad* idea to store passwords in this file.
; *Any* user with PHP access can run 'echo
cfg_get_var("mysql.default_password")
; and reveal this password! And of course, any users with read access to
this
; file will be able to reveal the password as well.
mysql.default_password =
===================
Rebooted (again), still get the Fatal error.
On another forum, this suggestion was made:
"One thing to try:
Look in php.ini for a line that reads something like ";extension=mysql.so"
and uncomment it. "
I did it, still no joy.
I suspect that the mysql.so lib is not available to PHP, but I am not up to
speed on PHP installation. My friend who did the install is unavailable.
Is this like a Perl lib:
/usr/local/lib/site_perl/i386-linux/auto/DBD/mysql/mysql.so
Can the mysql.so be installed in a lib directory somewhere, or does
apache/PHP need to be recompiled with the module present?
Does anybody have any ideas?
Thanks
Mike Clark
nuts at coconutisland.net
www.coconutisland.com
www.gogettem.com
www.resumerobot.com
www.healthcarehiring.com
www.super-kids.com
More information about the Techtalk
mailing list