Closed Muneeb1998 closed 4 years ago
if (ini_get('zlib.output_compression'))
in your app/Config/Events.php
file?
- What CodeIgniter version are you using?
- Can you check if you have a line
if (ini_get('zlib.output_compression'))
in yourapp/Config/Events.php
file?
It seems your code in BaseController is throwing errors when setting the session path. Can you paste the contents of your BaseController?
`<?php namespace App\Controllers;
/**
use CodeIgniter\Controller; // JAK Cutom: use App\Libraries\App; // JAK Cutom;
class BaseController extends Controller {
/**
* An array of helpers to be loaded automatically upon
* class instantiation. These helpers will be available
* to all other controllers that extend BaseController.
*
* @var array
*/
protected $helpers = [];
/**
* Constructor.
*/
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
{
// Do Not Edit This Line
parent::initController($request, $response, $logger);
//--------------------------------------------------------------------
// Preload any models, libraries, etc, here.
//--------------------------------------------------------------------
// E.g.:.
$this->session = \Config\Services::session();
if(isset($_GET['lang'])){
$this->session->set(array(
'lang' => $_GET['lang']
));
}
// else{
// $this->session->set(array(
// 'lang' => 'English'
// ));
// }
// print_r($_SESSION['lang']);
// $r = (explode('/', uri_string(), 2));
// JAK Cutom:
$this->libraryApp = new App($this);
helper('front');
// JAK Cutom;
}
} `
I guess these line:
$this->libraryApp = new App($this);
helper('front');
I don't know what's in it.
From your answer I see you upgraded to 4.0.4 from lower version, so you don't have a check against zlib.output_compression
in place.
It's either the wrong sessionSavePath
or enabled zlib.output_compression
extension.
I will close this since the problem occurs only on your production server, but if none of the suggestions solve the problem, please feel free to continue the conversation.
i face error when i deploy CodeIgniter 4 project on hosting CRITICAL - 2020-09-26 07:18:24 --> ini_set(): Headers already sent. You cannot change the session module's ini settings at this time
0 [internal function]: CodeIgniter\Debug\Exceptions->errorHandler(2, 'ini_set(): Head...', '/home/p...', 43, Array)
1 /home/mlnacta/public_html/habib_site/app/Controllers/BaseController.php(43): ini_set('session.save_pa...', '')
2 /home/mlnacta/public_html/habib_site/vendor/codeigniter4/framework/system/CodeIgniter.php(891): App\Controllers\BaseController->initController(Object(CodeIgniter\HTTP\IncomingRequest), Object(CodeIgniter\HTTP\Response), Object(CodeIgniter\Log\Logger))
3 /home/mlnacta/public_html/habib_site/vendor/codeigniter4/framework/system/CodeIgniter.php(399): CodeIgniter\CodeIgniter->createController()
4 /home/mlnacta/public_html/habib_site/vendor/codeigniter4/framework/system/CodeIgniter.php(312): CodeIgniter\CodeIgniter->handleRequest(NULL, Object(Config\Cache), false)
5 /home/mlnacta/public_html/habib_site/index.php(44): CodeIgniter\CodeIgniter->run()
6 {main}
CRITICAL - 2020-09-26 07:18:24 --> Uncaught ErrorException: Cannot modify header information - headers already sent by (output started at /home/mlnacta/public_html/habib_site/app/Config/Events.php:27) in /home/mlnacta/public_html/habib_site/vendor/codeigniter4/framework/system/Debug/Exceptions.php:164 Stack trace:
0 [internal function]: CodeIgniter\Debug\Exceptions->errorHandler(2, 'Cannot modify h...', '/home/p...', 164, Array)
1 /home/mlnacta/public_html/habib_site/vendor/codeigniter4/framework/system/Debug/Exceptions.php(164): header('HTTP/1.1 500 In...', true, 500)
2 [internal function]: CodeIgniter\Debug\Exceptions->exceptionHandler(Object(ErrorException))
3 {main}
thrown
0 [internal function]: CodeIgniter\Debug\Exceptions->shutdownHandler()
1 {main}