-2

我是 Php 的新手,因为这个问题已经被问过好几次了.... : Internal Server Error 服务器遇到内部错误或配置错误,无法完成您的请求。请联系服务器管理员 admin@localhost 并告知他们错误发生的时间,以及您所做的任何可能导致错误的事情。服务器错误日志中可能提供有关此错误的更多信息。

已更改 index.php 的这两行 **

<?php
// change the following paths if necessary
$yii=dirname('C://wamp/www/yii-1.1.8.r3324/framework/yii.php').'/../yii-1.1.8.r3324/framework/yii.php';
$config=dirname('C://wamp/www/examapp/protected/config/main.php').'/protected/config/main.php';
// remove the following lines when in production mode
defined('YII_DEBUG') or define('YII_DEBUG',true);
// specify how many levels of call stack should be shown in each log message
defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);
require_once($yii);
Yii::createWebApplication($config)->run();

根据我在这里添加的路径,对吗?

// change the following paths if necessary
$yii=dirname('C://wamp/www/yii-1.1.8.r3324/framework/yii.php').'/../yii-1.1.8.r3324/framework/yii.php';
$config=dirname('C://wamp/www/examapp/protected/config/main.php').'/protected/config/main.php';

错误报告:

文件不存在:C:/wamp/www/favicon.ico [2014 年 2 月 18 日星期二 11:07:41] [错误] [客户端 127.0.0.1] 文件不存在:C:/wamp/www/favicon.ico [2014 年 2 月 18 日星期二 11:09:44] [错误] [客户端 127.0.0.1] 文件不存在:C:/wamp/www/wamp [2014 年 2 月 18 日星期二 11:09:52] [警报] [客户端 127.0 .0.1] C:/wamp/www/examapp/.htaccess:无效命令“RewriteEngine”,可能拼写错误或由服务器配置中未包含的模块定义 [Tue Feb 18 11:10:04 2014] [alert] [client 127.0.0.1] C:/wamp/www/examapp/.htaccess:无效命令“RewriteEngine”,可能拼写错误或由服务器配置中未包含的模块定义 [2014 年 2 月 18 日星期二 11:15:48] [警报] [客户端 127.0.0.1] C:/wamp/www/examapp/.htaccess: 无效命令 'RewriteEngine',可能拼写错误或由服务器配置中未包含的模块定义 [Tue Feb 18 11:15:50 2014] [alert] [client 127.0.0.1] C:/wamp/www/examapp/.htaccess: Invalid command 'RewriteEngine' ,可能拼写错误或由服务器配置中未包含的模块定义 [Tue Feb 18 11:16:47 2014] [alert] [client 127.0.0.1] C:/wamp/www/examapp/.htaccess: Invalid command 'RewriteEngine ',可能拼写错误或由服务器配置中未包含的模块定义 [Tue Feb 18 11:16:48 2014] [alert] [client 127.0.0.1] C:/wamp/www/examapp/.htaccess: Invalid command ' RewriteEngine',可能拼写错误或由服务器配置中未包含的模块定义 [Tue Feb 18 11:16:51 2014] [alert] [client 127.0.0.1] C:/wamp/www/examapp/.htaccess: Invalid command '重写引擎',可能拼写错误或由服务器配置中未包含的模块定义 [Tue Feb 18 11:18:50 2014] [alert] [client 127.0.0.1] C:/wamp/www/examapp/.htaccess: Invalid command 'RewriteEngine' ,可能拼写错误或由服务器配置中未包含的模块定义 [Tue Feb 18 11:20:03 2014] [alert] [client 127.0.0.1] C:/wamp/www/examapp/.htaccess: Invalid command 'RewriteEngine ',可能拼写错误或由服务器配置中未包含的模块定义 [Tue Feb 18 11:23:26 2014] [alert] [client 127.0.0.1] C:/wamp/www/examapp/.htaccess: Invalid command ' RewriteEngine',可能拼写错误或由服务器配置中未包含的模块定义 [Tue Feb 18 11:24:32 2014] [alert] [client 127.0.0.1] C:/wamp/www/examapp/.htaccess: Invalid command '重写引擎',可能拼写错误或由服务器配置中未包含的模块定义 [Tue Feb 18 11:26:41 2014] [alert] [client 127.0.0.1] C:/wamp/www/examapp/.htaccess: Invalid command 'RewriteEngine' ,可能拼写错误或由服务器配置中未包含的模块定义 [Tue Feb 18 11:27:26 2014] [alert] [client 127.0.0.1] C:/wamp/www/examapp/.htaccess: Invalid command 'RewriteEngine ',可能拼写错误或由服务器配置中未包含的模块定义 [Tue Feb 18 11:27:27 2014] [alert] [client 127.0.0.1] C:/wamp/www/examapp/.htaccess: Invalid command ' RewriteEngine',可能拼写错误或由服务器配置中未包含的模块定义 [Tue Feb 18 11:31:20 2014] [alert] [client 127.0.0.1] C:/wamp/www/examapp/.htaccess: Invalid command '重写引擎',可能拼写错误或由未包含在服务器配置中的模块定义

4

1 回答 1

1

我猜你只需要为 yii.php 和 main.php 文件指定绝对路径。

所以我认为以下几行应该可以正常工作。

$yii='C://wamp/www/yii-1.1.8.r3324/framework/yii.php';
$config='C://wamp/www/examapp/protected/config/main.php';

您也可以使用dirname(__FILE__)获取当前目录并相对于该目录设置文件的路径,这将是更好的解决方案。

于 2014-02-18T06:16:25.053 回答