Fatal error: Uncaught Error: Call to undefined function mcrypt_create_iv()









up vote
-1
down vote

favorite












I got a Fatal Error with my code and trace everywhere and couldn't find the problem of my code, here is the my code:



<?php
class Hash
public static function make($string, $salt = '')
return hash('sha256', $string . $salt);


public static function salt($length)
return mcrypt_create_iv($length);


public static function unique()
return self::make(uniqid());




I keep getting this error=>
Fatal error: Uncaught Error: Call to undefined function mcrypt_create_iv() in C:xampphtdocslearnphptutorclassesHash.php:8 Stack trace: #0 C:xampphtdocslearnphptutorregister.php(37): Hash::salt(32) #1 main thrown in C:xampphtdocslearnphptutorclassesHash.php on line 8










share|improve this question

















  • 1




    Possible duplicate of Reference - What does this error mean in PHP?
    – miken32
    Nov 11 at 3:24






  • 1




    According to the manual php.net/manual/en/function.mcrypt-create-iv.php 'mcrypt_create_iv()' is removed as of PHP version 7.2. Type PHP -v at your command line to find out what version you have.
    – bcperth
    Nov 11 at 3:39










  • ^ should actually use phpinfo() as comand line php could be a diffirent version
    – IdontDownVote
    Nov 11 at 4:17










  • Thank you, but I now found I solution to the problem, after they remove the mcrypt_create_iv function, they replace it with random_bytes function.
    – Safianu Mohammed
    Nov 11 at 17:32














up vote
-1
down vote

favorite












I got a Fatal Error with my code and trace everywhere and couldn't find the problem of my code, here is the my code:



<?php
class Hash
public static function make($string, $salt = '')
return hash('sha256', $string . $salt);


public static function salt($length)
return mcrypt_create_iv($length);


public static function unique()
return self::make(uniqid());




I keep getting this error=>
Fatal error: Uncaught Error: Call to undefined function mcrypt_create_iv() in C:xampphtdocslearnphptutorclassesHash.php:8 Stack trace: #0 C:xampphtdocslearnphptutorregister.php(37): Hash::salt(32) #1 main thrown in C:xampphtdocslearnphptutorclassesHash.php on line 8










share|improve this question

















  • 1




    Possible duplicate of Reference - What does this error mean in PHP?
    – miken32
    Nov 11 at 3:24






  • 1




    According to the manual php.net/manual/en/function.mcrypt-create-iv.php 'mcrypt_create_iv()' is removed as of PHP version 7.2. Type PHP -v at your command line to find out what version you have.
    – bcperth
    Nov 11 at 3:39










  • ^ should actually use phpinfo() as comand line php could be a diffirent version
    – IdontDownVote
    Nov 11 at 4:17










  • Thank you, but I now found I solution to the problem, after they remove the mcrypt_create_iv function, they replace it with random_bytes function.
    – Safianu Mohammed
    Nov 11 at 17:32












up vote
-1
down vote

favorite









up vote
-1
down vote

favorite











I got a Fatal Error with my code and trace everywhere and couldn't find the problem of my code, here is the my code:



<?php
class Hash
public static function make($string, $salt = '')
return hash('sha256', $string . $salt);


public static function salt($length)
return mcrypt_create_iv($length);


public static function unique()
return self::make(uniqid());




I keep getting this error=>
Fatal error: Uncaught Error: Call to undefined function mcrypt_create_iv() in C:xampphtdocslearnphptutorclassesHash.php:8 Stack trace: #0 C:xampphtdocslearnphptutorregister.php(37): Hash::salt(32) #1 main thrown in C:xampphtdocslearnphptutorclassesHash.php on line 8










share|improve this question













I got a Fatal Error with my code and trace everywhere and couldn't find the problem of my code, here is the my code:



<?php
class Hash
public static function make($string, $salt = '')
return hash('sha256', $string . $salt);


public static function salt($length)
return mcrypt_create_iv($length);


public static function unique()
return self::make(uniqid());




I keep getting this error=>
Fatal error: Uncaught Error: Call to undefined function mcrypt_create_iv() in C:xampphtdocslearnphptutorclassesHash.php:8 Stack trace: #0 C:xampphtdocslearnphptutorregister.php(37): Hash::salt(32) #1 main thrown in C:xampphtdocslearnphptutorclassesHash.php on line 8







php






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 11 at 2:45









Safianu Mohammed

13




13







  • 1




    Possible duplicate of Reference - What does this error mean in PHP?
    – miken32
    Nov 11 at 3:24






  • 1




    According to the manual php.net/manual/en/function.mcrypt-create-iv.php 'mcrypt_create_iv()' is removed as of PHP version 7.2. Type PHP -v at your command line to find out what version you have.
    – bcperth
    Nov 11 at 3:39










  • ^ should actually use phpinfo() as comand line php could be a diffirent version
    – IdontDownVote
    Nov 11 at 4:17










  • Thank you, but I now found I solution to the problem, after they remove the mcrypt_create_iv function, they replace it with random_bytes function.
    – Safianu Mohammed
    Nov 11 at 17:32












  • 1




    Possible duplicate of Reference - What does this error mean in PHP?
    – miken32
    Nov 11 at 3:24






  • 1




    According to the manual php.net/manual/en/function.mcrypt-create-iv.php 'mcrypt_create_iv()' is removed as of PHP version 7.2. Type PHP -v at your command line to find out what version you have.
    – bcperth
    Nov 11 at 3:39










  • ^ should actually use phpinfo() as comand line php could be a diffirent version
    – IdontDownVote
    Nov 11 at 4:17










  • Thank you, but I now found I solution to the problem, after they remove the mcrypt_create_iv function, they replace it with random_bytes function.
    – Safianu Mohammed
    Nov 11 at 17:32







1




1




Possible duplicate of Reference - What does this error mean in PHP?
– miken32
Nov 11 at 3:24




Possible duplicate of Reference - What does this error mean in PHP?
– miken32
Nov 11 at 3:24




1




1




According to the manual php.net/manual/en/function.mcrypt-create-iv.php 'mcrypt_create_iv()' is removed as of PHP version 7.2. Type PHP -v at your command line to find out what version you have.
– bcperth
Nov 11 at 3:39




According to the manual php.net/manual/en/function.mcrypt-create-iv.php 'mcrypt_create_iv()' is removed as of PHP version 7.2. Type PHP -v at your command line to find out what version you have.
– bcperth
Nov 11 at 3:39












^ should actually use phpinfo() as comand line php could be a diffirent version
– IdontDownVote
Nov 11 at 4:17




^ should actually use phpinfo() as comand line php could be a diffirent version
– IdontDownVote
Nov 11 at 4:17












Thank you, but I now found I solution to the problem, after they remove the mcrypt_create_iv function, they replace it with random_bytes function.
– Safianu Mohammed
Nov 11 at 17:32




Thank you, but I now found I solution to the problem, after they remove the mcrypt_create_iv function, they replace it with random_bytes function.
– Safianu Mohammed
Nov 11 at 17:32

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53245406%2ffatal-error-uncaught-error-call-to-undefined-function-mcrypt-create-iv%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53245406%2ffatal-error-uncaught-error-call-to-undefined-function-mcrypt-create-iv%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







這個網誌中的熱門文章

Barbados

How to read a connectionString WITH PROVIDER in .NET Core?

Node.js Script on GitHub Pages or Amazon S3