php 致命错误:调用未定义的函数 openssl_random_pseudo_bytes()

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11212808/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-24 23:59:39  来源:igfitidea点击:

Fatal error: Call to undefined function openssl_random_pseudo_bytes()

phpopenssl

提问by Kevin Burke

I am getting this exception when trying to run my PHP unit tests:

尝试运行我的 PHP 单元测试时出现此异常:

Fatal error: Call to undefined function openssl_random_pseudo_bytes()

致命错误:调用未定义的函数 openssl_random_pseudo_bytes()

What does it mean?

这是什么意思?

采纳答案by Kevin Burke

Your version of PHP wasn't compiled with the opensslmodule. If you are building from source, add the module like so:

您的 PHP 版本未与该openssl模块一起编译。如果您是从源代码构建,请像这样添加模块:

cd /path/to/php-5.4/
./configure --with-openssl

回答by ban-geoengineering

I had the same issue. I solved it by editing my php.inifile - changing ;extension=php_openssl.dllto extension=php_openssl.dll.

我遇到过同样的问题。我通过编辑我的php.ini文件解决了它- 更改;extension=php_openssl.dllextension=php_openssl.dll.

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

(对于我的安装,我的php.ini文件位于我的P:\Program Files\EasyPHP-12.1\conf_files\目录中。)

回答by John Conde

It means you do not have the openssl extensionenabled in your PHP install. It needs to be enabled for you to use openssl_* functions.

这意味着您没有在 PHP 安装中启用openssl 扩展。需要启用它才能使用 openssl_* 函数。

回答by hitesh israni

It means you possibly don't have opensslenabled.

这意味着您可能没有启用openssl

If you are on windows its even easier to load it. Enable it from wamp icon on system tray.

如果您在 Windows 上,加载它就更容易了。从系统托盘上的 wamp 图标启用它。

enter image description here

在此处输入图片说明

enter image description here

在此处输入图片说明

回答by Tommy McGlynn

Your php installation either does not have openssl enabled, or you could be running a version of php < 5.3.

您的 php 安装要么没有启用 openssl,要么您可能正在运行 php < 5.3 的版本。

To enable openssl, you must re-compile and install php with the "–with-openssl" flag. See php installation documentation

要启用openssl,您必须使用“–with-openssl”标志重新编译和安装php。见php安装文档

回答by CamelTM

Check your configuration php.ini:

检查您的配置php.ini

; Directory in which the loadable extensions (modules) reside.
; http://php.net/extension-dir
;extension_dir = "./"
; On windows:
extension_dir = "ext"
extension=php_openssl.dll