Jump to content

mysql_connect() [function.mysql-connect]: Unknown MySQL server host!!! HELP PLZ


edwin

Recommended Posts

hye guys i m trying to install one ipn script

but on the second step of installation i m gfetting this error

Warning: mysql_connect() [function.mysql-connect]: Unknown MySQL server host '[localhost]' (1) in /home/scriptt/public_html/ipn/core/class.dibi.php on line 60

Error!

Please check out your database configuration in the config.php file...

 

I have checked mysql database configuration in config.php its perfectly fine and correct and working for other scripts but in this script its not able to create tables

and giving mysql connection error

Here's the class.dibi.php

 

<?php

 

//

// Function: db_quote_smart

// Arguments: $value - a value to be passed in a sql statement;

// Return: quoted value

// Description:

// quotes a string or a number, strip malicious input.

// used to prevent sql injections

//

function db_quote_smart($value)

{

  // Stripslashes

  if (get_magic_quotes_gpc()) {

      $value = stripslashes($value);

  }

  // Quote if not integer

  if (!is_numeric($value)) {

      $value = "'" . mysql_real_escape_string ($value) . "'";

  }

  return $value;

} // end of quote_smart

 

 

 

class DBConnection {

 

var $conn = null;

var $db_name = "";

var $host = "";

var $user = "";

var $pass = "";

// result

var $res = null;

 

 

 

function DBConnection($a_host, $a_user, $a_pass, $a_db_name)

{

 

$this->conn = null;

$this->host = $a_host;

$this->user = $a_user;

$this->pass = $a_pass;

$this->db_name = $a_db_name;

 

 

} // end of DBConnection

 

 

 

function open()

{

 

// close an opened connection

if ($this->conn) {

$this->close();

}

 

$this->conn = mysql_connect($this->host, $this->user, $this->pass, true);

if (FALSE === $this->conn) {

// TODO: throw exception

return (FALSE);

}

 

if (FALSE === mysql_select_db($this->db_name, $this->conn)) {

mysql_close($this->conn);

return (FALSE);

}

 

} // end of open

 

 

function last_insert_id()

{

return (mysql_insert_id($this->conn));

} // end of last_insert_id

 

 

function get_error()

{

return (mysql_error($this->conn));

} // end of get_error

 

 

function get_row()

{

return (mysql_fetch_array($this->res, MYSQL_BOTH));

} // end of get_row

 

function query($a_query)

{

$this->res = mysql_query($a_query, $this->conn);

 

if (FALSE === $this->res) {

return (FALSE);

}

} // end of query

 

 

function close()

{

mysql_close($this->conn);

$this->conn = null;

} // end of close

 

 

 

} // end of DBConnection

 

 

 

?>

 

 

 

Here's the config.php

 

<?

 

/////////////////////////

// Website Definitions //

/////////////////////////

 

//

// this url should point to the ipn directory at your server,

// please remove any trailing backslashes '/' at the end of this url

//

define("IPN_URL", "http://yourdoamin.com/ipn");

//

// this is where you save all your products, it is relative to the ipn directory.

// if you are running a windows hosting then point this to the private_html directory.

// for example it can have a value like this: "../../private_html/products", it is up to you

// to manage/create this directory.

// if you have a linux hosting sevice, then it's better to this value as is

// and not changing anything

//

define("PODUCTS_DIRECTORY",    "products");

//

// enables watermarking for .zip and .rar files.

// if watermarking is enabled (default) then the PayPal transaction id of each downloader

// would be embedded into the product file. If your product would be distributed without your

// premission, you would be able to extract the transaction id from the file and get to the

// person who distributed the file. the watermark is hidden in the file.

//

define("ENABLE_WATERMARKING", 1);

//

// This should be always '0', otherwise it would work with the PaPal Sandbox - developer network.

// Use with extreme careful. Change only if you KNOW what you are doing...

//

define("IPN_DEBUG", 0);

 

 

 

///////////////////

// Email Defines //

///////////////////

 

//

// The following are used to connect to your SMTP mail server to send the emails.

// you'll have to provide the server name, user and password

// consult your hosting company for these details 

//

define("MAIL_SERVER" , "[mail.yourdoamin.com]");

define("MAIL_USER" , "[xyz]");

define("MAIL_PASS" , "[xxxxxx]");

 

/////////////////////////

// Product Definitions //

/////////////////////////

 

//

// these constants defines the email that are being sent to the customer after

// a payment. These values are being used for all of your products. look at these examples:

//

// SEND_PRODUCT_FROM_EMAIL = "sales@yourdomain.com"

// SEND_PRODUCT_FROM_NAME = "Your domain Sales"

// SEND_PRODUCT_SUBJECT = "Thank you for your purchase!"

//

define("SEND_PRODUCT_FROM_EMAIL" , "webmaster@yourdomain.com");

define("SEND_PRODUCT_FROM_NAME" , "Sales");

define("SEND_PRODUCT_SUBJECT" , "Thank you for your purchase!");

 

//

// this is the "send product" email template file.

// edit this file to match your needs, the email format is HTML of course.

// you can specify in the email contents the following fields:

//

// {TXN_ID} - The PayPal transaction ID.

// {PROD_ID} - The id of the product from the database.

// {PROD_NAME} - The name of the product from the database.

// {IPN_BASE_URL} - The URL base to the ipn backend, we need this

//   in order to provide the customer the download link.

//

define("SEND_PRODUCT_EMAIL_FILE_NAME", "send_product_email.html");

 

 

//////////////////////////

// Database Definitions //

//////////////////////////

 

//

// these constant are being used to provide a mysql database connection

// please make sure that the table exists before running IPN.

//

define("EI_DB_HOST", "[localhost]");

define("EI_DB_USER", "[xyz_ipn]");

define("EI_DB_PASS", "[xxxxxxx]");

define("EI_DB_NAME", "[xyz_ipn]");

 

//

// In order to install more than one installation of ipn on the same database,

// you can select different prefixes for the tables ipn creates.

//

define("TBL_PREFIX", "eipn_");

 

?>

 

Please help me out

thanks in advance

Link to comment
Share on other sites

  • 1 year later...

hi, not sure if you still need help but take all the square brackets out of the MySQL code on config.php page,that should fix it  :) you might need to take brackets out of "MAIL_SERVER"  too

 

define("EI_DB_HOST",      "localhost");

  define("EI_DB_USER",      "xyz_ipn");

  define("EI_DB_PASS",      "xxxxxxx");

  define("EI_DB_NAME",      "xyz_ipn"); 

 

  //

  // In order to install more than one installation of ipn on the same database,

  // you can select different prefixes for the tables ipn creates.

  //

  define("TBL_PREFIX",      "eipn_");

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.