Error PHP preg_match(): Unknown modifier '2'

Nextcloud version (eg, 20.0.5): 28.0.1.1
Operating system and version (eg, Ubuntu 20.04): Ubuntu 22.04.3 LTS
Apache or nginx version (eg, Apache 2.4.25): not used
PHP version (eg, 7.4): PHP 8.1.2-1ubuntu2.14

The issue you are facing:
My logs keep filling with the error mentioned in the title and i can’t figure out what is causing the error in the first place

Is this the first time you’ve seen this error? (Y/N): Y

Steps to replicate it:

  1. Updated docker image
  2. Run docker

The output of your Nextcloud log in Admin > Logging:

Error	PHP	
preg_match(): Unknown modifier '2' at /var/www/html/lib/private/AppFramework/Http/Request.php#631

Dec 27, 2023, 2:42:55 PM	

Error	PHP	
preg_match(): Unknown modifier '2' at /var/www/html/lib/private/AppFramework/Http/Request.php#631

Dec 27, 2023, 2:42:55 PM	

Error	PHP	
preg_match(): Unknown modifier '2' at /var/www/html/lib/private/AppFramework/Http/Request.php#631

Dec 27, 2023, 2:42:53 PM	

Error	PHP	
preg_match(): Unknown modifier '2' at /var/www/html/lib/private/AppFramework/Http/Request.php#631

Dec 27, 2023, 2:42:53 PM	

Error	PHP	
preg_match(): Unknown modifier '2' at /var/www/html/lib/private/AppFramework/Http/Request.php#631

Dec 27, 2023, 2:42:52 PM	

Error	PHP	
preg_match(): Unknown modifier '2' at /var/www/html/lib/private/AppFramework/Http/Request.php#631

Dec 27, 2023, 2:42:52 PM	

Error	PHP	
preg_match(): Unknown modifier '2' at /var/www/html/lib/private/AppFramework/Http/Request.php#631

Dec 27, 2023, 2:42:52 PM	

Error	PHP	
preg_match(): Unknown modifier '2' at /var/www/html/lib/private/AppFramework/Http/Request.php#631

Dec 27, 2023, 2:42:47 PM	

Error	PHP	
preg_match(): Unknown modifier '2' at /var/www/html/lib/private/AppFramework/Http/Request.php#631

Dec 27, 2023, 2:42:47 PM	

Error	PHP	
preg_match(): Unknown modifier '2' at /var/www/html/lib/private/AppFramework/Http/Request.php#631

Dec 27, 2023, 2:42:46 PM	

Error	PHP	
preg_match(): Unknown modifier '2' at /var/www/html/lib/private/AppFramework/Http/Request.php#631

Dec 27, 2023, 2:42:45 PM	

Error	PHP	
preg_match(): Unknown modifier '2' at /var/www/html/lib/private/AppFramework/Http/Request.php#631

Dec 27, 2023, 2:42:45 PM	

Error	PHP	
preg_match(): Unknown modifier '2' at /var/www/html/lib/private/AppFramework/Http/Request.php#631

Dec 27, 2023, 2:42:45 PM	

Error	PHP	
preg_match(): Unknown modifier '2' at /var/www/html/lib/private/AppFramework/Http/Request.php#631

Dec 27, 2023, 2:42:45 PM	

Error	PHP	
preg_match(): Unknown modifier '2' at /var/www/html/lib/private/AppFramework/Http/Request.php#631

Dec 27, 2023, 2:42:45 PM	

Error	PHP	
preg_match(): Unknown modifier '2' at /var/www/html/lib/private/AppFramework/Http/Request.php#631

Dec 27, 2023, 2:42:45 PM	

Error	PHP	
preg_match(): Unknown modifier '2' at /var/www/html/lib/private/AppFramework/Http/Request.php#631

Dec 27, 2023, 2:42:45 PM	

Error	PHP	
preg_match(): Unknown modifier '2' at /var/www/html/lib/private/AppFramework/Http/Request.php#631

Dec 27, 2023, 2:42:45 PM	

Error	PHP	
preg_match(): Unknown modifier '2' at /var/www/html/lib/private/AppFramework/Http/Request.php#631

Dec 27, 2023, 2:42:45 PM	

Error	PHP	
preg_match(): Unknown modifier '2' at /var/www/html/lib/private/AppFramework/Http/Request.php#631

Dec 27, 2023, 2:42:45 PM	


The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'htaccess.RewriteBase' => '/',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'apps_paths' => 
  array (
    0 => 
    array (
      'path' => '/var/www/html/apps',
      'url' => '/apps',
      'writable' => false,
    ),
    1 => 
    array (
      'path' => '/var/www/html/custom_apps',
      'url' => '/custom_apps',
      'writable' => true,
    ),
  ),
  'instanceid' => 'oc0uhtesls33',
  'passwordsalt' => '*removed*',
  'secret' => '*removed*',
  'trusted_domains' => 
  array (
    0 => '192.168.0.184:8080',
    1 => 'old.domain.com',
    2 => 'currentdomain.com',
    3 => '*.currentdomain.com',
  ),
  'trusted_proxies' => 
  array (
    0 => '192.168.0.184/24',
    1 => '192.168.0.1/24',
  ),
  'overwrite.cli.url' => 'https://old.domain.com',
  'overwriteprotocol' => 'https',
  'overwritecondaddr' => '192.168.0.1/24',
  'datadirectory' => '/var/www/html/data',
  'dbtype' => 'mysql',
  'version' => '28.0.1.1',
  'dbname' => 'nextcloud',
  'dbhost' => 'db',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => 'secret',
  'installed' => true,
  'updater.secret' => 'no',
  'loglevel' => 2,
  'maintenance' => false,
);

The output of your Apache/nginx/system log in /var/log/____:
not found

Output errors in nextcloud.log in /var/www/ or as admin user in top right menu, filtering for errors. Use a pastebin service if necessary.

This line isn’t correct and it’s triggering that weird error you’re seeing. Depending on what your intention is, it may not be necessary, but that depends on why you added it. It needs to be a regular expression[1][2].

[1] Configuration Parameters — Nextcloud latest Administration Manual latest documentation

[2] Reverse proxy — Nextcloud latest Administration Manual latest documentation

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.