WAM Mysqli不工作,而Mysql工作 [英] WAMP Mysqli not working whereas Mysql works
问题描述
我最近从Windows 7升级到Windows 10,并安装了WAMP。这是我第一次与WAMP合作。
我在我的一个Codeigniter项目中收到以下错误消息我在Windows 7安装程序,我不知道什么做它。
消息:mysqli :: real_connect(): HY000 / 2002):连接尝试失败,因为连接的对方在一段时间后没有正确响应
,或由于
连接的主机未能响应而建立连接失败。
这是我的数据库配置设置:
$ db ['default'] = array(
'dsn'=>'',
'hostname'=>'localhost',
'username'=> ',
'password'=>'',
'database'=>'studentx',
'dbdriver'=>'mysqli',
'dbprefix' =>',
'pconnect'=> FALSE,
'db_debug'=> TRUE,
'cache_on'=> FALSE,
'cachedir'= >'',
'char_set'=>'utf8',
'dbcollat'=>'utf8_general_ci',
'swap_pre'=>'',
'encrypt'=> FALSE,
'compress'=> FALSE,
'stricton'=> FALSE,
'failover'=> array(),
'save_queries'=> TRUE
);
如果我改变'dbdriver'=> 'mysqli',
部分配置为'dbdriver'=>
发生了什么事?
首先,请确保 php.ini 文件正在加载 mysqli 扩展程序。如何检查
点击wamp图标(任务栏)系统托盘中的图标
转到PHP - > PHP扩展并确保 php_mysqli 。
如果不是,那么
进入php.ini文件,并确保行:extension = php_mysqli.dll未注释(例如,删除;如果存在)。如果该行不存在,请添加它。
php.ini路径
C:\wamp\bin\apache\Apache *。。 \bin\php.in
I upgraded from Windows 7 to Windows 10 recently, and installed WAMP. This is my first time working with WAMP.
I am getting following error message in one of my Codeigniter project I was working in windows 7 setup and I don't know what to make of it. The page keeps on loading and loading and then fails with the error message.
Message: mysqli::real_connect(): (HY000/2002): A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
This is my database config settings :
$db['default'] = array(
'dsn' => '',
'hostname' => 'localhost',
'username' => 'root',
'password' => '',
'database' => 'studentx',
'dbdriver' => 'mysqli',
'dbprefix' => '',
'pconnect' => FALSE,
'db_debug' => TRUE,
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'encrypt' => FALSE,
'compress' => FALSE,
'stricton' => FALSE,
'failover' => array(),
'save_queries' => TRUE
);
If I change 'dbdriver' => 'mysqli',
part of the config to 'dbdriver' => 'mysql',
then it works with the warning of deprecated mysql extension.
What's going on ?
First, make sure that the php.ini file is loading the mysqli extension.
How to check Click on wamp icon (taskbar) the icon in the system tray , go to PHP -> PHP Extensions and make sure php_mysqli is checked. If not then go into the php.ini file and make sure that the line: extension=php_mysqli.dll is uncommented (eg, remove the ; if it exists). If that line does not exist, add it.
php.ini path C:\wamp\bin\apache\Apache*..\bin\php.in
这篇关于WAM Mysqli不工作,而Mysql工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!