Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: make throws an exception: Allocation of JIT memory failed, PCRE JIT will be disabled #7192

Closed
wants to merge 1 commit into from

Conversation

onanying
Copy link

fix: make throws an exception: Allocation of JIT memory failed, PCRE JIT will be disabled. This is likely caused by security restrictions. Either grant PHP permission to allocate executable memory, or set pcre.jit=0 in /Users/***/Downloads/php-8.0.7/ext/phar/phar.php:1136

…JIT will be disabled. This is likely caused by security restrictions. Either grant PHP permission to allocate executable memory, or set pcre.jit=0 in /Users/***/Downloads/php-8.0.7/ext/phar/phar.php:1136
@onanying
Copy link
Author

liujian@admindeMac-mini php-8.0.7 % sudo make
Password:
Generating phar.phar
PEAR package PHP_Archive not installed: generated phar will require PHP's phar extension be enabled.

Fatal error: Uncaught InvalidArgumentException: RegexIterator::__construct(): Allocation of JIT memory failed, PCRE JIT will be disabled. This is likely caused by security restrictions. Either grant PHP permission to allocate executable memory, or set pcre.jit=0 in /Users/liujian/Downloads/php-8.0.7/ext/phar/phar.php:1136
Stack trace:
#0 /Users/liujian/Downloads/php-8.0.7/ext/phar/phar.php(1136): RegexIterator->__construct(Object(RecursiveIteratorIterator), '/\\.svn/')
#1 /Users/liujian/Downloads/php-8.0.7/ext/phar/phar.php(1080): PharCommand::phar_add(Object(Phar), 0, '/Users/liujian/...', NULL, '/\\.svn/', Object(SplFileInfo), NULL, true)
#2 /Users/liujian/Downloads/php-8.0.7/ext/phar/phar.php(228): PharCommand->cli_cmd_run_pack(Array)
#3 /Users/liujian/Downloads/php-8.0.7/ext/phar/phar.php(2092): CLICommand->__construct(19, Array)
#4 {main}
  thrown in /Users/liujian/Downloads/php-8.0.7/ext/phar/phar.php on line 1136
make: *** [ext/phar/phar.phar] Error 255

@@ -642,6 +642,8 @@ class PharCommand extends CLICommand
$dir = new InvertedRegexIterator($dir, $invregex);
}

ini_set('pcre.jit', '0');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is wrong as it will be set globally which is unwanted behaviour.

@nikic
Copy link
Member

nikic commented Jun 28, 2021

This warning indicates that you have an incorrectly configured system. You need to fix your system configuration to give PHP the necessary permissions. If this is not possible, you need to disable pcre.jit globally. We cannot accept this in individual scripts, as it's a system-specific issue.

@nikic nikic closed this Jun 28, 2021
@onanying
Copy link
Author

@nikic This is in the make phase, PHP has not been installed yet, but prompt this, I am MacOS Apple Silicon System

@nikic
Copy link
Member

nikic commented Jul 6, 2021

@onanying I see. There is a known compatibility issue, see zherczeg/sljit#99 and zherczeg/sljit#105. I hope we can backport a fix for this soon.

@SammyK
Copy link
Contributor

SammyK commented Dec 30, 2021

FWIW if anyone else is running into this issue and don't particularly need PCRE JIT you can disable it.

$ ./configure --without-pcre-jit

@kelunik
Copy link
Member

kelunik commented Aug 8, 2022

See #9279 for PHP 8.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants