Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The mysqli_connect not working

Tags:

php

mysql

I installed apache, php and mysql. Now when I execute the php code, the mysqli_connect() is not working, neither it's showing the message in die.

$dbc=mysqli_connect(' ', ' ', ' ', ' ') or die('not connecting');

Now someone tell me what database username shall I pass to mysqli_connect and what password. I don't remember I was asked for any username or password and why isn't the message in die() showing up?

My var_dump(function_exists('mysqli_connect')); outputs bool(false).. if it has anything to do with it, how do I correct it.?

like image 318
Kraken Avatar asked Jun 02 '11 09:06

Kraken


People also ask

What does the mysqli_connect () function return?

The mysqli_connect() function establishes a connection with MySQL server and returns the connection as an object.

What is the difference between Mysql_connect and mysqli_connect?

The mysqli_connect() function in PHP is used to connect you to the database. In the previous version of the connection mysql_connect() was used for connection and then there comes mysqli_connect() where i means improved version of connection and is more secure than mysql_connect().

How configure MySQLi in PHP?

It'll automatically enable the mysqli extension for the PHP because connect using mysql is deprecated in PHP 7. If not an Ubuntu user then you can just rename php-prodcution. ini file to php. ini and enable the extension by removing semicolon in the php.

What is new MySQLi in PHP?

PHP offers two different ways to connect to MySQL server: MySQLi (Improved MySQL) and PDO (PHP Data Objects) extensions. While the PDO extension is more portable and supports more than twelve different databases, MySQLi extension as the name suggests supports MySQL database only.


1 Answers

Looks like MySQLi extension is not installed. What does var_dump(function_exists('mysqli_connect')); output?

like image 88
binaryLV Avatar answered Oct 20 '22 00:10

binaryLV