cannot connect with mysql on the web server

Asked

Viewed 220 times

-1

You are showing the following error:

Fatal error: Uncaught Exception 'Pdoexception' with message 'SQLSTATE[HY000] [2003] Can’t connect to Mysql server on 'Ipservidorweb' (111)' in app/class_universe.php:59 Stack trace: #0 app/class_universo.php(59): PDO->__Construct('mysql:host=Ipservidorweb', 'universe', 'password') #1

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

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

{main} thrown in app/class_universe.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;

}

  • And what is your code? The error points to an irregularity on line 59 of the file class_universo.php. Have you checked what’s in it? Whenever you ask a question, provide the codes so we can analyze.

  • Post the code and point to which line such error is addressed!

  • Celsom, vlw the tip.... mue problem is that on host site works perfect. This error trims when I upload the application to production server. I think it’s some Ubuntu configuration, because I can’t connect to mysqlworkbench...I’ll edit the post

1 answer

0

Browser other questions tagged

You are not signed in. Login or sign up in order to post.