Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

532
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda