CodeIgniter's default controller doesn't load

萝らか妹 提交于 2019-12-25 14:29:13

问题


I have inherited an on-going CI v2.0.2 project.

I tried loading the default controller - http://localhost/ci202/index.php - but all I got was a blank page.

I enabled logging for all messages, and here's the log:

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

DEBUG - 2012-10-05 23:55:41 --> Config Class Initialized
DEBUG - 2012-10-05 23:55:41 --> Hooks Class Initialized
DEBUG - 2012-10-05 23:55:41 --> Utf8 Class Initialized
DEBUG - 2012-10-05 23:55:41 --> UTF-8 Support Enabled
DEBUG - 2012-10-05 23:55:41 --> URI Class Initialized
DEBUG - 2012-10-05 23:55:41 --> Router Class Initialized
DEBUG - 2012-10-05 23:55:41 --> No URI present. Default controller set.
DEBUG - 2012-10-05 23:55:41 --> Output Class Initialized
DEBUG - 2012-10-05 23:55:41 --> Security Class Initialized
DEBUG - 2012-10-05 23:55:41 --> Input Class Initialized
DEBUG - 2012-10-05 23:55:41 --> Global POST and COOKIE data sanitized
DEBUG - 2012-10-05 23:55:41 --> Language Class Initialized
DEBUG - 2012-10-05 23:55:41 --> Loader Class Initialized
DEBUG - 2012-10-05 23:55:41 --> Helper loaded: url_helper
DEBUG - 2012-10-05 23:55:41 --> Database Driver Class Initialized

To get this log, I only re-loaded index.php once.

The contents of routes.php & .htaccess are the same as the default installation of CI v2.0.2.

I tried creating another 'helloworld' type controller, which was a replica of the welcome controller, but still get a blank page.

Where else should I look for misconfiguration?


回答1:


This may help you to find the problem.

  1. Make sure the database connection is successful
  2. If you enabled output compression from CI config file, disable it from config.php:

    $config['compress_output'] = FALSE;

  3. Change the default environment setting from index.php todevelopment`, so you can see any errors that may occur in the application:

    define('ENVIRONMENT', 'development');



来源:https://stackoverflow.com/questions/12757211/codeigniters-default-controller-doesnt-load

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!