14

I just upgraded my PHP on macOS from 7.2 to 7.3 and while trying to run composer update on a project of mine, I get the error;

PHP Fatal error:  Uncaught ErrorException: preg_match_all(): JIT compilation failed: no more memory

I've run a few Google searches; it looks like the issue is new, and I couldn't find any working documentation online.

Is this an issue related to PHP 7.3 and Composer? If so, how do I resolve it? Thanks for your help in advance.

FGM
  • 2,830
  • 1
  • 31
  • 31
Derick Alangi
  • 1,080
  • 1
  • 11
  • 31
  • Some answers here solved it: https://stackoverflow.com/questions/53690624/errors-installing-composer-on-macos-jit-compilation-failed. But it's a temporary hack. This is a known bug in PHP 7.3 – Derick Alangi Dec 21 '18 at 22:02
  • 7
    Seems to be. A workaround is to set `pcre.jit = Off` in your PHP configuration. – Ryan Parman Dec 24 '18 at 08:17
  • Yes @RyanParman, you are correct, that is a work around and I've done it already and it worked. – Derick Alangi Dec 24 '18 at 11:07
  • 3
    Possible duplicate of [Errors Installing Composer on macOS (JIT compilation Failed)](https://stackoverflow.com/questions/53690624/errors-installing-composer-on-macos-jit-compilation-failed) – Karl Hill Jan 07 '19 at 12:37

2 Answers2

13

If pcre.jit = 0 pcre.jit=0 pcre.jit = Off in php.ini, not worked, try this:

I suppose you installed php 7.3 through homebrew.

If so, create a zzz-myphp.ini in /usr/local/etc/php/7.3/conf.d with the following content:

; My php.ini settings
; Fix for PCRE "JIT compilation failed" error
[Pcre]
pcre.jit=0

If this also doesn't work, uninstall php7.3 and install 7.2 or 7.1

brew uninstall php@7.3
Basavaraj Hadimani
  • 1,094
  • 12
  • 21
8

Edit the following file

/usr/local/etc/php/7.3/php.ini

Find and change the pcre.jit variable

pcre.jit=0

If the issue remains

Try restarting your computer.

Darren Murphy
  • 1,076
  • 14
  • 12