2013-05-06 46 views
0

我试图在网上部署一个基于PHP应用程序时遇到以下错误:如何修复调用未定义的函数mysqli_connect()

Call to undefined function mysqli_connect() in home/spurdes/public_html/testsites/crimebusters/Repository/SQL_Connection.php on line 27. 

这里是第27行:

$this->connection= mysqli_connect($this->connectionHost,$this->userName,$this->password,$this->dbName); 

这里是我的phpinfo

我没有获得php.init

+0

可能重复http://stackoverflow.com/questions/8551398/call-to-undefined-function-mysql-connect – 2013-05-06 05:54:34

+0

普利文的differnce的是,我没有访问php.ini – 2013-05-06 05:56:15

+2

然后更改主机 – 2013-05-06 05:57:15

回答

1

你的东东d一个mysqli php扩展。联系主机或更改托管服务。

0

你需要

dl("mysqli.so"); 
2

我需要一个网站从商业虚拟主机移动到虚拟服务器在你的PHP脚本中添加该代码。我在Windows Server 2008的IIS中使用php和mysql。我通过执行以下操作解决了mysqli_connect问题。

  • 我在php.ini文件中取消了注释extension = php_mysql.dll,extension = php_mysqli.dll和extension = php_pdo_mysql.dll。

在我的php文件中,我有一个包含mysqli_connect函数的_construct函数。这种运作良好,在Apache和Unix服务器上,但不是在IIS和Windows Server 2008以下是代码:

<?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....... 
} 
?> 

注:值分配给$连接工作,我没有别的办法。这是至少12小时的互联网搜索和试错编码的结果。我是一个新手编码器。它可能不漂亮,但它的工作原理。我希望这有帮助。

-1

这是一个PHP vesrion问题

  1. you replace mysqli_connect() to mysql_connect()
    or
  2. contact to server guys to upgrade your version
+0

它与PHP版本无关,但使用PHP扩展... – Marki555 2015-07-06 18:35:43

相关问题