简体   繁体   中英

Codeigniter 2 silent error on 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';

The hosting provider use PHP version 5.3. But I can't see anything including errors. I wonder is anybody here ever feel the same experience ?

What's wrong? thanks in advance

sounds like a server configuration problem maybe is the directive "disable_functions" for ini_set active do you have access to the php.ini ?

if not ask your provider

additional information:

i don't see a problem in your configuration maybe you can try to add the following:

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

It turns out that it is not the server, but coding style compatibility issue:

I use this ( not support by PHP 5.3 )

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

Instead of:

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

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

Thanks everyone :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM