E
E
EVOSandru62016-03-17 10:43:38
Yii
EVOSandru6, 2016-03-17 10:43:38

How to configure lamp to catch errors in Yii1?

Good afternoon,
Such a problem, some errors in yii are not caught on my lamp server installed on Debian 8. I'm flying into a gray browser Server error 500 .
You have to blindly look for the error in the files. Usually such a trouble was due to the lack of calling methods of non-existent objects, or to accessing non-existent constants.
Lamp - the most common.
Input index.php : (tried with 3 different error_reporting )

<?php
// error_reporting(E_ALL);
// error_reporting(E_ALL & ~E_NOTICE);
error_reporting(E_ALL & ~(E_NOTICE | E_DEPRECATED | E_STRICT));
define('YII_DEBUG', true);
if($_SERVER['HTTP_HOST'] == 'domen') {
    $yii    = dirname(__FILE__).'/framework/yii.php';
    $config = dirname(__FILE__).'/protected/config/dev.php';
    /** remove the following lines when in produCoction mode */
    defined('YII_DEBUG') or define('YII_DEBUG',true);
}
/** Иначе выключаем режим отладки и подключаем рабочую конфигурацию */
else {
    $yii        =    dirname(__FILE__).'/framework/yiilite.php';
  $config     =    dirname(__FILE__).'/protected/config/production.php';
}
/** specify how many levels of call stack should be shown in each log message */
defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);
require_once($yii);
$app = Yii::createWebApplication($config);
$app->run();

It was possible to fail only in the method
Controller::beforeAction($action){
    echo 'AAAAAAA';
    die();
    return true;
}

In config:
'errorHandler' =>
    [
        'errorAction'=>'site/error',
    ],
    'log' =>
    [
        'class'=>'CLogRouter',
        'routes'=>
        [
            [
                'class'=>'CFileLogRoute',
                'levels'=>'error, warning',
                /*
                 * для красивого вывода запросов в нижнем логе
                 * 'class'=>'CProfileLogRoute'*/
            ],

            // uncomment the following to show log messages on web pages
            /*
            array(
                'class'=>'CWebLogRoute',
            ),
            */
        ],
    ],

What settings to climb to revive YiiDebugger ? I remember on Windows on openserver there were no such problems.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Maxim Timofeev, 2016-03-17
@EVOSandru6

Check the write permissions of the debug log folder. If it worked on LAN, but not on the server, this is the most likely option. The runtime (yii2) folder, I don’t remember for yii1, buried it a long time ago.
And do not forget that on the server in the config you need to register your ip to access the debug. Since by default it is available only from the localhost.

M
Mylistryx, 2016-03-17
@Mylistryx

defined('YII_DEBUG') or define('YII_DEBUG', true);
defined('YII_ENV') or define('YII_ENV', 'dev'); // - this should be added!
Sorry, I didn’t see that it was Yii1, but in theory you also need to turn on the development mode there.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question