Codeigniter 2共享主机上的静默错误

时间:2015-05-19 10:19:32

标签: php .htaccess codeigniter shared-hosting

的index.php

define('ENVIRONMENT', 'development');

if (defined('ENVIRONMENT'))
{
    switch (ENVIRONMENT)
    {
        case 'development':
            error_reporting(E_ALL);
            ini_set('display_errors', 1);
            ini_set('display_startup_errors', 1);
        break;

        case 'testing':
        case 'production':
            error_reporting(0);
        break;

        default:
            exit('The application environment is not set correctly.');
    }
}

的.htaccess

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L] 

的config.php

$config['base_url'] = 'http://mirror.example.com/';
$config['index_page'] = '';
$config['uri_protocol'] = 'REQUEST_URI';

托管服务提供商使用PHP版本5.3。但我看不到包括错误在内的任何事情。我想这里的任何人都有同样的经历吗?

怎么了?提前谢谢

2 个答案:

答案 0 :(得分:0)

听起来像服务器配置问题 也许是ini_set active的指令“disable_functions” 你有权访问php.ini吗?

如果没有询问您的提供者

其他信息:

我没有看到您的配置存在问题 也许你可以尝试添加以下内容:

    case 'development':
        error_reporting(-1);
        ini_set('display_errors', 1);
    break;

答案 1 :(得分:0)

事实证明它不是服务器,而是编码风格兼容性问题:

我使用它(不支持PHP 5.3

$this->data['current_user'] = $this->user->get_by(array(
'id' => $this->session->userdata('user_session')['user_id']
));

而不是:

$user_session = $this->session->userdata('user_session');

$this->data['current_user'] = $this->user->get_by(array(
'id' => $user_session['user_id']
));

谢谢大家:)

相关问题