Click to See Complete Forum and Search --> : php4 cannot connect with mysql


Anon
06-11-2001, 07:41 PM
This error come out :

Fatal error: Call to undefined function: mysql_connect() in /home/azah/public_html/test2.php on line 4

The program on line 4 :
$dbku = mysql_connect("localhost", "koff", "koff123");

FYI : mysql and php4 install using ports

Please HELP

corsc
06-11-2001, 07:54 PM
This means that mysql support has not been enabled.

If unix, then recompile with mysql support

If windows, uncomment the appropriate line under the heading extensions, in the php.ini file.

should be similar to extension=php_mysql.dll

Anon
06-12-2001, 12:46 PM
If you are using the csh do the following:
cd /usr/ports/www/php4 (for OpenBSD)
setenv FLAVOR mysql
make
make install

otherwise try:
FLAVOR="mysql" make install

hth

Anon
06-12-2001, 06:42 PM
Scott,

how to recompile with mysql support?

Anon
06-12-2001, 06:50 PM
Philip...

I'm try to do your suggestion.. but still not work..

Command :

FLAVOR="mysql" make install

is not found

Anon
06-13-2001, 04:19 AM
what shell are you using?
(look at the output of \"echo $SHELL\")
If it says \"/bin/sh\" or \"/bin/ksh\" you could use \"FLAVOR=\'mysql\' make install.

I assume you are typing your commands on a root shell which is normally the csh (output of \"echo $SHELL\" is \"/bin/csh\").

There you have to use the \"setenv\" command to set enviroment variables. Try
\"setenv FLAVOR mysql\", cd to the directory of the php port, make and make install.
This should work.

If this does not work and you are using an OpenBSD system (i am not sure how this is one Free/NetBSD) look at the tail of /etc/rc.conf
There should be a line \"shlib_dirs=/usr/local/lib/mysql\". Maybe this is similar on FreeBSD.

Another suggestions is looking at the output of the sample startup script (it may be located in \"/usr/local/lib/mysql\" and is named \"startup.sh\".

If you are getting an error concerning libpthread.so you should change the line that says something similar to \"/sbin/ldconfig -m /usr/local/lib/mysql\" to \"sbin/ldconfig -m /usr/local/lib/pth /usr/local/lib/mysql\"

That was a problem that occured to me when installing the 2.9OpenBSD port of mysql.

hth