I downloaded a codeIgniter project from server and I tried to run it on my localhost, I am not really familiar with PHP,Mysql, I used different advice in stackoverflow and google to set up the environment but stil I have some errors, I appreciated if you can help me for in set up!
I used MAMP as a local server
Here is my error:
Here is my database.php
$active_group = ENVIRONMENT;
$active_record = TRUE;
$db['development']['hostname'] = 'mysqli:host=localhost';
$db['development']['username'] = 'root';
$db['development']['password'] = 'pass';
$db['development']['database'] = 'test';
$db['development']['dbdriver'] = 'mysqli';
$db['development']['dbprefix'] = '';
$db['development']['pconnect'] = TRUE;
$db['development']['db_debug'] = FALSE;
$db['development']['cache_on'] = FALSE;
$db['development']['cachedir'] = '';
$db['development']['char_set'] = 'utf8';
$db['development']['dbcollat'] = 'utf8_general_ci';
$db['staging']['hostname'] = 'mysqli:host=localhost';
$db['staging']['username'] = 'mgr';
$db['staging']['password'] = 'test';
$db['staging']['database'] = 'bmg';
$db['staging']['dbdriver'] = 'mysqli';
$db['staging']['dbprefix'] = '';
$db['staging']['pconnect'] = TRUE;
$db['staging']['db_debug'] = FALSE;
$db['staging']['cache_on'] = FALSE;
$db['staging']['cachedir'] = '';
$db['staging']['char_set'] = 'utf8';
$db['staging']['dbcollat'] = 'utf8_general_ci';
Here is mysqli_driver.php
function escape_str($str, $like = FALSE)
{
if (is_array($str))
{
foreach ($str as $key => $val)
{
$str[$key] = $this->escape_str($val, $like);
}
return $str;
}
if (function_exists('mysqli_real_escape_string') AND is_object($this->conn_id))
{
$str = mysqli_real_escape_string($this->conn_id, $str);
}
elseif (function_exists('mysql_real_escape_string'))
{
$str = mysql_real_escape_string($str);
}
else
{
$str = addslashes($str);
}
if ($like === TRUE)
{
$str = str_replace(array('%', '_'), array('\\%', '\\_'), $str);
}
return $str;
}
Appreciated any Help.
Update
Here is the list of extensions
; Extensions
;extension=apcu.so
extension=imap.so
extension=yaz.so
extension=mcrypt.so
extension=gettext.so
extension=pgsql.so
extension=pdo_pgsql.so
extension=pdo_mysql.so
I added -> extension=pdo_mysqli.so
;extension=imagick.so
;extension=tidy.so
;extension=oauth.so
I checked my php info and I saw mysqli enable
but in my folder I do not have any mysql.sock
You can updated in CodeIgniter as follows:
$db = get_instance()->db->conn_id;
$data = json_decode(file_get_contents("php://input"));
$secrectKey = mysqli_real_escape_string($db,$data->secrectKey);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.