Skip to content

Instantly share code, notes, and snippets.

@bizley
Created September 2, 2014 11:23
Show Gist options
  • Save bizley/f7c87d4e7d93be3d708e to your computer and use it in GitHub Desktop.
Save bizley/f7c87d4e7d93be3d708e to your computer and use it in GitHub Desktop.
Yii 1.1 index.php file with output buffering
<?php
$yii = dirname(__FILE__) . '/framework/yii.php';
$config = dirname(__FILE__) . '/protected/config/main.php';
if (isset($_SERVER['REMOTE_ADDR']) && in_array($_SERVER['REMOTE_ADDR'], array('127.0.0.1'))) {
defined('YII_DEBUG') or define('YII_DEBUG', true);
ini_set('display_errors', 'on');
error_reporting(E_ALL);
}
else {
defined('YII_DEBUG') or define('YII_DEBUG', true);
}
defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);
require_once($yii);
date_default_timezone_set('Europe/Warsaw');
$app = Yii::createWebApplication($config);
$app->onBeginRequest = function($event) {
return ob_start('ob_gzhandler');
};
$app->onEndRequest = function($event) {
return @ob_end_flush();
};
$app->run();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment