• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Blank page on the web server

#1
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?
Reply

#2
@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
Reply

#3
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
Reply

#4
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
Reply

#5
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} 
Reply

#6
(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.
Reply

#7
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?
Reply

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

#9
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.
Reply

#10
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.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.