Connection failed: No such file or directory

Greetings, So yesterday my website was doing fine and was working but today
i go to it and it says:

Connection failed: No such file or directory

http://dayquiz.free.nf/

the files are there so i don’t get it.

So i went to verify my files and for some reason when uploading the files, the code in it got doubled up and some files got trippled up. its like the upload thought it failed and copied the code 2 times into the file. that is strange.
has anyone had this issue when you upload that one of your files code gets doubled?

EXAMPLE:

i uploaded a file with

<?php session_start(); session_destroy(); // Destroy the current session header("Location: ../login.php"); // Redirect to your login page or any other desired page exit(); ?>

and it came out in the editor as this:

<?php session_start(); session_destroy(); // Destroy the current session header("Location: ../login.php"); // Redirect to your login page or any other desired page exit(); ?> <?php session_start(); session_destroy(); // Destroy the current session header("Location: ../login.php"); // Redirect to your login page or any other desired page exit(); ?> <?php session_start(); session_destroy(); // Destroy the current session header("Location: ../login.php"); // Redirect to your login page or any other desired page exit(); ?>

That can happen when something goes wrong in the FTP transfer process. You can probably blame the one file manager for that one.

Try re-uploading the files via a desktop ftp client like FileZilla

Can you share your database connection code? Be sure to hide your password

4 Likes

I corrected the files and still get the error

Connection failed: No such file or directory

i added my database connection info and it was working yesterday but today its not.

hmm.


 <?php
 
 //Database connection configuration

$servername = "sql312.infinityfree.com";
 
$username = "if0_HIDDENFORSECURITY";

 $password = "HIDDENFORSECURITY";

$dbname = "HIDDENFORSECURITY_trivia_game";

 // Create a database connection

 $connection = mysqli_connect($servername, $username, $password, $dbname);

 // Check if the connection was successful

if (!$connection) {

die("Connection failed: " . mysqli_connect_error());

 }

 ?>

ok now all the sudden my site is working again.

maybe a hiccup in the sql server connection?

It is loading now so all is good!

Glad to hear it!

2 Likes

As you can see in this troubleshooting article, that error means that you are using localhost as the database host. But your code seems fine now and so does your website, so all is good now.

4 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.