Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Codeigniter,URL路由失败_Php_Codeigniter_Apache2_Debian - Fatal编程技术网

Php Codeigniter,URL路由失败

Php Codeigniter,URL路由失败,php,codeigniter,apache2,debian,Php,Codeigniter,Apache2,Debian,使用我继承的codeigniter代码库,我试图启动并运行url路由,但它似乎只抛出404个错误 当我转到http://root_url/index.php它很好地命中了默认的控制器/方法,但是当我请求任何特定的控制器/操作时,它会404 如果我请求http://root_url/index.php/auth/loginapache抛出 File does not exist: /var/www/ci_project/index.php/auth/login, referer: http://r

使用我继承的codeigniter代码库,我试图启动并运行url路由,但它似乎只抛出404个错误

当我转到
http://root_url/index.php
它很好地命中了默认的控制器/方法,但是当我请求任何特定的控制器/操作时,它会404

如果我请求
http://root_url/index.php/auth/login
apache抛出

File does not exist: /var/www/ci_project/index.php/auth/login, referer: http://root_url/index.php
看起来apache试图请求一个显然不存在的文件夹,而不是向index.php提供auth/login的uri段

注:

  • 我没有使用任何htaccess文件(没有htaccess文件,代码库应该可以工作)
  • mod_rewrite已启用并由php检测到,尽管我怀疑问题是在命中php之前发生的
  • 我使用的是debian(w/Apache2.2.2),而不是ubuntu(2.2.14)
  • 查询字符串参数工作正常,只是URI段
  • 我没有试图删除index.php,只是让基本的控制器url匹配工作

事实证明,这是debian上的apache配置问题,与codeigniter没有任何关系

我对apache进行了清除/重新安装,似乎解决了这个问题

sudo apt-get purge apache2 apache2-utils apache2.2-bin apache2-common
sudo apt-get autoremove --purge
sudo apt-get install apache2
sudo apt-get install libapache2-mod-php5
我对问题发生的原因的唯一猜测是我 安装的是
libapache2-mod-php5过滤器
(在清除之前我没有意识到这一点),而不是
libapache2-mod-php5
软件包,它无法正确处理URL


谢谢你的帮助。

你能分享你的控制器和配置文件吗?控制器文件就是默认的config.php,控制器就是欢迎控制器。因此,使用新的codeigniter安装将失败。我相信这与apache解析带有正斜杠的参数有关。尝试在url中添加一个
,使其成为
http://root_url/index.php?/auth/login
我认为,您对Tank Auth库的位置做了错误的设置。事实证明,在安装最新版本的apache时,这似乎是一个问题。简单地运行
sudo-apt-get-install-libapache2-mod-php5
似乎就可以了。