Page 1 of 1

mysql_connect Not a defined function?

Posted: Wed Jun 26, 2002 11:11 pm
by slik66
I have one Computer functioning as a server set up running Red Hat 7.3 with Apache, PHP4, and the latest version of mySQL installed on it. It parses PHP files fine but chokes whenever I issue a mysql_connect command with a fatal error saying it is not a defined function. My code is similar to:

$connection = mysql_connect(blahblahblah);

I have already set up a user/password for mySQL and can connect to it fine on my local machine. As far as I know, the mySQL_connect function is natively integrated into the PHP language so I shouldn't have to add anything else. This code works just fine on a hosted account I have, I just can't get it to work on my own personal server. Does anyone have any ideas?

Posted: Thu Jun 27, 2002 4:53 am
by Mahmoud
use something like this and tell what do you want :

Code: Select all

$dbcn = @mysql_connect( "database server", "username", "password" );
     if (!$dbcn) {
	echo( "<p>Unable to connect to the " .
	"database server at this time.</p>" );
	exit();
     &#125;

- notice that you almost all the hosting providers only allow connection to the Database from the same server.
- make sure that the mysql server is already running
- make sure that the username and the password are correct

Posted: Thu Jun 27, 2002 5:01 am
by twigletmac
It looks like PHP has been compiled without mysql support. Check out the installation guide:
http://www.php.net/manual/en/install.apache.php

A full list of compile options is available here: http://www.php.net/manual/en/install.configure.php

Mac