PHP 5.6 OpenSSL 不工作

PHP 5.6 OpenSSL not working

我正在尝试创建一个 API 但是 运行 出现以下错误

file_get_contents(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP?

正在检查是否启用了 OpenSSL 和包装器:

openssl: no
http wrapper: yes
https wrapper: no
wrappers: array(6) { [0]=> string(3) "php" [1]=> string(4) "file" [2]=> string(4) "glob" [3]=> string(4) "data" [4]=> string(4) "http" [5]=> string(3) "ftp" }

尝试了我能找到的一切,但没有任何效果。

PHP version: 5.6.1
OS: SLES 12

如果您需要更多信息,请告诉我。

为了启用 php_openssl 扩展,我做了以下操作:

看起来 php_openssl 扩展在您的系统上不存在或者没有加载到他的 php 核心中。

我不是 SLES 专家,但可能有一个 php-openssl 软件包(如果存在)您应该可以通过

安装
zypper install php-openssl

(也许是 sudo zypper....)

如果 php 作为 apache 模块安装,则必须重新启动 httpd。
之后你应该检查 php_openssl.so 是否被加载到核心中。为此,在 php.ini 文件之一的某处应该有一个 extension=php_openssl.so 条目(或者它只是扩展名=openssl.so?抱歉,也许其他人可以填写 SLES 的细节)。
<?php phpinfo(); 可以告诉您使用了哪个 ini 文件。
但是在 SLES 安装中可能有一个用于管理 php 扩展的工具。对于 Ubuntu 你会使用 php5enmod.

重新安装了 OpenSSL,现在可以使用了。