Take the 2-minute tour ×

I have found an script that will randomly generate numbers/letters for an X amount. It works fine on my localhost however when I upload the script to my VPS it does not work.

I get following error:

Fatal error:  Call to undefined function  openssl_random_pseudo_bytes()

That would be this part of code:

function crypto_rand_secure($min, $max) {
        $range = $max - $min;
        $log = log($range, 2);
        do {
        } while ($rnd >= $range);
        return $min + $rnd;

I have found an post on stacksoverflow with the same issue. However it required an module installed. I am not sure how do I do this, but i have found this on my WHM of VPS.

Home »Software »Module Installers

When I choose Perl Module and search for openssl, I get many results. I have installed one of these, and I had installed one by default.

Here are installed openssl modules:



Still... I get the same error on my website. Any solution? Thanks in advance.

share|improve this question

3 Answers 3

up vote 2 down vote accepted

The OpenSSL Perl modules you found are a red herring. They have no effect whatsoever on PHP. (PHP and Perl are two entirely separate programming languages.)

What you need to install is the openssl PHP module. I don't recall exactly whether cPanel has an option to rebuild PHP, but if I'm right and it does, you'll need to go through that process and enable OpenSSL there.

share|improve this answer

You need also to compile php with --with-openssl as stated in http://php.net/manual/en/openssl.installation.php.

share|improve this answer

I had the same issue myself. I solved it by editing my php.ini file - changing ;extension=php_openssl.dll to extension=php_openssl.dll .

(For my installation, my php.ini file was located in my P:\Program Files\EasyPHP-12.1\conf_files\ directory.)

share|improve this answer

Your Answer


