【问题标题】:No input file specified. error codeigniter on godaddy未指定输入文件。 Godaddy上的错误codeigniter
【发布时间】:2014-02-06 08:51:10
【问题描述】:

我在godaddy上的一个子目录中安装了Codeigniter,网址是http://westlinebuilders.com/westlinecrm/

登录页面打开正常,但是当我单击登录按钮或访问任何其他控制器时,它显示没有指定输入文件。我在 westlinebuilders.com/westlinecrm 目录中没有任何 .htaccess 文件,我尝试创建新的 htaccess 文件并将其放在 westlinecrm 目录中,并按照有关如何使用谷歌搜索修复无文件输入错误的说明进行操作,但到目前为止还没有运气,可以有人请帮我吗?

我的 verifylogin.php 控制器代码是

 <?php if ( ! defined('BASEPATH')) exit('No direct script access
 allowed');

 class VerifyLogin extends CI_Controller {

  function __construct()  {    parent::__construct();   
 $this->load->model('user','',TRUE);  }

  function index()  {    //This method will have the credentials
 validation    $this->load->library('form_validation');

    $this->form_validation->set_rules('email', 'Email', 'required');   
 $this->form_validation->set_rules('password', 'Password',
 'trim|required|xss_clean|callback_check_database');

    if($this->form_validation->run() == FALSE)    {
      //Field validation failed.&nbsp; User redirected to login page     $this->load->helper('url');
         $this->load->helper('html');    $this->load->view('templates/header');
      $this->load->view('templates/menu');  
      $this->load->view('client/loginform');     $this->load->view('templates/footer');    }    else    {
      //Go to private area
      redirect('summary', 'refresh');    }

  }

  function check_database($password)  {    //Field validation
 succeeded.&nbsp; Validate against database    $username =
 $this->input->post('email');

    //query the database    $result = $this->user->login($username,
 $password);

    if($result)    {
      $sess_array = array();
      foreach($result as $row)
      {
        $sess_array = array(
          'id' => $row->id,
          'email' => $row->email1
        );
        $this->session->set_userdata('logged_in', $sess_array);
      }
      return TRUE;    }    else    {
      $this->form_validation->set_message('check_database', 'Invalid username or password');
      return false;    }  } } ?>

【问题讨论】:

  • 我们可以查看您的verifylogin 控制器代码吗?
  • 您的主目录是否也包含 Codeigniter 项目?
  • 不,我的主目录包含 Wordpress 网站
  • 注释掉索引函数中的所有代码,然后回显 somethis 并检查控件是否到达那里
  • 我已经完成了,但它显示相同的错误

标签: php .htaccess codeigniter


【解决方案1】:

我在 godaddy 的子域中运行 codeignitor。我尝试了上述所有解决方案。但它不起作用。对我来说,RewriteRule 是个问题。

RewriteRule 出了问题

RewriteRule ^index.php/(.*)$ [L]

已更正RewriteRule

RewriteRule ^(.*)$ index.php?/$1 [QSA,L]

所以工作的.htaccess 代码如下。

<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [QSA,L]
</IfModule>

【讨论】:

  • [QSA,L] 选项在使用 CI 3 的 Godaddy 服务器上为我工作。
  • 这在 Godaddy 服务器上也适用于我,Php 5.6.27 和 CI 3
【解决方案2】:

我通过使用以下.htaccess 规则使其工作

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /crm/

RewriteRule ^index\.php$ - [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule . /index.php [L]

RewriteRule ^index.php/(.*)$ [L]
</IfModule>

我创建了一个子域,将所有模型文件的第一个字符重命名为小写,现在它可以工作了

【讨论】:

    【解决方案3】:

    用这个覆盖项目根文件夹中 .htaccess 文件的内容。

    RewriteEngine on
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?/$1 [L]
    

    这将解决它。大多数时候是导致它的csrf。我相信您在配置文件中将其设置为 TRUE。

    如果它现在可以工作,请告诉我。

    【讨论】:

      【解决方案4】:

      http://westlinebuilders.com/westlinecrm/index.php/verifylogin

      你的url解析方法不对,试试用

      http://westlinebuilders.com/westlinecrm/verifylogin

      你为什么不使用简单的 .htaccess 代码...

        RewriteEngine on
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^(.*)$ /westlinecrm/index.php?/$1 [L]
      

      你的代码的另一个问题..应用评论是错误的

        function index()  {    //This method will have the credentials
         validation    $this->load->library('form_validation');
      

      正确的方法

         function index()  {    //This method will have the credentials
         validation    
         $this->load->library('form_validation');
      

      【讨论】:

      • 他的 url 是正确的,除非他没有通过 .htaccess 删除 index.php
      • function index() { //这个方法会有凭证验证 $this->load->library('form_validation');再次检查此代码
      • 我在 westlinecrm 目录中创建了 .htaccess 文件,它给了我 500 内部服务器错误。
      • 我也创建了子域crm.westlinebuilders.com 还是同样的问题,有帮助吗?
      猜你喜欢
      • 2015-09-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-07-24
      • 1970-01-01
      • 1970-01-01
      • 2015-06-08
      • 1970-01-01
      相关资源
      最近更新 更多