Call to undefined function openssl_decrypt

CJ_COIMBRA picture CJ_COIMBRA · Jan 14, 2015 · Viewed 36k times · Source

When I try to make a request with POST to a script that has this line:

$decrypted_data = openssl_decrypt($encrypted_data, 'AES-256-CBC', $key);

I get the following error:

Fatal error: Call to undefined function openssl_decrypt() in mypath/usuario_webservice.php on line 11

After some research the common reasons would be entering the wrong name for the function or the openssl extension not being installed on my web server. It turns out that it is installed as I checked with the support. So, what else should I be looking for?

Answer

Sambhav Pandey picture Sambhav Pandey · Jul 30, 2016

I am posting this as it might be helpful to some.

  • Check extension=php_openssl.dll is enabled in your php.ini.
  • Check extension_dir is pointed correctly in php.ini.

If you have recently upgraded your php version and not your Apache then it might be a possibility that correct libeay32.dlland ssleay32.dll are not being read which is a requirement for openssl or some version mismatch is happening.

  • Get latest version of libeay32.dlland ssleay32.dll or copy it from your php directory say C:\php and overwrite the files in your Apache\bin say C:\Apache24\bin directory.

Hope this will help.