aplgsd 发表于 2011-3-21 15:33:05

求助,IIS下无法运行 CodeIgniter

1,在计算机管理的IIS的web网站下新建一个虚拟网站(testCodeigniter)。
2,下载CodeIgniter2.0解压之后放到虚拟网站的指定目录下。
3,打开config.php文件,并进行以下设置:
      $config['base_url'] = 'http://localhost/testCodeIgniter/';
      $config['uri_protocol'] = 'PATH_INFO';
4,打开ie浏览器输入http://localhost/testCodeigniter/ 回车,正常显示welcome页面。
修改 application/views/welcome_message.php中的内容,正常显示
5,在application/controllers/下新建一个blog.php
<?php
class Blog extends CI_Controller {       
        function __construct()
        {
                parent::__construct();
        }       
        function index()
        {
                echo 'hello world!';
        }
}

在ie中输入http://localhost/testCodeigniter/ index.php/blog/报404错
http://localhost/testCodeigniter/ index.php/blog/index/ 报404错
6,修改 routes.php文件
    将$route['default_controller'] = "welcome"; 改为$route['default_controller'] = "blog";
只有http://localhost/testCodeigniter/显示 hello world!
7, 将6的操作回复,安装mod_rewrite
计算机管理的IIS的web网站的属性-->ISAPI里面添加mod_rewrite.dll
mod_rewrite.ini内容如下:
Debug 1
Reload 5000
#Browse LOT
RewriteRule ^/CodeIgniter/.*.php(.*) /CodeIgniter/index.php?$1
RewriteRule ^/CodeIgniter/(.*) /CodeIgniter/index.php?/$1
8,重启IIS服务

打开IE浏览器输入http://localhost/testCodeigniter/index.php/blog 还是报404错。。。

这两天刚接触CI,在网上找了好些资料。尝试了一些解决方法,还是不行,不知道怎么解决了。。。求助!

aplgsd 发表于 2011-3-21 16:21:17

问题补充下,我将7中的
RewriteRule 修改了下
RewriteRule ^/testCodeigniter/.*.php(.*) /testCodeigniter/index.php?$1
RewriteRule ^/testCodeigniter/(.*) /testCodeigniter/index.php?/$1
没有效果。

aplgsd 发表于 2011-3-21 19:36:37

我在家用的apache没有任何问题。。。在公司用IIS,整了一下午都没弄好!

Hex 发表于 2011-3-21 22:51:22

你要看下你的 PHP 支持 PATH_INFO 吗?
PHP 必须安装成 ISAPI 模式的。

aplgsd 发表于 2011-3-22 09:15:29

回复 4# Hex


    是我的PHP没安装好~,谢了!

imcaibaozi 发表于 2012-3-14 17:10:19

Server API         Apache 2.0 Handler 这个是什么意思?
页: [1]
查看完整版本: 求助,IIS下无法运行 CodeIgniter