Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mysqli::real_connect(): (HY000/2002): Connection refused on Live

I create a web site using PHP, Mysql, and Codeignater version 3. Then host it on iPage. When I upload on live I make changes in config file.

$db['default'] = array(
    'dsn'   => '',
    'hostname' => '66.96.147.118',
    'username' => 'bit_root',
    'password' => 'root',
    'database' => 'bit_shilp',
    'dbdriver' => 'mysqli',
    'dbprefix' => '',
    'pconnect' => FALSE,
    'db_debug' => (ENVIRONMENT !== 'production'),
    'cache_on' => FALSE,
    'cachedir' => '',
    'char_set' => 'utf8',
    'dbcollat' => 'utf8_general_ci',
    'swap_pre' => '',
    'encrypt' => FALSE,
    'compress' => FALSE,
    'stricton' => FALSE,
    'failover' => array(),
    'save_queries' => TRUE
);

I use codeignater version 3. On local it work great. But on live site It gives an error.

Please see this link http://bitshilp.com/BitShilp/index.php/home

It gives an error like this:

A PHP Error was encountered

Severity: Warning

Message: mysqli::real_connect(): (HY000/2002): Connection refused

Filename: mysqli/mysqli_driver.php

Line Number: 161

Backtrace:

File: /hermes/bosnaweb13a/b2582/ipg.bitshilpcom/BitShilp/application/controllers/Home.php Line: 7 Function: __construct

File: /hermes/bosnaweb13a/b2582/ipg.bitshilpcom/BitShilp/index.php Line: 292 Function: require_once A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at /hermes/bosnaweb13a/b2582/ipg.bitshilpcom/BitShilp/system/core/Exceptions.php:272)

Filename: core/Common.php

Line Number: 568

Backtrace:

File: /hermes/bosnaweb13a/b2582/ipg.bitshilpcom/BitShilp/application/controllers/Home.php Line: 7 Function: __construct

File: /hermes/bosnaweb13a/b2582/ipg.bitshilpcom/BitShilp/index.php Line: 292 Function: require_once

Thanks.

like image 340
sandip chandak Avatar asked Jan 25 '26 13:01

sandip chandak


1 Answers

If MySQL Server is up and running - then this looks like some transport (e.g. firewall) problem. First step is to try telnet command below - if it shows an error, then problem is not related to PHP or MySQL :

telnet 66.96.147.118 3306 

(On success it will print mysql version + some random characters)

like image 132
noonex Avatar answered Jan 27 '26 02:01

noonex