Unable to load the requested class

0

I was developing in W7 and wanting to follow the work in Ubuntu, the message appears:

  

Unable to load the requested class: MPDF

The autoload.php:

$autoload['libraries'] = array('database', 'email', 'session', 'Mpdf');

The class is defined:

class mPDF{}

Thanks for your help.

    
asked by Gaby 24.01.2018 в 13:03
source

2 answers

0

Regardless of the operating system, codeigniter 3 handles its rules when it comes to naming classes and files.

A class must have the first capital letter, for example:

class Blog extends CI_Controller {
    public function index(){
        echo 'Hello World!';
    }
}

You have your class like this:

class mPDF{}

So you will not find it, you should change it to:

class Mpdf{}

Likewise the file that contains your class should be called in the same way, in your case it would be:

Mpdf.php

And when loading it, you could use lowercase.

$autoload['libraries'] = array('database', 'email', 'session', 'mpdf');

If your library is inside a directory then the upload should be done with the directory

$autoload['libraries'] = array('database', 'email', 'session', 'mpdf/mpdf');
    
answered by 07.02.2018 / 21:03
source
0

Windows 7 as well as all its successors are not case sensitive, while UNIX-based systems do. And it is the case of Linux and also MacOS, therefore you have to verify how are the names of the files.php to achieve them read in autoload load

    
answered by 31.01.2018 в 20:17