views:

18

answers:

2

My PHP version is 5.2.11 which is higher than the required version for hash_algos. however, when I run it either via web or command line, it returns

Fatal error: Call to undefined function hash_algos() 

So as for other Hash functions. Do i have to turn anything on in the php.inin or what should I do?

I have checked the php --re hash
and the extension isn't there. I am very sure it is either not there or disabled.

I also tried to installed it (PECL) but don't know how.

+2  A: 

You'll need to install the Hash PECL module:

http://pecl.php.net/package/hash

To do this, you're going to need to have server access. Make sure you have PECL installed:

apt-get install php5-pear php5-dev

and run

pecl install hash

Hope this helps!

mattbasta
i tried to run the first one.. apt-get install php5-pear php5-dev but it says the function apt-get is not found.and then I just run pecl install hash the install runs but it doesn't seem like actually installing it even I restart the nginx server.
seatoskyhk
If you're running nginx, you'll probably need to reboot php-fpm, too. `/etc/init.d/php restart` or `/etc/init.d/php-fpm restart`. You might need to look in your `/etc/init.d/` folder.
mattbasta
thanks.. at last, I have to recompile php and then restart. Thanks for your help. :)
seatoskyhk
+1  A: 

hash_algos and the related functions in the Hash module are built into PHP, so there's no extension you need to enable in your php.ini.

Given that you can't use the function anyway, it has most likely been disabled during compilation of PHP.

If you aren't able to recompile PHP, or otherwise install a version where this hsan't been disabled, you should be able to install the PECL module like described by mattbasta.

Michael Madsen