I can not connect to mysql on the web server

-1

You are experiencing the following error:

  

Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE [HY000] [2003] Can not connect to MySQL server on' IPservidorweb '(111)' in app / class_universo.php: 59   Stack trace: # 0 app / class_universo.php (59):   PDO-> __ construct ('mysql: host = IPwebserver', 'universe', 'password') # 1

     

app / load_users.php (15): class_universo-> connect () # 2

     

perfil.php (13): include_once ('/ var / www / html / a ...') # 3

     

{main} thrown in app / class_universo.php on line 59

  public function connect() {



$dbhost = $this->host;

$dbport = 3306;

$dbname = 'universia';

$dsn = "mysql:host={$dbhost};port={$dbport};dbname={$dbname}";



$this->link = new PDO($dsn, $this->username, $this->password); /*linha 59*/

$this->link->exec("set names utf8");

$this->connected = true;

}

    
asked by anonymous 02.06.2016 / 01:33

1 answer

0

vlw for the help ... solved !!

I used this link and it worked perfectly: link

    
02.06.2016 / 04:13