Answer the question
In order to leave comments, you need to log in
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();
Controller::beforeAction($action){
echo 'AAAAAAA';
die();
return true;
}
'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',
),
*/
],
],
Answer the question
In order to leave comments, you need to log in
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.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question