How do I set pcre.jit=0?

Nextcloud version : 20.0.5
Operating system and version: Ubuntu 18.04.4 LTS
Apache or nginx version (eg, Apache 2.4.25): Apache 2 (unsure of full version)
PHP version: PHP 7.4.11

I’m encountering Internal Server Errors when I try to sync and one of the errors in my log says this:

preg_replace(): 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 at /home/abh/velociraptor/nextcloud/lib/private/DB/AdapterSqlite.php#46

But when I view line 46, I see this (line numbers included for clarity):

 45   public function fixupStatement($statement) {
 46     $statement = preg_replace('/`(\w+)` ILIKE \?/', 'LOWER($1) LIKE LOWER(?)    ', $statement);
 47     $statement = str_replace('`', '"', $statement);
 48     $statement = str_ireplace('NOW()', 'datetime(\'now\')', $statement);
 49     $statement = str_ireplace('GREATEST(', 'MAX(', $statement);
 50     $statement = str_ireplace('UNIX_TIMESTAMP()', 'strftime(\'%s\',\'now\')'    , $statement);
 51     return $statement;
 52   }

It’s not obvious to me how to add the pcre.jit=0 setting there. I think it would need to be phrased as a string replace, which seems very different from what the error is asking me to do.

For Dreamhost users, the solution is described at:

JIT compilation failed: no more memory errors

If you are seeing “JIT compilation failed: no more memory” errors on your site, this is due to a known bug in PHP 7.3. To work around this, you can disable the JIT compiler by adding the following line to your phprc file:

pcre.jit = 0
1 Like