Onur ÇİÇEK
Onur ÇİÇEK

Reputation: 39

Blank page on the web server with Codeigniter 4

I uploaded my project to the web server, Following the security recommendations, I placed the CodeIgniter 4 files in the server's non-public directory: /home/user/codeigniter

and And in the public directory: /home/user/public_html

And here is my path: $pathsPath = FCPATH. '../codeigniter/app/Config/Paths.php';

I placed all files properly like;

|__ public_html (or your domain root folder)
| |assets
| |index.php
| |.htaccess
|
|__ codeigniter
|__ app
|__ system
|__ writable
|__ .env

But i always receive a blank page. Could you help me to handle this problem please

And error.log is:

RITICAL - 2020-10-14 06:12:09 --> 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/catideko/...', 101, Array)

Upvotes: 1

Views: 1641

Answers (2)

Onur ÇİÇEK
Onur ÇİÇEK

Reputation: 39

I have solved the problem. The sourche of problem is about "zlib_output_compression" in my host. It should be "off" position. On cpanel after changing the position as "off" everything go well.

Upvotes: 1

user969068
user969068

Reputation: 2943

This is wrong $pathsPath = FCPATH. '../codeigniter/app/Config/Paths.php'; You can not use FCPATH and .. together like that, you have to provide full path, like $pathsPath = '/home/user/codeigniter/app/Config/Paths.php';

Also make sure the path /home/user/codeigniter is accessible by php, either you need to include that path in your php.ini or set in your index.php

set_include_path(get_include_path() . PATH_SEPARATOR . '/home/user/codeigniter');

and than confirm if your path is included

echo get_include_path();

and than confirm if you have updated all paths correctly by following official guidelines

once all setup, make sure your writeable folders has write permissions set. and your App.php includes

public $sessionSavePath          = WRITEPATH . 'session';

Although above setup will work, I suggest you to stick with default composer installation and paths

composer create-project codeigniter4/appstarter project-root

This will insure seamless updates when CI4 is upgraded, to make your app more secure restrict access in your writeable folder, like with nginx/apache you can restrict which type of files could be opened from those folders.

Upvotes: 0

Related Questions