mysql_connect Not a defined function?

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
slik66
Forum Newbie
Posts: 1
Joined: Wed Jun 26, 2002 11:11 pm
Location: Monterey, California

mysql_connect Not a defined function?

Post 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?
Mahmoud
Forum Newbie
Posts: 13
Joined: Tue Jun 25, 2002 5:21 pm

Post 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
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post 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
Post Reply