Blank PHP page , Though HTML page appears

**console (chrome developer tool) error : ** GET https://photo-gallery.000webhostapp.com/public/ 500 ()
i think this dir_path problem , the site works for me as localhost server but not working on webhost.
index.php file location” : public_html/public
"initialize.php file location" : public_html/includes
index.php use this bit of code :
<?php require_once("../includes/initialize.php");?>
web_url : “https://photo-gallery.000webhostapp.com/public/

Hi @a_nitw!

For begin, please change the PHP version to a lower one: cPanel > Settings > General > Change PHP version > 5.6

i have changed it to 5.6 but still same problem

**Here is the “initialize.php” file : **
’<?php
// DIRECTORY_SEPARATOR is pre-defined php constant
// (\ for window , / for linux)
defined(‘DS’) ? null : define(‘DS’, DIRECTORY_SEPARATOR);
defined(‘SITE_ROOT’) ? null : define(‘SITE_ROOT’, DS.‘xampp’.DS.‘htdocs’.DS.‘photo_gallery’);
defined(‘LIB_PATH’) ? null : define(‘LIB_PATH’, SITE_ROOT.DS.‘includes’);
// load config file first
require_once(LIB_PATH.DS.“config.php”);

// load basic functions next so that everything after it can use them
require_once(LIB_PATH.DS."functions.php");

// load core objects
require_once(LIB_PATH.DS."database.php");
require_once(LIB_PATH.DS."session.php");
require_once(LIB_PATH.DS."database_object.php");
require_once(LIB_PATH.DS."pagination.php");

// load database-related classes
require_once(LIB_PATH.DS."user.php");
require_once(LIB_PATH.DS."photograph.php");

?>’

I have the same issue, and it doesn’t seem to do anything with the version of php in use.
I have index.html, and index.php in the public_html folder, none of the urls work.
Index.htmls work in the sub folders of public_html.
Also tried removing htaccess nothing happened.

Mine is a “standard” (I moved it outside the public folder) codeigniter installation.

<?php
//nice job.
include '../index.php'; <- the real index.php of codeigniter

may be because my SITE_ROOT is different from webhost , so can u tell what is the SITE_ROOT for webhost , my html working fine that is inside “index.php” too .

@a_nitw I have added a .htaccess file to your website root. Now PHP displays error sources.

Please go to https://photo-gallery.000webhostapp.com/public/, investigate, and correct them.

1 Like

@Frontrider

I don’t think you can run/include scripts on lower levels than /public_html

https://menedekteszt1.000webhostapp.com/

Could you give mine the same treatment?

I did it. You are trying to include a script outsitde /public_html, which I don’t think it’s allowed for security reasons.

I placed the script outside the public folder,exactly for security reasons.
CI4 places all its scripts outside the public folder, thats what I was trying to mimic.

I have just ckecked. 000webhost does allow inclusion outside /public_html

I will investigate this issue.

@Frontrider

Your real index file was not placed correctly. I have corrected it, however now /system/core/CodeIgniter.php does not include properly.

Index.php was in the place where I wanted it to be, where it was supposed to be. (its working on my local)
I still only see a blank page tough.

@Frontrider Please lower the PHP version and try again: cPanel > Settings > General > Change PHP version > 5.6

@NGiNX can u tell me what u have written on .htaccess file and where to put this file , because i was resetting my site so lost that file

Create a new file named .htaccess in /public_html and append the following code to it:

php_value display_errors 1

1 Like