php Laravel 未定义函数 openssl_encrypt()

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/38582389/
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-26 01:38:14  来源:igfitidea点击:

Laravel undefined function openssl_encrypt()

phpapachelaravel

提问by Atom

I use laravel5.1 and it works fine on php cli. But i publish my porject to apache(version == 2.4), the problem happened.

我使用 laravel5.1,它在 php cli 上运行良好。但是我将我的项目发布到 apache(版本 == 2.4),问题发生了。

FatalErrorException in Encrypter.php line 67:
Call to undefined function openssl_encrypt()

Encrypter.php 第 67 行中的 FatalErrorException:
调用未定义的函数 openssl_encrypt()

回答by Peter

First make sure you installed the openssl extension(spotted by deceze), then:

首先确保您安装了openssl 扩展(由deceze发现),然后:

  1. Go to your php.inifile
  2. Remove the semicolon before extension=php_openssl.dll
  3. Restart your Apache
  1. 转到您的php.ini文件
  2. 去掉前面的分号 extension=php_openssl.dll
  3. 重启你的 Apache

I'm expecting this to be the problem.

我期待这是问题所在。

回答by endo64

I solved same issue by copying libeay32.dll and ssleay32.dll from PHP root folder to Apache/bin folder and then restarted Apache.

我通过将 libeay32.dll 和 ssleay32.dll 从 PHP 根文件夹复制到 Apache/bin 文件夹,然后重新启动 Apache 解决了同样的问题。

回答by Rajkumar Shukla

If you using the Wamp server then it's happens. In Xampp server there is no need to uncomment php_openssl.dll.

如果您使用 Wamp 服务器,则会发生这种情况。在 Xampp 服务器中,不需要取消 php_openssl.dll 的注释。

To solve this Remove the semicolon before

解决这个问题之前删除分号

extension = php_openssl.dll 

in php.ini

在 php.ini

回答by Veeru

as most point out, you need to uncomment openssl extension in php.ini.

正如大多数人指出的那样,您需要在 php.ini 中取消对 openssl 扩展的注释。

I was struggling with the same too and i realized php is looking for extensions in "c:\php", but mine was a xampp installation. Pointing extension_dirin php.ini to correct php extension path; in my case "c:\xampp\php.7\ext" solved the issue.

我也遇到了同样的问题,我意识到 php 正在寻找"c:\php" 中的扩展,但我的是 xampp 安装。指点的extension_dir在php.ini中正确的PHP扩展的路径; 在我的情况下,“c:\xampp\php.7\ext”解决了这个问题。

Hope that helps somebody.

希望能帮助某人。

回答by Motik

Follow the below steps:

请按照以下步骤操作:

  • In PHP 7.4.3 duplicate "php.ini-development"file and rename it to "php.ini"
  • Then, remove the semi-colons in front of "extension=openssl", "extension=mbstring", and "extension_dir = ext"inside the "php.ini" file.
  • 在 PHP 7.4.3 中复制“php.ini-development”文件并将其重命名为“php.ini”
  • 然后,删除“php.ini”文件中“extension=openssl”“extension=mbstring”“extension_dir = ext”前面的分号。

This worked for me and I hope it helps someone else.

这对我有用,我希望它可以帮助其他人。

回答by Lauro

I'm using nginx, and my nginx installation contained a PHP folder, something like below:

我正在使用 nginx,我的 nginx 安装包含一个 PHP 文件夹,如下所示:

C:\Users\myusername\Downloads\nginx\php\php.ini

I moved the nginx above to the root directory of C:\and it solved the problem.

我把上面的nginx移动到根目录下C:\,问题解决了。

回答by wagnow

I am using wampserver and i had the same problem. Openssl was enabled in php.ini but there is another ini called phpForApachewhich has a line to enable openssl too. It worked for me.

我正在使用 wampserver,我遇到了同样的问题。在 php.ini 中启用了 Openssl,但还有另一个名为phpForApache 的ini ,它也有一行可以启用 openssl。它对我有用。