CodeIgniter - unable to load required class

Yes, I suppose you are thinking to say that this question is a possible duplicate, but it’s not like the answers to such questions do not fix the problem that I now have.

I get the following error when loading a library named "phpass" as follows.

Error Detected Failed to load the requested class: Phpass

Code for automatic library loading

$autoload['libraries'] = array('database', 'phpass'); 

The phpass.php file is located in the application / libraries folder, and the class is declared as class phpass , which means that the problem cannot be related to capitalization or the file path, as suggested in most of the other answers that I met,

Please, can you tell me what I am missing? It works fine in MAMP, however when it boots to the Linux Ubuntu server (Apache2) it stops working.

Thanks,

Max.

Edit --- Constructor method as requested by Utku

 class phpass { protected $PasswordHash; // default values if config was not found protected $iteration_count_log2 = 8; protected $portable_hashes = FALSE; /** * Construct with configuration array * * @param array $config */ public function __construct($config = array()) { // check if the original phpass file exists if (!file_exists($path = dirname(__FILE__) . '/../vendor/PasswordHash.php')) { show_error('The phpass class file was not found.'); } include ($path); if (!empty($config)) { $this->initialize($config); } // create phpass object $this->PasswordHash = new PasswordHash($this->iteration_count_log2, $this->portable_hashes); } 
+7
source share
1 answer

I think capitalizing your file name and class name is a problem, according to the user guide :

  • phppass.php must be phppass.php
  • class phpass must be class phpass
+26
source

All Articles