0
votes

Here's my error:

Fatal error: Call to undefined function password_hash() in /Applications/mampstack-5.4.25-1/apache2/htdocs/php-login/application/models/login_model.php on line 462

PHP line 462:

$user_password_hash = password_hash($_POST['user_password_new'], PASSWORD_DEFAULT, array('cost' => $hash_cost_factor));

I'm aware that password_hash is PHP 5.5.0 and I am using it. I've tried playing around with it but could succeeded. Any help would be great.

EDIT:

It says mampstack-5.4.25-1 but that's simply a name for it. I've upgraded. I've used PHP 5.5.0 features just this morning.

1
What?!?! You have PHP 5.4.24! That is not 5.5.0! - AbraCadaver
Use the Userland implementation by ircmaxell: github.com/ircmaxell/password_compat - Amal Murali
How would that be? I used PHP 5.5.0 features on other projects earlier today. @AbraCadaver - Alex
Dunno, but: 5.4.25-1 /apache2/htdocs/php-login/application/models/login_model.php on line 462 - AbraCadaver
What PHP5.5 feature did you use? Are you sure it is PHP5.5 only? - John Conde

1 Answers

0
votes

as for your php version you could use this

$salt = mcrypt_create_iv(16, MCRYPT_DEV_URANDOM);
$passh = crypt($pass, '$6$'.$salt);

$6$ means that its SHA-512 just remember to store salt in database, so you can check the password afterwards.