0
<?php
if (!defined('BASEPATH')) exit('No direct script access allowed');

class Home extends MY_Controller {
      public function __construct(){
          parent::__construct();
      }
}

The code stops executing after calling the parent constructor, without giving absolutely any error messages. If I echo something before constructor call, it is echoed.If i remove the database from auto load library it will display error message .I have configured correct database details on the database file.Any one please help me?

Fawzan
  • 4,738
  • 8
  • 41
  • 85
Soumya
  • 7
  • 1
  • 6
  • enable the error logging in codeigniter, show us the log. we can help. :) http://stackoverflow.com/questions/3209807/how-to-do-error-logging-in-codeigniter-php – Fawzan Nov 28 '15 at 10:55
  • hi, My index.php has error_reporting(E_ALL);But doen't display any error.Its works fine in Local.The problem only in Server. – Soumya Nov 28 '15 at 11:10
  • I think the error reporting is disabled for productions. In th eindex.php check the switch(ENVIRONMENT) , set E_ALL for production. – Fawzan Nov 28 '15 at 11:12
  • if (defined('ENVIRONMENT')) { switch (ENVIRONMENT) { case 'development': error_reporting(E_ALL); break; case 'testing': case 'production': error_reporting(E_ALL); break; default: exit('The application environment is not set correctly.'); } } – Soumya Nov 28 '15 at 11:12
  • can you add a index() method in the Home controller and echo something from it? – Fawzan Nov 28 '15 at 11:13
  • public function index() { echo "sdsdsd";die(); };But nothing displayed. – Soumya Nov 28 '15 at 11:17
  • please check the answer and comment. – Fawzan Nov 28 '15 at 11:19
  • if (!defined('BASEPATH')) exit('No direct script access allowed'); class Home extends MY_Controller { public function __construct() { echo "sdsdsd";die(); parent::__construct(); }Its displayed sdsdsd – Soumya Nov 28 '15 at 11:19
  • You should also check server logs for errors. – Vaviloff Nov 28 '15 at 11:22
  • Even the above code is not working. – Soumya Nov 28 '15 at 11:25

1 Answers1

1

The Question has very few information, anyway I will post this answer so that you can debug your program. If you can give more information I can edit the answer as well.

It sounds like you may have a problem in the MY_Controller, to make sure that replace you Home Controller with the following code.

<?php
if (!defined('BASEPATH')) exit('No direct script access allowed');

class Home extends CI_Controller {

      public function index(){
         echo "hey I am working";
     }
}

If this works, we can come to the conclusion that your MY_Controller has an error. In that case we need to see the MY_Controller to help further.

Fawzan
  • 4,738
  • 8
  • 41
  • 85
  • hi,Its not working.$autoload['libraries'] = array('database', 'session','form_validation','pagination', 'admin_lib');If i remove database from this section it will works. – Soumya Nov 28 '15 at 11:36
  • Can you try removing one by one? then we can find the exact location of cause. – Fawzan Nov 28 '15 at 11:37
  • Identified the problem.I used the dbdriver as mysql. But in my server it was Mysqli. When i changed the $db['default']['dbdriver'] = 'mysqli'; in databse.php, it worked fine. Thanks a lot for support – Soumya Nov 28 '15 at 15:53
  • Glad you fixed it on your own. :) – Fawzan Nov 28 '15 at 15:55