简体   繁体   English

PHP的MD5哈希函数返回500内部错误

[英]php md5 hash function returning a 500 internal error

I am trying to create a md5 hash for a string but the problem is that whenever I use md5 function and run the file, it returns a 500 internal error. 我正在尝试为字符串创建md5哈希,但是问题是,每当我使用md5函数并运行文件时,它都会返回500内部错误。

the code i am using is 我正在使用的代码是

$php_hash_string = md5("test_hash");

When I comment out the file the error is not produced and the rest of the output is printed out but when i use the md5 function it generates 500 internal server error. 当我注释掉该文件时,不会产生该错误,并且输出的其余内容将被打印出来,但是当我使用md5函数时,它将生成500个内部服务器错误。

Can anyone please help me solve this problem? 谁能帮我解决这个问题?

Server info: LAMP on CentOS 5.6 服务器信息:CentOS 5.6上的LAMP

I don't know if you want to use this way, but at least try it. 我不知道您是否要使用这种方式,但至少可以尝试一下。

$md5 = md5("test_hash");
$php_hash_string = $md5;

It's probably just stupid try, but mostly only stupid things make problems. 这可能只是愚蠢的尝试,但大多数情况下只有愚蠢的事情会引起问题。

And put in top of the file this: 并将其放在文件顶部:

error_reporting (E_ALL ^ E_NOTICE);

the code i am using is $php_hash_string = md5("test_hash"); 我使用的代码是$ php_hash_string = md5(“ test_hash”); When I comment out the file the error is not produced and the rest of the output is printed 当我注释掉文件时,不会产生错误,并且输出的其余部分将被打印

So that's not the code you are using, only a part of it. 因此,这不是您正在使用的代码,只是一部分。

The first step is to confirm that it really is the md5() call which is causing the problem. 第一步是确认确实是引起问题的md5()调用。 Do you still get problems with a script containing only that one statement? 使用包含一个语句的脚本,您仍然遇到问题吗?

it returns a 500 internal error. 它返回500内部错误。

Have you verified that your installation is correctly configured to report/log PHP errors? 您是否已验证安装正确配置为报告/记录PHP错误? And that it is not logging errors when executing the md5 function? 而且执行md5函数时是否记录错误? And there is nothing related to this logged by the webserver? 与Web服务器记录的内容无关吗? eg try: 例如尝试:

<?php
 for (
?>

(this should produce a fatal parsing error) (这将产生致命的解析错误)

确保您执行yum install php-mcrypt,看看是否有区别

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM