Yes, I imagine you are thinking to say that this question is a possible duplicate, however it isn't as the answers for the similar questions do not fix the issue I am currently having.
I'm receiving the following error while autoloading a library named 'phpass' as follows.
An Error Was Encountered Unable to load the requested class: Phpass
Code to autoload the library
$autoload['libraries'] = array('database', 'phpass');
The phpass.php file resides in the application/libraries folder, and the class is declared as class phpass
meaning that the issue cannot be related to capitalisation or the file path as suggested in the majority of other answers I have come across.
Please can you tell me what I am missing? It works perfectly in MAMP, however, when uploading to my 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);
}
I think the capitalisation of your file name and class name is the issue, according to the user guide:
phppass.php
should be Phppass.php
class phpass
should be class Phpass
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With