CodeIgniter Forums
Blank page on the web server - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: Blank page on the web server (/showthread.php?tid=76105)

Pages: 1 2 3


Blank page on the web server - PHS - 04-14-2020

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:

Code:
/home/user/project

And in the public directory:

Code:
/home/user/public_html

I left the codeigniter's public archives:

index.php
.htaccess
robots.txt

In the index.php file, I set the path to the codeigniter's root directory:

PHP Code:
$pathsPath FCPATH'../project/app/Config/Paths.php'


After these settings I see a blank page!

What else should I do to make the system work properly?


RE: Blank page on the web server - John_Betong - 04-14-2020

@PHS,
> What else should I do to make the system work properly?

I would add this line to index.php and ensure it is being called:

file: index.php
Code:
<?php
echo __line__; exit;

// remaining script should not be called



RE: Blank page on the web server - PHS - 04-15-2020

The index and Paths.php file are recognized and are being called!

The subdirectories in the project are with permission 755, and the files with permission 644


RE: Blank page on the web server - John_Betong - 04-15-2020

Have you tried setting the environment to 'development' and...

./app/Config/Logger.php->public $threshold = 3; // 0..9 (none...all messages)

then check the following which should show progress and where the failure occurrs

./writable/logs/log-2020-04-15.log


RE: Blank page on the web server - PHS - 04-15-2020

These errors are returning:

PHP Code:
<?php defined('SYSTEMPATH') || exit('No direct script access allowed'); ?>

CRITICAL - 2020-04-15 14:13:43 --> 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/user/pr...', 101, Array)
#1 /home/user/project/vendor/codeigniter4/framework/system/Session/Handlers/FileHandler.php(101): ini_set('session.save_pa...', '/home/user/pr...')
#2 /home/user/project/vendor/codeigniter4/framework/system/Config/Services.php(765): CodeIgniter\Session\Handlers\FileHandler->__construct(Object(Config\App), 'xxx.xxx.xx.xx')
#3 /home/user/project/vendor/codeigniter4/framework/system/Config/BaseService.php(123): CodeIgniter\Config\Services::session(Object(Config\App), false)
#4 /home/user/project/vendor/codeigniter4/framework/system/Config/Services.php(754): CodeIgniter\Config\BaseService::getSharedInstance('session', NULL)
#5 /home/user/project/vendor/codeigniter4/framework/system/Common.php(879): CodeIgniter\Config\Services::session()
#6 /home/user/project/app/Controllers/MainController.php(23): session()
#7 /home/user/project/vendor/codeigniter4/framework/system/CodeIgniter.php(882): App\Controllers\MainController->__construct()
#8 /home/user/project/vendor/codeigniter4/framework/system/CodeIgniter.php(393): CodeIgniter\CodeIgniter->createController()
#9 /home/user/project/vendor/codeigniter4/framework/system/CodeIgniter.php(306): CodeIgniter\CodeIgniter->handleRequest(NULL, Object(Config\Cache), false)
#10 /home/user/public_html/index.php(45): CodeIgniter\CodeIgniter->run()
#11 {main}
CRITICAL - 2020-04-15 14:13:43 --> Uncaught ErrorException: Cannot modify header information - headers already sent by (output started at /home/user/project/app/Config/Events.php:25) in /home/user/project/vendor/codeigniter4/framework/system/Debug/Exceptions.php:161
Stack trace:
#0 [internal function]: CodeIgniter\Debug\Exceptions->errorHandler(2, 'Cannot modify h...', '/home/user/pr...', 161, Array)
#1 /home/user/project/vendor/codeigniter4/framework/system/Debug/Exceptions.php(161): 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} 



RE: Blank page on the web server - John_Betong - 04-15-2020

(04-15-2020, 10:29 AM)PHS Wrote: These errors are returning:

PHP Code:
<?php defined('SYSTEMPATH') || exit('No direct script access allowed'); ?>

CRITICAL - 2020-04-15 14:13:43 --> 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/user/pr...', 101, Array)
#1 /home/user/project/vendor/codeigniter4/framework/system/Session/Handlers/FileHandler.php(101): ini_set('session.save_pa...', '/home/user/pr...') 
Error logs usually look far worse because the errors are cumulative. Clear the first error and the rest disappear.

The very first error concerns something is being written before ini_set();

Search for ini_set(), add the following script and examine what is being written and clear the problem.

Code:
ini_set();
exit; // die; // stop browser execution.

Also note if the error log is deleted it will be regenerated until all errors and warnings are cleared. Far easier to only have a few errors showing.


RE: Blank page on the web server - PHS - 04-17-2020

According to information in the error log, the error is in the file:

PHP Code:
vendor/codeigniter4/framework/system/Session/Handlers/FileHandler.php(101): ini_set('session.save_pa ...''/home/user/pr...'


I went to the file and found this:

PHP Code:
ini_set('session.save_path'$config->sessionSavePath); 


Problem finding the directory path to save the session.

I did a test and did a clean install of codeigniter 4 and had the same problem!

Can it be VPS server configuration?


RE: Blank page on the web server - maxxd - 04-17-2020

Check the `Config/App.php` file - $sessionSavePath is right around line 187 - make sure the defined path actually exists on your server.


RE: Blank page on the web server - PHS - 04-18-2020

There is no problem with the directory path. I checked and they are right.

I still think it is some server configuration, because I installed the clean codeigniter in a subdomain and the same problem also occurs.

The point is, I'm not sure if it's a problem with the server or some codeigniter configuration.


RE: Blank page on the web server - PHS - 04-21-2020

Hi, I came back here because I still couldn't solve this problem.
I reinstalled the codeigniter and reconfigured the settings, but I still get a blank page that can be viewed here:

I created a subdomain where I placed index.php. The files remain outside the public_html directory.
I am not receiving error logs. I configured Logger.php to show me all system messages:

PHP Code:
public $ threshold 9


But I get just that:

Code:
INFO - 2020-04-21 16:39:58 -> Controller "App\Controllers\Home" loaded.


So, I think it must be some simple configuration I am not finding where to do it.