Jump to content

How to Access sha1() Function?


phummon

Recommended Posts

Hi everyone,

 

  Full disclosure:  I'm an experienced programming who is relatively new to PHP.  Unfortunately, I'm also in a bit of a jam.  In short, my boss gave me some PHP code and said, "You have to get this working by Friday."  I don't have the luxury to do the proper tutorials, otherwise I wouldn't be rushing to this forum in a bit of a panic.

 

  Here's the problem.  The code I'm working with has this line:

   

$variable1 = sha1("12345678".$user.$passwd);

When I execute, the compiler gives me this result...

<br>
<b>Fatal error</b>:  Call to undefined function:  sha1() in <b>/export/qhome/dude1/script1.php</b> on line <b>38</b><br>

...which I'm interpreting to mean "I don't know what this sha1() command is!"  If this were C++ code (my home turf), I'd just "man sha1," figure out which library I need to add, and then pop in the needed "#include ______" statement at the top of my code.  That didn't work for in this case.

 

  Does anyone have any insight?

 

            Many, many thanks in advance!

                        -P

 

Link to comment
Share on other sites

Which version of PHP it is. sha1 is a core function and should be available in all PHP versions since 4.3.0. If you get this error, it might mean you're working on some really old version... in which case I am really sorry for you.

Link to comment
Share on other sites

Ah.  I see from phpinfo() that the current version I'm running is PHP Version 4.0.3pl1, which sounds pretty ancient.  Phooey.  That sure explains why sha1() doesn't work, though.

 

Many thanks to all who helped - this was great for me!

                  -P

 

Link to comment
Share on other sites

Well... since you're coming from C++ area, you can write your own extension and compile it into PHP 4.0.3... or you can just talk your boss into upgrading to something released in current century (and still supported!)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.