PHP 7 在 PCRE
中加入了 JIT
功能,導致 Composer 安裝會遇到以下錯誤訊息:
PHP Fatal error: Uncaught ErrorException: preg_match_all(): JIT compilation failed: no more memory in phar:///usr/local/Cellar/composer/1.8.0/bin/composer/vendor/symfony/console/Formatter/OutputFormatter.php:137
暫時的解法是先將 pcre.jit
關閉:
$ vi /usr/local/etc/php/7.3/php.ini ;pcre.jit=1 pcre.jit=0
參考:Errors Installing Composer on macOS (JIT compilation Failed)