Core-login.js throwing PHP Fatal Error

Nextcloud version (eg, 20.0.5): 24.0.0.12
Operating system and version (eg, Ubuntu 20.04): 22.04
Apache or nginx version (eg, Apache 2.4.25): 2.4.52
PHP version (eg, 7.4): 8.0

The issue you are facing:
NextCloud Login screen does not properly load

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

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

<?php
$CONFIG = array (
  'passwordsalt' => 'xxxx',
  'secret' => 'xxxx',
  'trusted_domains' => 
  array (
    0 => 'localhost',
    1 => 'xxxx.com',
  ),
  'datadirectory' => '/var/www/nextcloud/data',
  'loglevel' => 0,
  'debug' => true,
  'dbtype' => 'mysql',
  'version' => '24.0.0.12',
  'overwrite.cli.url' => 'http://localhost',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => 'xxxx',
  'installed' => true,
  'instanceid' => 'ocy7c5goeqoi',
);

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

[Sat May 07 22:04:36.535462 2022] [core:notice] [pid 974215] AH00094: Command line: '/usr/sbin/apache2'
[Sat May 07 22:04:39.066122 2022] [php:error] [pid 974222] [client 127.0.0.1:37046] PHP Fatal error:  Uncaught Error: Call to undefined function p() in /var/www/nextcloud/dist/core-login.js:2\nStack trace:\n#0 {main}\n  thrown in /var/www/nextcloud/dist/core-login.js on line 2
[Sat May 07 22:07:05.499331 2022] [php:error] [pid 981769] [client 127.0.0.1:37070] PHP Fatal error:  Uncaught Error: Call to undefined function p() in /var/www/nextcloud/dist/core-login.js:2\nStack trace:\n#0 {main}\n  thrown in /var/www/nextcloud/dist/core-login.js on line 2
[Sat May 07 22:08:07.266569 2022] [php:error] [pid 984696] [client 127.0.0.1:37074] PHP Fatal error:  Uncaught Error: Call to undefined function p() in /var/www/nextcloud/dist/core-login.js:2\nStack trace:\n#0 {main}\n  thrown in /var/www/nextcloud/dist/core-login.js on

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.

{"reqId":"6DKEEFvQr7UmTkXMRMPA","level":3,"time":"2022-05-08T02:58:31+00:00","remoteAddr":"","user":"--","app":"index","method":"","url":"--","message":"The requested uri() cannot be processed by the script '/var/www/nextcloud/index.php')","userAgent":"--","version":"24.0.0.12","exception":{"Exception":"Exception","Message":"The requested uri() cannot be processed by the script '/var/www/nextcloud/index.php')","Code":0,"Trace":[{"file":"/var/www/nextcloud/lib/base.php","line":961,"function":"getRawPathInfo","class":"OC\\AppFramework\\Http\\Request","type":"->"},{"file":"/var/www/nextcloud/index.php","line":36,"function":"handleRequest","class":"OC","type":"::"}],"File":"/var/www/nextcloud/lib/private/AppFramework/Http/Request.php","Line":760,"CustomMessage":"--"}}

Output of sudo -u www-data /var/www/nextcloud/index.php

/var/www/nextcloud/index.php: 1: cannot open ?php: No such file
/var/www/nextcloud/index.php: 2: /bin: Permission denied
/var/www/nextcloud/index.php: 3: Syntax error: "(" unexpected

Output of php /var/www/nextcloud/index.php with nextcloud directory a+rwx permissions

Your data directory is readable by other users.
Please change the permissions to 0770 so that the directory cannot be listed by other users.

Output of php /var/www/nextcloud/index.php with nextcloud directory 770 permissions

{"reqId":"P8bdXZeHhVq2oVSAJ1NJ","level":3,"time":"2022-05-08T03:36:00+00:00","remoteAddr":"","user":"--","app":"PHP","method":"","url":"--","message":"fopen(/var/www/nextcloud/data//data_dir_writability_test_62773aa0146d4.tmp): Failed to open stream: Permission denied at /var/www/nextcloud/lib/private/legacy/OC_Util.php#580","userAgent":"--","version":"24.0.0.12","exception":{"Exception":"Error","Message":"fopen(/var/www/nextcloud/data//data_dir_writability_test_62773aa0146d4.tmp): Failed to open stream: Permission denied at /var/www/nextcloud/lib/private/legacy/OC_Util.php#580","Code":0,"Trace":[{"function":"onAll","class":"OC\\Log\\ErrorHandler","type":"::"},{"file":"/var/www/nextcloud/lib/private/legacy/OC_Util.php","line":580,"function":"fopen"},{"file":"/var/www/nextcloud/lib/base.php","line":670,"function":"checkServer","class":"OC_Util","type":"::"},{"file":"/var/www/nextcloud/lib/base.php","line":1104,"function":"init","class":"OC","type":"::"},{"file":"/var/www/nextcloud/index.php","line":34,"args":["/var/www/nextcloud/lib/base.php"],"function":"require_once"}],"File":"/var/www/nextcloud/lib/private/Log/ErrorHandler.php","Line":99,"CustomMessage":"--"}}
Your data directory is invalid.
Ensure there is a file called ".ocdata" in the root of the data directory.

Your data directory is not writable.
Permissions can usually be fixed by giving the web server write access to the root directory. See https://docs.nextcloud.com/server/24/go.php?to=admin-dir_permissions.

{"reqId":"P8bdXZeHhVq2oVSAJ1NJ","level":3,"time":"2022-05-08T03:36:00+00:00","remoteAddr":"","user":"--","app":"PHP","method":"","url":"--","message":"fopen(/var/www/nextcloud/data//nextcloud.log): Failed to open stream: Permission denied at /var/www/nextcloud/lib/private/Log/File.php#84","userAgent":"--","version":"24.0.0.12","exception":{"Exception":"Error","Message":"fopen(/var/www/nextcloud/data//nextcloud.log): Failed to open stream: Permission denied at /var/www/nextcloud/lib/private/Log/File.php#84","Code":0,"Trace":[{"function":"onAll","class":"OC\\Log\\ErrorHandler","type":"::"},{"file":"/var/www/nextcloud/lib/private/Log/File.php","line":84,"function":"fopen"},{"file":"/var/www/nextcloud/lib/private/Log.php","line":371,"function":"write","class":"OC\\Log\\File","type":"->"},{"file":"/var/www/nextcloud/lib/private/Log.php","line":214,"function":"writeLog","class":"OC\\Log","type":"->"},{"file":"/var/www/nextcloud/lib/private/Log.php","line":131,"function":"log","class":"OC\\Log","type":"->"},{"file":"/var/www/nextcloud/lib/private/Log/ErrorHandler.php","line":70,"function":"critical","class":"OC\\Log","type":"->"},{"function":"onShutdown","class":"OC\\Log\\ErrorHandler","type":"::"}],"File":"/var/www/nextcloud/lib/private/Log/ErrorHandler.php","Line":99,"CustomMessage":"--"}}
{"reqId":"P8bdXZeHhVq2oVSAJ1NJ","level":3,"time":"2022-05-08T03:36:00+00:00","remoteAddr":"","user":"--","app":"PHP","method":"","url":"--","message":"fopen(/var/www/nextcloud/data//nextcloud.log): Failed to open stream: Permission denied at /var/www/nextcloud/lib/private/Log/File.php#84","userAgent":"--","version":"24.0.0.12"}