phummon Posted July 21, 2010 Share Posted July 21, 2010 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 Quote Link to comment Share on other sites More sharing options...
Alex Posted July 21, 2010 Share Posted July 21, 2010 What version of PHP are you running (you can check this by using phpinfo)?. As you can see from the manual on sha1() it requires PHP 4.3.0+. Quote Link to comment Share on other sites More sharing options...
Mchl Posted July 21, 2010 Share Posted July 21, 2010 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. Quote Link to comment Share on other sites More sharing options...
phummon Posted July 21, 2010 Author Share Posted July 21, 2010 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 Quote Link to comment Share on other sites More sharing options...
Mchl Posted July 21, 2010 Share Posted July 21, 2010 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!) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.