php8-fpm is crashing with CommonCrypto on 10.11 El Capitan
Description
Hello, please look at the ticket https://trac.macports.org/ticket/74304 php8.4-fpm will compile without errors, but crash on the first id call (I run Nginx) summary, replacing #if HAVE_COMMONCRYPTO_COMMONRANDOM_H with #if 0 in /ext/random/csprng.c heals the crash. From my understanding this is necessary before 10.12 I tried 8.3 and 8.4 the patch works for both. cheers Matthias
PHP Version
PHP 8.4.27 (cli) (built: Oct 22 2026 16:13:55) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.4.27, Copyright (c) Zend Technologies
with Zend OPcache v8.4.27, Copyright (c), by Zend Technologies
note: php-fpm is the same version.
Operating System
macOS 10.11 elCapitan
Hi @quwax something like this might do the job, wdyt ?
#ifdef HAVE_COMMONCRYPTO_COMMONRANDOM_H
-# include <CommonCrypto/CommonCryptoError.h>
-# include <CommonCrypto/CommonRandom.h>
+# include <AvailabilityMacros.h>
+# if MAC_OS_X_VERSION_MIN_REQUIRED >= 101200
+# define PHP_USE_CCRANDOMGENERATEBYTES 1
+# include <CommonCrypto/CommonCryptoError.h>
+# include <CommonCrypto/CommonRandom.h>
+# endif
#endif
@@
-#elif defined(HAVE_COMMONCRYPTO_COMMONRANDOM_H)
+#elif defined(PHP_USE_CCRANDOMGENERATEBYTES)
Just to add one tiny piece of additional information, this doesn't just affect php-fpm, it also affects libphp in apache directly. And I tested it with all versions of php 8 and it affects them all including 8.6. All on El Capitan.
@l008com this patch is in /etc/random Thus, everything that needs this will get the fix