"This page is not working" error on AWS hosted website

Asked

Viewed 57 times

1

I’m setting up hosting a PHP site on an AWS free server, the login home page is showing up correctly, and when I confirm the form login, it goes to the page that checks the login data, and if the data is correct, it goes to the main page, and if something goes wrong it goes back to the login page with the error message by GET, but loading the check page it gives the error of Esta página não está funcionando, I did some tests giving echo in some parts of the code to verify where it is "locking" and I ended up discovering that the error is in the part of connection to the database, which is hosted on Hostgator. Code of the function connecting to the database:

function conectardb(){
        $conexao = mysqli_connect('host', 'usuario', 'senha', 'banco');
        //testar a conexao
        if (mysqli_connect_errno()) {
            echo "FALHA NA CONEXÃO";
        }

        return $conexao;
    }

The above code is on a separate page, but I tried to use on the same page and the error persists. It does not get to print the FALHA NA CONEXÃO in the if.

The same connection code, connecting to the same host of Hostgator is working properly when the site is hosted locally.

I would like to know if anyone has ever been through a similar situation or has any idea how to resolve it, thanks in advance!

  • The variables used in this function are not in it nor are parameters, maybe you have forgotten a global

  • 1

    @Icaromartins, they’re manually, not in variables, I just put it like this to not show the data in the database, but I put it differently now, I think it’s better for people to read like this

No answers

Browser other questions tagged

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