Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CodeIgniter not loading pages

Tags:

codeigniter

I have a web application developed using codeigniter and it worked fine in my previous server now I changed my server and when I am trying to run the web application there is nothing but a blank screen.

When I am trying to open the existing link http://mydomain.com/MyProject1/ It's a valid link but its showing me a blank page.

When I am trying to open another existing link mydomain.com/MyProject1/login/ This too a valid link but its displaying just a blank page.

Just for a test I tried some wrong link http://mydomain.com/MyProject1/test It's showing 404 error.

So, must be the code is running fine but pages are not being displayed. It's only showing blank page.

How can I fix this issue?

like image 973
Kerry Avatar asked May 20 '26 22:05

Kerry


2 Answers

Ok, turn displaying error in index.php (it's in the root) and change this if condition to something like:

if (defined('ENVIRONMENT'))
{
    switch (ENVIRONMENT)
    {
        case 'development':
            error_reporting(E_ALL ^ E_NOTICE);
        break;

        case 'testing':
        case 'production':
            // error_reporting(0);
            error_reporting(E_ALL ^ E_NOTICE);
        break;

        default:
            exit('The application environment is not set correctly.');
    }
}

Then the errors show up.

Btw. try to set the correct htaccess path to your app if you are using it e.g. if on your localhost it was:

RewriteEngine On

RewriteBase /projects/mywebsite/

change it on server to:

RewriteEngine On

RewriteBase /

if you are not using subdomains etc., of course.

Btw. if you get an error like headers already sent or something like that, you will need to save your files as "utf-8 without BOM" instead just "utf-8". Or there might be some characters on the beginning of the file, which you need to delete in your text editor.

Check the files you are working with e.g. language files, views, controllers etc. and check them how are they encoded. If they are utf-8 change encoding to utf-8 without BOM. It can be done in almost every text editor like Notepad++ or Sublime. Then reupload these files to your server.

like image 70
Derfder Avatar answered May 24 '26 10:05

Derfder


Try with

http://mydomain.com/MyProject1/index.php/test

may be you are missing index.php,or else goto "config.php" and edit base url and index url as per your application like

$config['base_url'] = 'http://mydomain.com/MyProject1/';
$config['index_page'] = '';//Keep this as empty
like image 44
Gautam3164 Avatar answered May 24 '26 10:05

Gautam3164



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!