• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Controller wont "run"

#1
[eluser]RAH[/eluser]
Hi,

I have a project/controller that runs perfect on my local environment, but when I run it online it breaks.

I don't get anything in my logs, I don't get any errors even with error_reporting(E_ALL) and display_errors: 1.

I can echo stuff before and after the class, but the class dosn't run.


What can it be? It works locally so I guess it has to be something with the host.

This project is on a subdomain, and I have another project on the main domain that uses mod_rewrite and works.


Here is my default controller:

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

class Home extends CI_Controller {

function __construct() {
  parent::__construct();  
}

function index() {
  $this->login();
}

function login($param = "") {
  
  if($param == "connect" && isset($_POST) && !empty($_POST)) {  
  
   $user = $_POST['login_user'];
   $pass = $_POST['login_pass'];
  
   if(!$this->auth->log_in($user, $pass)) {
    //echo "kan ikke logge inn";
   }  
  }
  
  if( $this->auth->logged_in() ) {
   redirect("articles");
  }else{
   $this->load->view("login");
  }
}

function logout() {
  if($this->auth->log_out()) {
   $this->index();
  }
}
}


base url is correct, and url_protocol is set to AUTO. I have tried every option in the url_protocol.


Thanks

#2
[eluser]Samus[/eluser]
[quote author="RAH" date="1333990073"]Hi,

I have a project/controller that runs perfect on my local environment, but when I run it online it breaks.

I don't get anything in my logs, I don't get any errors even with error_reporting(E_ALL) and display_errors: 1.

I can echo stuff before and after the class, but the class dosn't run.


What can it be? It works locally so I guess it has to be something with the host.

This project is on a subdomain, and I have another project on the main domain that uses mod_rewrite and works.


Here is my default controller:

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

class Home extends CI_Controller {

function __construct() {
  parent::__construct();  
}

function index() {
  $this->login();
}

function login($param = "") {
  
  if($param == "connect" && isset($_POST) && !empty($_POST)) {  
  
   $user = $_POST['login_user'];
   $pass = $_POST['login_pass'];
  
   if(!$this->auth->log_in($user, $pass)) {
    //echo "kan ikke logge inn";
   }  
  }
  
  if( $this->auth->logged_in() ) {
   redirect("articles");
  }else{
   $this->load->view("login");
  }
}

function logout() {
  if($this->auth->log_out()) {
   $this->index();
  }
}
}


base url is correct, and url_protocol is set to AUTO. I have tried every option in the url_protocol.


Thanks[/quote]
this might sound obvious, but check the uploaded version? could possibly be truncated.

it happened to me before and I noticed all my code was on one line rather than in multiple lines as i uploaded it. which caused all my code to break

#3
[eluser]craig.hoog[/eluser]
Whenever I have this issue, it usually has nothing to do with the Controller (oddly enough).
If I am getting no error messages at all, it tends to be a sign that the issue is in one of my Helper files.

I would make sure your Autoload is the same locally as it is online and double check your authentication plugin is working.

#4
[eluser]RAH[/eluser]
Hi,

Thanks for the suggestions, and sorry for the late reply.


I contacted the host, and the said the forced this error:


A PHP Error was encountered

Severity: Notice
Message: Undefined variable: class
Filename: core/CodeIgniter.php
Line Number: 307


A PHP Error was encountered

Severity: Notice
Message: Undefined variable: method
Filename: core/CodeIgniter.php
Line Number: 307


A PHP Error was encountered

Severity: Notice
Message: Undefined variable: class
Filename: core/CodeIgniter.php
Line Number: 309

Fatal error: Class name must be a valid object or a string in /hsphere/local/home/ungdo918/cp.ungdomsfabrikken.no/system/core/CodeIgniter.php on line 309


line 309 is blank, 308 is: $CI = new $class();



It doesn't look like it's the autoloader/helper Sad

#5
[eluser]InsiteFX[/eluser]
Some servers require that all your file names be lowercase!

#6
[eluser]RAH[/eluser]
hmmm...

I try to run this on a subdomain, wouldn't it require all lowercase names on the main domain too if this was the case?

I successfully run a codeigniter system on the top domain.

#7
[eluser]InsiteFX[/eluser]
Try renaming your main .htaccess to something else and see if the sub-domain works!
It could be stoping the sub-domain because sub-domains are directories off of the main domain.
If that is the case you will need to create an .htaccess file for the sub-domain also.

I have a main domain with 2 sub-domains and have no problems running them.

#8
[eluser]CroNiX[/eluser]
That's not necessarily true that subdomains are in a subdirectory of the main domain. Not all hosting control panels set things up that way.

#9
[eluser]phpfresher[/eluser]
May be , this error is due to .htaccess file . I got similar type of error due to .htaccess file. Not sure but this problem may work if you fix the .htaccess file


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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