title: Fatal error: Call to undefined function openssl_random_pseudo_bytes()
body: <p>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.</p>
  
  <p>I get following error:</p>
  
  <pre><code>Fatal error:  Call to undefined function  openssl_random_pseudo_bytes()
  </code></pre>
  
  <p>That would be this part of code:</p>
  
  <pre><code>function crypto_rand_secure($min, $max) {
          $range = $max - $min;
          if ($range &lt; 0) return $min; // not so random...
          $log = log($range, 2);
          $bytes = (int) ($log / 8) + 1; // length in bytes
          $bits = (int) $log + 1; // length in bits
          $filter = (int) (1 &lt;&lt; $bits) - 1; // set all lower bits to 1
          do {
              $rnd = hexdec(bin2hex(openssl_random_pseudo_bytes($bytes)));
              $rnd = $rnd &amp; $filter; // discard irrelevant bits
          } while ($rnd &gt;= $range);
          return $min + $rnd;
  }
  </code></pre>
  
  <p>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.</p>
  
  <p><strong>Home »Software »Module Installers</strong></p>
  
  <p>When I choose Perl Module and search for <strong><em>openssl</em></strong>, I get many results.
  I have installed one of these, and I had installed one by default.</p>
  
  <p><em><strong>Here are installed openssl modules:</em></strong></p>
  
  <p>Crypt::OpenSSL::RSA</p>
  
  <p>Crypt::OpenSSL::Random</p>
  
  <p>Still... I get the same error on my website.
  Any solution? Thanks in advance.</p>