php - 错误在macOS上安装Composer(JIT编译失败)




composer-php (4)

其他答案建议通过配置文件禁用PCRE JIT。 这有效,但需要注意:这会禁用 所有 使用这些INI文件的引擎调用的PCRE JIT。 因此,您可能无法获得JIT改进的潜在更广泛的功能,这可能是不可取的。

您只能通过以下方式禁用 composer JIT:

php -d pcre.jit=0 composer.phar ...

当我在macOS终端中运行 composer --version ,我收到以下错误:

PHP警告:preg_match():JIT编译失败:第755行的phar:///usr/local/bin/composer.phar/vendor/symfony/console/Application.php中没有更多内存

Warning: preg_match(): JIT compilation failed: no more memory in phar:///usr/local/bin/composer.phar/vendor/symfony/console/Application.php on line 755
PHP Warning:  preg_match(): JIT compilation failed: no more memory in phar:///usr/local/bin/composer.phar/vendor/symfony/console/Application.php on line 759

Warning: preg_match(): JIT compilation failed: no more memory in phar:///usr/local/bin/composer.phar/vendor/symfony/console/Application.php on line 759
PHP Warning:  preg_split(): JIT compilation failed: no more memory in phar:///usr/local/bin/composer.phar/vendor/symfony/console/Application.php on line 654

Warning: preg_split(): JIT compilation failed: no more memory in phar:///usr/local/bin/composer.phar/vendor/symfony/console/Application.php on line 654
PHP Warning:  preg_split(): JIT compilation failed: no more memory in phar:///usr/local/bin/composer.phar/vendor/symfony/console/Application.php on line 1091

Warning: preg_split(): JIT compilation failed: no more memory in phar:///usr/local/bin/composer.phar/vendor/symfony/console/Application.php on line 1091
PHP Warning:  preg_replace(): JIT compilation failed: no more memory in phar:///usr/local/bin/composer.phar/vendor/symfony/console/Formatter/OutputFormatter.php on line 36

Warning: preg_replace(): JIT compilation failed: no more memory in phar:///usr/local/bin/composer.phar/vendor/symfony/console/Formatter/OutputFormatter.php on line 36

  [ErrorException]                                          
  preg_match_all(): JIT compilation failed: no more memory

在PHP 7.1.24中,php.ini文件中没有 'pcre.jit' ,所以你必须设置 memory_limit:128M (如果你增加它)。


谢谢你的答案..我通过命令composer.phar解决了它,然后导出路径。 例:

$composer.phar
$export PATH=/usr/local/php5/bin:$PATH
$composer.phar --version

这是一个已知的PHP 7.3 bug

作为临时修复,编辑您的php.ini文件(在我的情况下: vi /usr/local/etc/php/7.3/php.ini ),通过更改以下命令禁用PHP PCRE JIT编译:

;pcre.jit=1

pcre.jit=0






jit