EllisLab text mark
Advanced Search
     
upgrade from 1.4.x to 2.1.2 Error
Posted: 04 October 2012 01:17 AM   [ Ignore ]
Joined: 2011-07-27
14 posts

Here is what I’ve done so far:

Installed the latest CI in a new folder.
up dated config, database, routes and autoload
Copied controllers, models and view files from legacy site.
changed controllers to have CI_Controller and __construct()

My reward:

An Error Was Encountered
The configuration file application.php does not exist.

The error log:
[03-Oct-2012 23:53:18 UTC] PHP Fatal error:  Call to undefined method CI_Controller::CI_Controller() in /home/opendoor/public_html/cg/application/controllers/home.php on line 7

home.php
/* line 5: */ public function __construct() {
/* line 6: */  parent::__construct();
/* line 7: */  }

What happen? And how do I fix it?

 

 

 
Posted: 04 October 2012 04:20 AM   [ Ignore ]   [ # 1 ]   [ Rating: 0 ]
Avatar
Joined: 2006-03-25
1009 posts

Please post the complete home.php Controller code.

 
Posted: 04 October 2012 07:28 AM   [ Ignore ]   [ # 2 ]   [ Rating: 0 ]
Joined: 2011-07-27
14 posts
<?php

class Home extends CI_Controller {
  
//The constructor
   
public function __construct() {
    parent
::__construct();
   
}
 
 
function index()
 
{
  $this
->load->model('songs_model');

  
$data['song'$this->songs_model->get_random();

  
$this->load->view('../../templates/homepage'$data);
 
}
 
 
function licensing()
 
{
  
// test browser: firefox not able to display pdf's
  
$this->load->view('../../templates/licensing');
 
}
 
 
function aboutus()
 
{
  $this
->load->view('../../templates/aboutus');
 
}
 
/* bonus pages */
 
function styxii()
 
{
  $this
->load->view('../../templates/includes/head');
  
  
$this->load->view('../../templates/albumPages/styxii');
  
  
$this->load->view('../../templates/includes/footer');
  
$this->load->view('../../templates/includes/analytics'); 
 
}

  
function gloria()
 
{
  $this
->load->view('../../templates/includes/head');
  
  
$this->load->view('../../templates/albumPages/gloria');
  
  
$this->load->view('../../templates/includes/footer');
  
$this->load->view('../../templates/includes/analytics'); 
 
}

  
function bestofAB()
 
{
  $this
->load->view('../../templates/includes/head');
  
  
$this->load->view('../../templates/albumPages/bestofAB');
  
  
$this->load->view('../../templates/includes/footer');
  
$this->load->view('../../templates/includes/analytics'); 
 
}
 
  
function crow()
 
{
  $this
->load->view('../../templates/includes/head');
  
  
$this->load->view('../../templates/albumPages/crow');
  
  
$this->load->view('../../templates/includes/footer');
  
$this->load->view('../../templates/includes/analytics'); 
 
}

  
function zazu()
 
{
  $this
->load->view('../../templates/includes/head');
  
  
$this->load->view('../../templates/albumPages/zazu');
  
  
$this->load->view('../../templates/includes/footer');
  
$this->load->view('../../templates/includes/analytics'); 
 
}

  
function manofMiricles()
 
{
  $this
->load->view('../../templates/includes/head');
  
  
$this->load->view('../../templates/albumPages/manofMiricles');
  
  
$this->load->view('../../templates/includes/footer');
  
$this->load->view('../../templates/includes/analytics'); 
 
}
  
function test()
 
{
  $this
->load->view('../../templates/includes/head');
  
  
$this->load->view('../../templates/albumPages/test');
  
  
$this->load->view('../../templates/includes/footer');
  
$this->load->view('../../templates/includes/analytics'); 
 
}
 
function contactus()
 
{
  $this
->load->view('../../templates/includes/head');
  
  
$this->load->view('../../templates/contactus');
  
  
$this->load->view('../../templates/includes/footer');
  
$this->load->view('../../templates/includes/analytics'); 
 



}

/* End of file home.php */
/* Location: ./application/controllers/home.php */ 
 
Posted: 04 October 2012 07:55 AM   [ Ignore ]   [ # 3 ]   [ Rating: 0 ]
Avatar
Joined: 2006-03-25
1009 posts

Are you sure you are calling this controller in a 2.1.2
version of CI?

I copied your class to a working CI project and don’t get
the error you have.

 
Posted: 04 October 2012 03:52 PM   [ Ignore ]   [ # 4 ]   [ Rating: 0 ]
Joined: 2011-07-27
14 posts

Pretty sure.

I downloaded the latest from this site, expanded it in a directory and copied the controllers in.

http://cg.classicgaragerock.com

 
Posted: 05 October 2012 04:18 AM   [ Ignore ]   [ # 5 ]   [ Rating: 0 ]
Avatar
Joined: 2006-03-25
1009 posts

The configuration file application.php does not exist.

I would start to get rid of this error. Is it defined in
autoload.php accidently or did you just forget to copy this
config file?

 

 
Posted: 05 October 2012 11:25 AM   [ Ignore ]   [ # 6 ]   [ Rating: 0 ]
Joined: 2011-07-27
14 posts

Found all the config and library items that defined the administrative aria.

Parse error: syntax error, unexpected T_STRING, expecting ‘{’ in /home/opendoor/public_html/cg/application/models/datamapper.php on line 46

class DataMapper CI_Model { // this is line 46

 
var $table;
 var 
$fields;
 var 
$model;
 var 
$error;
 var 
$valid FALSE;
 var 
$validated FALSE;
 var 
$all = array();
 var 
$validation = array();
 var 
$changed = array();
 var 
$has_many = array();
 var 
$has_one = array();
 var 
$error_prefix '<p>';
 var 
$error_suffix '</p>';
 var 
$created_field 'created';
 var 
$updated_field 'updated'
 
Posted: 05 October 2012 11:29 AM   [ Ignore ]   [ # 7 ]   [ Rating: 0 ]
Joined: 2011-02-23
882 posts

I’d say you’re Missing an extends on line 46 of that model wink

 Signature 

ignited Community Framework (WiP)  |  Read the User’s Guide. It won’t bite.

STOP! Before posting your questions, remember the WWW Golden rule:
What did you try? What did you get? What did you expect to get?

CI example .htaccess

 
Posted: 05 October 2012 12:18 PM   [ Ignore ]   [ # 8 ]   [ Rating: 0 ]
Joined: 2011-07-27
14 posts
PhilTem - 05 October 2012 11:29 AM

I’d say you’re Missing an extends on line 46 of that model wink

I saw that, but since it came from a fresh download of CI, I figured it must be correct.

When I put “extends” in I get:

Fatal error: Call to undefined method CI_Model::Model() in /home/opendoor/public_html/cg/application/models/datamapper.php on line 71

/**
  * Constructor
  *
  * Initialize DataMapper.
  */
 
function DataMapper()
 
{
  parent
::Model(); // line 71
 
.
 .
 . 

 

 
Posted: 05 October 2012 12:49 PM   [ Ignore ]   [ # 9 ]   [ Rating: 0 ]
Joined: 2011-02-09
40 posts

Where does datamapper.php come from? Doesn’t seem to be part if ci…

 
Posted: 05 October 2012 06:41 PM   [ Ignore ]   [ # 10 ]   [ Rating: 0 ]
Joined: 2011-07-27
14 posts
Ed Robindon - 05 October 2012 12:49 PM

Where does datamapper.php come from? Doesn’t seem to be part if ci…

http://datamapper.wanwizard.eu/
DataMapper is an Object Relational Mapper written in PHP for CodeIgniter. It is designed to map your Database tables into easy to work with objects, fully aware of the relationships between each other.

 
Posted: 05 October 2012 10:50 PM   [ Ignore ]   [ # 11 ]   [ Rating: 0 ]
Joined: 2011-02-09
40 posts

Thank you for that.

I downloaded the latest version of datamapper and can find no reference to
CI_Model in any of its files.

Can’t find “class DataMapper CI_Model” in any of its files either.

Am I up the wrong tree?

 
Posted: 07 October 2012 06:50 PM   [ Ignore ]   [ # 12 ]   [ Rating: 0 ]
Joined: 2011-07-27
14 posts
Ed Robindon - 05 October 2012 10:50 PM

Thank you for that.

I downloaded the latest version of datamapper and can find no reference to
CI_Model in any of its files.

Can’t find “class DataMapper CI_Model” in any of its files either.

Am I up the wrong tree?

To tell the truth I am not sure what forest I am in smile

I loaded the latest Data Mapper up to my site.—still same error.

I found a file called: system/library/medel.php with a class Model, function Model()

Datamapper helps stitch together some db tables. (i think) 

<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
 * CodeIgniter
 *
 * An open source application development framework for PHP 4.3.2 or newer
 *
 * @package  CodeIgniter
 * @author  ExpressionEngine Dev Team
 * @copyright Copyright (c) 2006, EllisLab, Inc.
 * @license  http://ellislab.com/codeigniter/user-guide/license.html
 * @link  http://codeigniter.com
 * @since  Version 1.0
 * @filesource
 */

// ------------------------------------------------------------------------

/**
 * CodeIgniter Model Class
 *
 * @package  CodeIgniter
 * @subpackage Libraries
 * @category Libraries
 * @author  ExpressionEngine Dev Team
 * @link  http://ellislab.com/codeigniter/user-guide/libraries/config.html
 */
class Model {

 
var $_parent_name '';

 
/**
  * Constructor
  *
  * @access public
  */
 
function Model()
 
{
  
// If the magic __get() or __set() methods are used in a Model references can't be used.
  
$this->_assign_libraries( (method_exists($this'__get') OR method_exists($this'__set')) ? FALSE TRUE );
  
  
// We don't want to assign the model object to itself when using the
  // assign_libraries function below so we'll grab the name of the model parent
  
$this->_parent_name ucfirst(get_class($this));
  
  
log_message('debug'"Model Class Initialized");
 
}

 
/**
  * Assign Libraries
  *
  * Creates local references to all currently instantiated objects
  * so that any syntax that can be legally used in a controller
  * can be used within models.  
  *
  * @access private
  */ 
 
function _assign_libraries($use_reference TRUE)
 
{
  $CI 
=& get_instance();    
  foreach (
array_keys(get_object_vars($CI)) as $key)
  
{
   
if ( ! isset($this->$key) AND $key != $this->_parent_name)
   
{   
    
// In some cases using references can cause
    // problems so we'll conditionally use them
    
if ($use_reference == TRUE)
    
{
     
// Needed to prevent reference errors with some configurations
     
$this->$key '';
     
$this->$key =& $CI->$key;
    
}
    
else
    
{
     $this
->$key $CI->$key;
    
}
   }
  }  
 }

}
// END Model Class

/* End of file Model.php */
/* Location: ./system/libraries/Model.php */ 
 
Posted: 10 October 2012 01:37 AM   [ Ignore ]   [ # 13 ]   [ Rating: 0 ]
Joined: 2011-07-27
14 posts

This has been resolved to a datamapper issue and I have opened a new topic:

“upgrade from 1.4.x to 2.1.2 datamapper installation”.