Error Creating mysqli connection

Asked

Viewed 156 times

0

I’m trying to create a connection by MYSQLI but this giving error Fatal error: Call to Undefined Function mysqli_connect() in /home What could that be? That

$link = mysqli_connect("localhost", "xx", "xxx", "xxx");
if (!$link) {
  echo "Error: Unable to connect to MySQL." . PHP_EOL;
  echo "Debugging errno: " . mysqli_connect_errno() . PHP_EOL;
  echo "Debugging error: " . mysqli_connect_error() . PHP_EOL;
  exit;
}

echo "Success: A proper connection to MySQL was made! The my_db database is great." . PHP_EOL;
echo "Host information: " . mysqli_get_host_info($link) . PHP_EOL;

mysqli_close($link);

inserir a descrição da imagem aqui

  • See if the extension is installed, make a phpinfo()

  • I put an image up with a print of a single record containing mysqli

  • This seems to be the credits, see in php.ini if you have any lines like mysqli if you have a ; remove it and restart apache

  • Which operating system is using?

  • linux na godaddy

  • Is it ubuntu? Edora?

Show 1 more comment

1 answer

1


The error happens because the extension mysqli is not enabled. The phpinfo() that you should seek is Mysqli Support enabled.

Recent Linux versions of the Debian family (such as Ubuntu) have a specific command to enable PHP modules *1:

sudo php5enmod mysqli

and restart apache with

sudo service apache2 restart

Browser other questions tagged

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