Welcome Guest, Not a member yet? Register   Sign In
Unable to locate the specified class: Session.php [SOLVED]
#1

(This post was last modified: 04-20-2018, 03:26 PM by enelson.)

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?
Reply
#2

(This post was last modified: 04-16-2018, 02:48 AM by enelson.)

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

   
Reply
#3

Did you loaded the session in autoload or in the construct function?
Reply
#4

(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');
    }
    


Reply
#5

I would autoload the session library because it is always used

./application/config/autoload.php
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#6

(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.
Reply
#7

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
Reply
#8

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?
Reply
#9

Show the code were your setting up the $CI
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#10

(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.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB