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

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

PHP Fatal Error: Call to undefined function password_verify()

php

提问by Ceeee

I have PHP 5.5.6on my XAMPP and I didn't encounter the error. But after uploading my website to our testing environment the following error occurred:

PHP 5.5.6在我的 XAMPP 上没有遇到错误。但是将我的网站上传到我们的测试环境后,出现以下错误:

PHP Fatal Error: Call to undefined function password_verify()

Our testing envt/server has PHP 5.5.9 (I checked it using command php -v)

我们的测试环境/服务器有 PHP 5.5.9(我使用命令检查过php -v

I also checked the PHP manual and it says nothing to configure and nothing to install when using this functions. Any ideas what might be causing this issue?

我还检查了 PHP 手册,它说在使用此功能时无需配置和安装。任何想法可能导致此问题?

回答by Fleshgrinder

password_verify()is built in since PHP 5.5.0 and it's most likely that your server doesn't run the latest PHP version. Be sure to double check the PHP version on your server either via phpinfo()or phpversion().

password_verify()自 PHP 5.5.0 起内置,很可能您的服务器没有运行最新的 PHP 版本。请务必通过phpinfo()或仔细检查服务器上的 PHP 版本phpversion()

Please note that your CLI and mod_php(or php-fpm) versions might differ, executing php -vmight give you a wrong version number. Create a PHP file and open it with your browser to be absolutely sure.

请注意,您的 CLI 和mod_php(或 php-fpm)版本可能不同,执行php -v可能会给您错误的版本号。创建一个 PHP 文件并用您的浏览器打开它以确保万无一失。

The reason for the differing versions of the CLI, mod_phpand php-fpm are related to the packages which are offered by the operating system and what the actual administrator installed on the system. Personally I prefer to compile PHP on my own and be sure to get best performance but also the same version across the complete system.

CLImod_php和 php-fpm版本不同的原因与操作系统提供的软件包以及实际管理员在系统上安装的软件包有关。就我个人而言,我更喜欢自己编译 PHP,并确保在整个系统中获得最佳性能和相同版本。

回答by Slawa

Replacement for PHP versions lower than 5.5

替换低于 5.5 的 PHP 版本

https://github.com/Antnee/phpPasswordHashingLib

https://github.com/Antnee/phpPasswordHashingLib