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.
After some experimentation, I got it.
I did not have
APACHE2_MPMS
set inmake.conf
, so it defaulted to theworker
MPM. I set it to useprefork
and this problem cleared away.I did have the
threads
USE flag set, which conflicted withprefork
and PHP, so I removed that use flag. With my profile, that meant that most packages with that flag still had it set, butphp
andmod_php
disabled.seems a bug(https://bugs.php.net/bug.php?id=69833) of php which fixed in 5.6.13