CodeIgniter Forums
Unable to locate the specified class: Session.php [SOLVED] - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Unable to locate the specified class: Session.php [SOLVED] (/showthread.php?tid=70479)

Pages: 1 2


Unable to locate the specified class: Session.php [SOLVED] - enelson - 04-15-2018

Am integrating Facebook login using this library.
However after redirection from FB I get an error:

Unable to locate the specified class: Session.php

Other codes with 
PHP Code:
$this->session->set_userdata($str);
//and
echo $this->session->userdata('var'); 


seem to work elsewhere.

I think the problem is involved in this method but I can't find any problem.

Any suggestions?


RE: Unable to locate the specified class: Session.php - enelson - 04-16-2018

Is this error generated by CI or Facebook?
It isn't formated like native CI errors (see attachment).

   


RE: Unable to locate the specified class: Session.php - theedo - 04-16-2018

Did you loaded the session in autoload or in the construct function?


RE: Unable to locate the specified class: Session.php - enelson - 04-16-2018

(04-16-2018, 03:07 AM)theedo Wrote: Did you loaded the session in autoload or in the construct function?

I did.


This is what the class that handles redirects from FB looks like
PHP Code:
<?php 

class Facebook extends CI_Controller
{
    public function 
__construct()
    {
        
parent::__construct();
        
$this->load->library('session');
    }

        
/**
     * Callback to log with facebook account
     */
    
public function login_callback()
    {
     
   if ($this->facebook->fb_callback()) {
     
       redirect('home');
     
   } else {
     
       show_error('erreur');
     
   }
    }
    
    
/**
     * Callback to disconnect the facebook acount
     */
    
public function disconnectFacebookAccount_callback()
    {
     
   $this->facebook->disconnectFacebookAccount();
     
   redirect('Welcome_fb_ion_auth');
    }
    
    
/**
     * Callback to connect the user's facebook acount
     */
    
public function register_callback()
    {
     
   $this->facebook->connectFacebookAccount();
     
   redirect('my-info');
    }
    





RE: Unable to locate the specified class: Session.php - InsiteFX - 04-16-2018

I would autoload the session library because it is always used

./application/config/autoload.php


RE: Unable to locate the specified class: Session.php - enelson - 04-16-2018

(04-16-2018, 04:01 AM)InsiteFX Wrote: I would autoload the session library because it is always used

./application/config/autoload.php

it's autoloaded.
I only loaded it in the controller because I was curious uf something wasn't working properly.


RE: Unable to locate the specified class: Session.php - enelson - 04-20-2018

Adding 
PHP Code:
$this->ci->load->library('Session'); 
to the library file, immediately after 
PHP Code:
$this->ci =& get_instance(); 

fixed the issue. This was suggested by someone at the Slack Chat  Angel


RE: Unable to locate the specified class: Session.php [SOLVED] - enelson - 04-21-2018

Bad Luck.
The report from my last post worked when I copied my application to a new test folder.
Back to the real app and the problem persists.
So I removed sessions driver from the autoload.php, making thr file look like below
PHP Code:
*
| -------------------------------------------------------------------
 Auto-load Packages
| -------------------------------------------------------------------
Prototype:
|
 $autoload['packages'] = array(APPPATH.'third_party''/usr/local/shared');
|
*/
$autoload['packages'] = array();

/*
| -------------------------------------------------------------------
|  Auto-load Libraries
| -------------------------------------------------------------------
| These are the classes located in system/libraries/ or your
| application/libraries/ directory, with the addition of the
| 'database' library, which is somewhat of a special case.
|
| Prototype:
|
|    $autoload['libraries'] = array('database', 'email', 'session');
|
| You can also supply an alternative library name to be assigned
| in the controller:
|
|    $autoload['libraries'] = array('user_agent' => 'ua');
*/
$autoload['libraries'] = array('template''ion_auth''database''form_validation''facebook''session');

/*
| -------------------------------------------------------------------
|  Auto-load Drivers
| -------------------------------------------------------------------
| These classes are located in system/libraries/ or in your
| application/libraries/ directory, but are also placed inside their
| own subdirectory and they extend the CI_Driver_Library class. They
| offer multiple interchangeable driver options.
|
| Prototype:
|
|    $autoload['drivers'] = array('cache');
|
| You can also supply an alternative property name to be assigned in
| the controller:
|
|    $autoload['drivers'] = array('cache' => 'cch');
|
*/
$autoload['drivers'] = array();

/*
| -------------------------------------------------------------------
|  Auto-load Helper Files
| -------------------------------------------------------------------
| Prototype:
|
|    $autoload['helper'] = array('url', 'file');
*/
$autoload['helper'] = array('url''facebook_helper');

/*
| -------------------------------------------------------------------
|  Auto-load Config files
| -------------------------------------------------------------------
| Prototype:
|
|    $autoload['config'] = array('config1', 'config2');
|
| NOTE: This item is intended for use ONLY if you have created custom
| config files.  Otherwise, leave it blank.
|
*/
$autoload['config'] = array();

/*
| -------------------------------------------------------------------
|  Auto-load Language files
| -------------------------------------------------------------------
| Prototype:
|
|    $autoload['language'] = array('lang1', 'lang2');
|
| NOTE: Do not include the "_lang" part of your file.  For example
| "codeigniter_lang.php" would be referenced as array('codeigniter');
|
*/
$autoload['language'] = array(); 
The I get the following error
Code:
An uncaught Exception was encountered
Type: Error

Message: Class 'CI_Ion_auth' not found

Filename: /home/indicxyz/airdata.com.ng/system/core/Common.php

Line Number: 196

Backtrace:

File: /home/indicxyz/airdata.com.ng/public/index.php
Line: 315
Function: require_once

Well, the system is just appending CI_ to all my libraries before attampting to autoload them.
This does not happen on the test copy, even when the sessions driver is not autloaded!
Any suggestions?


RE: Unable to locate the specified class: Session.php [SOLVED] - InsiteFX - 04-22-2018

Show the code were your setting up the $CI


RE: Unable to locate the specified class: Session.php [SOLVED] - enelson - 04-23-2018

(04-22-2018, 04:31 AM)InsiteFX Wrote: Show the code were your setting up the $CI

Hi,
I copied the contents of the website to a new (test) folder and it worked from there.
So I deleted everything from the folder containing the original site, and copied contents of the test folder into the the original folder and it works. Quite weird.