问题
My local installation of PHP started doing this recently, but I don't know what changed and could have started this. It completely stalls out with 100% CPU utilization when I call mycrypt_create_iv
, but only when that's called by Apache. When I call it from the CLI, it returns almost instantly. My test file is as follows:
<?php echo mcrypt_create_iv(16, MCRYPT_DEV_URANDOM);
The values are, of course, what the function was getting called with when I discovered this issue. This issue happens with either PHP 5.5 or 5.6, so I don't think it's the specific PHP version.
I'm running Gentoo Linux, so it's possible that the root cause was a build issue, but I've rebuilt libmcrypt, PHP, and Apache to no effect.
回答1:
After some experimentation, I got it.
I did not have APACHE2_MPMS
set in make.conf
, so it defaulted to the worker
MPM. I set it to use prefork
and this problem cleared away.
I did have the threads
USE flag set, which conflicted with prefork
and PHP, so I removed that use flag. With my profile, that meant that most packages with that flag still had it set, but php
and mod_php
disabled.
回答2:
seems a bug(https://bugs.php.net/bug.php?id=69833) of php which fixed in 5.6.13
来源:https://stackoverflow.com/questions/31629754/mcrypt-create-iv-stalls-but-only-through-apache