我知道这里已经有类似的问题被问到了,但是我不得不开始一个新问题,因为我所遇到的情况实际上与已经提出的问题不同。
问题如下:我正在一台连接到网络的机器上安装一款名为 2-Plan Team 的开源网络软件,供我们所有团队成员访问。我在 MySQL 上为 2-Plan Team 设置了一个数据库,并创建了用户名和密码。由于出现错误,我仍然停留在安装阶段:
在我尝试创建第一个用户(该用户应该是该软件的根/超级用户)后发生了此错误。
我实际上是通过 Web 浏览器使用该软件的 install.php 文件来安装该软件的。我在 Web 根文件夹(即 /var/www/html)中设置了一个名为 2plan 的目录。我在 mysql 中为该软件创建了一个名为 2plandb 的数据库,并设置了用户名和密码。
按照安装过程中的提示操作后,我遇到一个屏幕,要求我通过添加用户名和密码来创建第一个用户。当我添加详细信息并单击创建/添加按钮时,标题中的错误以及错误:无法创建初始角色。当我在 mysql 工作台中检查创建的第一个用户的 2plandb 时,它实际上存在于表中,但角色表是空的。
是否可能由于 MySQL 根用户和 2-Plan Team 根用户的用户帐户存在冲突而导致无法创建角色,从而导致标题出现错误?
看看install.php
文件中的角色对象代码:
// create the first user
$usr = new user();
$usrid = $usr->add($user, "", 0, $pass);
if (!$usrid)
{
$template->assign("errortext", "Error: Failed to create first user.");
$template->display("error.tpl");
die();
}
// insert default roles
$rolesobj = new roles();
$rootrid = $rolesobj->add("Root",
array("add" => 1, "edit" => 1, "del" => 1 , "close" => 1),
array("add" => 1, "edit" => 1, "del" => 1, "close" => 1),
array("add" => 1, "edit" => 1, "del" => 1, "close" => 1),
array("add" => 1, "edit" => 1, "del" => 1, "close" => 1),
array("add" => 1, "edit" => 1, "del" => 1),
array("add" => 1, "edit" => 1, "del" => 1, "read" => 1),
array("add" => 1, "edit" => 1, "del" => 1),
array("root" => 1, "add" => 1),
array("read" => 1, "write" => 1)
);
$adminrid = $rolesobj->add("Admin",
array("add" => 1, "edit" => 1, "del" => 1 , "close" => 1),
array("add" => 1, "edit" => 1, "del" => 1, "close" => 1),
array("add" => 1, "edit" => 1, "del" => 1, "close" => 1),
array("add" => 1, "edit" => 1, "del" => 1, "close" => 1),
array("add" => 1, "edit" => 1, "del" => 1),
array("add" => 1, "edit" => 1, "del" => 1, "read" => 1),
array("add" => 1, "edit" => 1, "del" => 1),
array("add" => 1),
array("read" => 1, "write" => 1)
);
$projectrid = $rolesobj->add("Project Manager",
array("add" => 1, "edit" => 1, "del" => 1, "close" => 1),
array("add" => 1, "edit" => 1, "del" => 1, "close" => 1),
array("add" => 1, "edit" => 1, "del" => 1, "close" => 1),
array("add" => 1, "edit" => 1, "del" => 1, "close" => 1),
array("add" => 1, "edit" => 1, "del" => 1),
array("add" => 1, "edit" => 1, "del" => 1, "read" => 1),
array("add" => 1, "edit" => 1, "del" => 1),
array("add" => 0),
array("read" => 1, "write" => 1)
);
$userrid = $rolesobj->add("User",
array("add" => 1, "edit" => 1, "del" => 0, "close" => 0),
array("add" => 1, "edit" => 1, "del" => 0, "close" => 1),
array("add" => 1, "edit" => 1, "del" => 1, "close" => 1),
array("add" => 1, "edit" => 1, "del" => 1, "close" => 1),
array("add" => 1, "edit" => 1, "del" => 1),
array("add" => 1, "edit" => 1, "del" => 1, "read" => 0),
array("add" => 0, "edit" => 0, "del" => 0),
array("add" => 0, "edit" => 0, "del" => 0),
array("read" => 0, "write" => 0)
);
$clientrid = $rolesobj->add("Client",
array("add" => 0, "edit" => 0, "del" => 0, "close" => 0),
array("add" => 0, "edit" => 0, "del" => 0, "close" => 0),
array("add" => 0, "edit" => 0, "del" => 0, "close" => 0),
array("add" => 0, "edit" => 0, "del" => 0, "close" => 0),
array("add" => 0, "edit" => 0, "del" => 0),
array("add" => 0, "edit" => 0, "del" => 0, "read" => 0),
array("add" => 0, "edit" => 0, "del" => 0),
array("add" => 0, "edit" => 0, "del" => 0),
array("read" => 0, "write" => 0)
);
if (!$rootrid or !$adminrid or !$projectrid or !$userrid or !$clientrid)
{
$template->assign("errortext", "Error: Failed to create initial roles.");
$template->display("error.tpl");
die();
}
$rolesobj->assign($rootrid, $usrid, true);
/*basecamp import, disabled
if (isset($_FILES["importfile"]))
{
$importer = new importer();
$myfile = new datei();
// import basecamp file
$up = $myfile->upload("importfile", "files/" . CL_CONFIG . "/ics", 0);
if ($up)
{
$importer->importBasecampXmlFile(CL_ROOT . "/files/" . CL_CONFIG . "/ics/$up");
}
}
*/
$template->display("install3.tpl");
}