Is that a server error?

Asked

Viewed 51 times

0

I have developed an application in which on my local server is working perfectly. So when I put on the web server is returning me the following error:

Fatal error: Class 'mysqli' not found in

Can anyone tell me if this is a web server error or not? And if that’s not how I fix it?

Here the connection code:

<?php

$servidor = "local";
$usuario = "usuario";
$senha = "senha";
$tabela = "nomedabase";

$conexao = new mysqli($servidor, $usuario, $senha, $tabela);

if ($conexao->connect_error) {
    die("Erro: " . $conexao->connect_error);
}

$busca = $_POST['palavra'];
$cidade = $_POST ['cidade'];

$sql = "SELECT * FROM empresa WHERE nome LIKE '%$busca%' AND cidade = '$cidade'";
$resultados = $conexao->query($sql);


if ($resultados->num_rows > 0) {
    while($linha = mysqli_fetch_array($resultados)) {
        print("<strong>Nome: </strong>" . $linha['nome'] . "</br>");
        print ("<strong>Endereço: </strong>" . $linha['endereco']."</br>");
        if( isset($_POST['cidade']) && $_POST['cidade'] === 'sao-gabriel-da-palha' ) {
            $fromPerson = 'São Gabriel da Palha';
            echo "<strong>Cidade: </strong>".$fromPerson."</br>";
        }
        print ("<strong>Telefone: </strong>" . $linha['telefone']."</br>");
        echo "<strong>email: </strong>". $linha['email']."</br>";
        echo "<hr>";
    }
} else {
    echo "Nenhum resultado para a sua busca.";
}

$conexao->close();
  • Would you show the connection code ?

  • I edited there putting the connection code, I believe everything is ok, because it is working on the localhost server, only on the web server that is giving this fatal error

  • 1

    It has happened to me a lot when I put something on the error web server and not on the local server... I noticed that in fact it was because the web server used another type of bar to create the file path... Example: wamp/www/meuprojeto/aaaa.php on the web server would look like this: wamp\www\meuprojeto\aaaa.php ...

  • More where are these bars I must reverse???

  • Mysqli is native to PHP, so there should be no error in autoload. What can be is the extension is not enabled on your server. See function return phpinfo() on the server and check that the extension is installed.

  • The server can also be at case-sensitive then the class instance should be uppercase and minuscule. Try this: new Mysqli

  • @Everaldocost is all the same: https://secure.php.net/manual/en/mysqli.construct.php

  • @Andersoncarloswoss see what I got back in phpinfo...http://guianortecapixaba.com.br/versao.php

  • In fact it does not seem to have the extension installed. Try to contact the hosting support.

  • So what do I say to them? To install the msqli extension?? is that it!!

Show 5 more comments

1 answer

2


The solution was to change the PHP version, because it was in 5.2 on the web server and in the local was 7.0... then I changed the server and solved the problem!

Browser other questions tagged

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