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?
mysql_connect Not a defined function?
Moderator: General Moderators
use something like this and tell what do you want :
- 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
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();
}- 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
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
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
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