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 ?
– Everaldo Filho
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
– WPfan
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
...– Everaldo Filho
More where are these bars I must reverse???
– WPfan
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.– Woss
The server can also be at
case-sensitive
then the class instance should be uppercase and minuscule. Try this: new Mysqli– Everaldo Filho
@Everaldocost is all the same: https://secure.php.net/manual/en/mysqli.construct.php
– Woss
@Andersoncarloswoss see what I got back in phpinfo...http://guianortecapixaba.com.br/versao.php
– WPfan
In fact it does not seem to have the extension installed. Try to contact the hosting support.
– Woss
So what do I say to them? To install the msqli extension?? is that it!!
– WPfan