Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

525
Visualizações
Fatal error: Uncaught PDOException: SQLSTATE[HY000] [2002]

Recently I followed a tutorial for making a forum with PHP and MySQL. Then I got this error: Error: parsererror - SyntaxError: Unexpected token < in JSON at position 0
I figured out why it was saying that. There was a error on save.php and which was caused due to a error in conn.php this is the full error on conn.php : Fatal error: Uncaught PDOException: SQLSTATE[HY000] [2002] No such file or directory in /home/runner/AnchoredHeftyTrigger/conn.php:6 Stack trace: #0 /home/runner/AnchoredHeftyTrigger/conn.php(6): PDO->__construct('mysql:host=loca...', 'root', '') #1 {main} thrown in /home/runner/AnchoredHeftyTrigger/conn.php on line 6
This is the code of conn.php:

<?php
session_start();
$db_username = 'root';
$db_password = '';

$conn = new PDO('mysql:host=localhost;dbname=forum', 
                $db_username, $db_password);
if(!$conn){
die("Fatal Error: Connection Failed!");
}

?>

I'm sorry if I'm not giving much information: I'm very new with PHP and JSON

about 4 years ago · Santiago Trujillo
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda