运行beanbooks的安装部分时出现php / kohana错误

时间:2019-03-17 01:35:29

标签: php ubuntu kohana

问题

我已经安装了 beansbooks ,并且已进入最后一步,但是当我进入localhost / install时,出现以下错误:

  

发生致命错误:Session_Exception [1]:读取会话数据时出错。消息中出现“ ErrorException”异常   'mysql_select_db()期望参数2为资源,给定布尔值'   在   /var/www/html/modules/database/classes/kohana/database/mysql.php:105   堆栈跟踪:#0 [内部函数]:Kohana_Core :: error_handler(2,   'mysql_select_db ...','/ var / www / html / m ...',105,数组)#1   /var/www/html/modules/database/classes/kohana/database/mysql.php(105):   mysql_select_db('kohana',false)#2   /var/www/html/application/classes/database/mysql.php(75):   Kohana_Database_MySQL-> _ select_db('kohana')#3   /var/www/html/modules/database/classes/kohana/database/mysql.php(430):   Database_MySQL-> connect()#4   /var/www/html/modules/database/classes/kohana/database.php(478):   Kohana_Database_MySQL-> escape('5c8da306617b91 -...')#5 [内部   函数]:Kohana_Database-> quote('5c8da306617b91 -...')#6   /var/www/html/modules/database/classes/kohana/database/query.php(190):   array_map(Array,Array)#7   /var/www/html/modules/database/classes/kohana/database/query/builder/select.php(413):   Kohana_Database_Query-> compile(Object(Database_MySQL))#8   /var/www/html/modules/database/classes/kohana/database/query.php(228):   Kohana_Database_Query_Builder_Select->编译(Object(Database_MySQL))

     

9 /var/www/html/modules/database/classes/kohana/session/database.php(131):

     

Kohana_Database_Query-> execute(Object(Database_MySQL))#10   /var/www/html/modules/database/classes/kohana/session/database.php(111):   Kohana_Session_Database-> _ regenerate()#11   /var/www/html/system/classes/kohana/session.php(300):   Kohana_Session_Database-> _ read(NULL)#12   /var/www/html/system/classes/kohana/session.php(125):   Kohana_Session-> read(NULL)#13   /var/www/html/modules/database/classes/kohana/session/database.php(74):   Kohana_Session-> __ construct(Array,NULL)#14   /var/www/html/system/classes/kohana/session.php(54):   Kohana_Session_Database-> __ construct(Array,NULL)#15   /var/www/html/application/classes/controller/view.php(49):   Kohana_Session :: instance()#16   /var/www/html/application/classes/controller/exception.php(27):   Controller_View-> before()#17 [内部函数]:   Controller_Exception-> before()#18   /var/www/html/system/classes/kohana/request/client/internal.php(103):   ReflectionMethod-> invoke(Object(Controller_Exception))#19   /var/www/html/system/classes/kohana/request/client.php(64):   Kohana_Request_Client_Internal-> execute_request(Object(Request))#20   /var/www/html/system/classes/kohana/request.php(1154):   Kohana_Request_Client-> execute(Object(Request))#21   /var/www/html/application/classes/kohana/exception.php(25):   Kohana_Request-> execute()#22 [内部函数]:   Kohana_Exception :: handler(Object(Session_Exception))#23 {main}〜   SYSPATH / classes / kohana / session.php [325]

我该如何解决这个问题?

系统

  

php5

     

Ubuntu 14.04

     

MySQL 5.5

     

apache2

1 个答案:

答案 0 :(得分:0)

连接数据库时遇到问题,因为没有返回资源,只是错误。

您有几种选择:

  • 重新检查配置中的连接数据
  • 切换到PDO数据库驱动程序
  • 库中的快速入侵:

UPDATE assets JOIN asset_types ON assets.asset_type_id = asset_types.asset_type_id, JOIN assignment_station ON assets.assignment_station_id=assignment_station.assignment_station_id, JOIN asset_statuses ON assets.asset_status_id = asset_statuses.asset_status_id SET assets.asset_type_id = 1, assignment_station.assignment_station_name ='Foxdale Court', assignment_station.assignment_station_manager ='John Dole', assignment_station.assignment_station_manager_number = '09887765433', asset_statuses.asset_status_id =3 WHERE assets.asset_id=1 方法MODPATH\database\classes\Kohana\Database\MySQL.php之前,您要添加connect()

$this->_select_db($database);

注意:PDO存在一个不支持自动发现模型的问题。但是调试连接就足够了。

嗯,这可以根据现有技术完成,而无需修改模块:

创建文件:if(!$this->_connection) throw new Database_Exception(':error', array(':error' => mysql_error()), mysql_errno());

APPPATH\classes\Database\MySQL.php