虚拟机部署问题,该怎么解决

startmvc php框架学习社区

技术交流社区
虚拟机部署问题,该怎么解决
chenchinglang 普通会员 时间:2024-02-18 15:43:40 浏览:416

虚拟主机空间的部署方法:

为了方便虚拟主机的用户使用,我们做了优化兼容,方法如下:

1.将/public/下的index.php以及.htaccess文件移动到项目目录下

2.修改index.php文件中的

<font color="#353535">define('ROOT_PATH', realpath(__DIR__.DS.'..'.DS).DS);    // 入口文件在 public 中
//define('ROOT_PATH', dirname(__FILE__).DS);    // 入口文件在项目根目录</font>

修改为:

<p style="margin-bottom: 10px; color: rgb(54, 54, 54); white-space-collapse: collapse; padding: 0px; box-sizing: border-box; background-color: rgb(255, 255, 255);"><span style="color: rgb(53, 53, 53);">//</span><font color="#353535">define('ROOT_PATH', realpath(__DIR__.DS.'..'.DS).DS);    // 入口文件在 public 中</font></p>
<p style="margin-bottom: 10px; color: rgb(54, 54, 54); white-space-collapse: collapse; padding: 0px; box-sizing: border-box; background-color: rgb(255, 255, 255);"><font color="#353535">define('ROOT_PATH', dirname(__FILE__).DS);    // 入口文件在项目根目录</font></p>

出现错误

// 系统目录分隔符

define('DS', DIRECTORY_SEPARATOR);

// 项目根目录

//define('ROOT_PATH', realpath(__DIR__.DS.'..'.DS).DS);    // 入口文件在 public 中

define('ROOT_PATH', dirname(__FILE__).DS);    // 入口文件在项目根目录

require(ROOT_PATH .'startmvc'.DS.'boot.php');


DEBUG提示

异常:SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES)
文件:D:\phpstudy_pro\WWW\startmvc\core\Db.php
行号:109
跟踪:
#0 D:\phpstudy_pro\WWW\startmvc\core\Controller.php(32): startmvc\core\Db->__construct(Array)
#1 D:\phpstudy_pro\WWW\app\common\BaseController.php(17): startmvc\core\Controller->__construct()
#2 [internal function]: app\common\BaseController->__construct()
#3 D:\phpstudy_pro\WWW\startmvc\core\Loader.php(18): ReflectionClass->newInstanceArgs(Array)
#4 D:\phpstudy_pro\WWW\startmvc\core\Loader.php(34): startmvc\core\Loader::getInstance('app\\home\\contro...')
#5 D:\phpstudy_pro\WWW\startmvc\core\App.php(102): startmvc\core\Loader::make('app\\home\\contro...', 'indexAction', Array)
#6 D:\phpstudy_pro\WWW\startmvc\core\App.php(89): startmvc\core\App::startApp('home', 'app\\home\\contro...', 'indexAction', Array)
#7 D:\phpstudy_pro\WWW\startmvc\core\App.php(28): startmvc\core\App::getRoute()
#8 D:\phpstudy_pro\WWW\startmvc\boot.php(45): startmvc\core\App->run()
#9 D:\phpstudy_pro\WWW\index.php(16): require('D:\\phpstudy_pro...')
#10 {main}

回复列表
1个回复
shaobing2024-02-18 05:01:53
数据库配置信息有误回复