I am trying to deploy a php based application online and getting following error:
Call to undefined function mysqli_connect() in home/spurdes/public_html/testsites/crimebusters/Repository/SQL_Connection.php on line 27.
Here is line 27:
$this->connection= mysqli_connect($this->connectionHost,$this->userName,$this->password,$this->dbName);
Here is my phpinfo
I dont have access to php.init
You need a mysqli php extension. Contact to hoster or change hosting service.
You need to add this code in your PHP script
dl("mysqli.so");
I was required to move a website from a commercial web host to a virtual server. I am using php and mysql in IIS on Windows Server 2008. I solved the mysqli_connect problem by doing the following.
In my php file I had a class with a _construct function that included the mysqli_connect function. This works well in Apache and on the Unix server but not in IIS and Windows Server 2008. Here is the code:
<?php
class MyClass
{
var $tablename="t_table";
var $connection;
public function __construct() {
$this->connection = new MySQLi("host", "user", "password", "dbname", "port")or die("Error connecting " . mysqli_error($connection));
}
//functions that use $this->connection and $tablename are here.......
}
?>
Note: No other way of assigning a value to $connection worked for me. This is the result of at least 12 hours of internet searching and trial and error coding. I am a novice coder. It may not be pretty but it works. I hope this helps.
It is a php vesrion problem
- you replace mysqli_connect() to mysql_connect()
or- contact to server guys to upgrade your version