Thanks to visit codestin.com
Credit goes to github.com

Skip to content

OC::$server must not be accessed before initialization #50652

@prismplex

Description

@prismplex

⚠️ This issue respects the following points: ⚠️

Bug description

Upgraded my PHP version today (manjaro linux), since then a few things including apparmor got messed up. My nextcloud files live in a /home folder, my data on a separate RAID1 mounted in /mnt/xxx.
After setting /etc/apparmor.d/php-fpm

  # Allow read/write access to the user's home directory
  /home/** rw,
  /mnt/xxx/** rw,

(found here symfony-cli guthub)

other php apps work as expected.
Even tried to disable apparmor, does not make a difference, used a fresh install (.zip) 30.0.4 and 30.0.5, copied the nginx.conf example from the official webpage 1:1, still same error.

Steps to reproduce

  1. Use php-fpm 8.3.15 and nginx-1.26.2
  2. Install nextcloud
  3. no error other than OC::$server must not be accessed before initialization in nginx.error log, HTTP ERROR 500 in browser (detailed logs following):
    full nginx log:
#0 /home/***sensitive-information***/nginx/cloud/remote.php(148): handleException()
#1 {main}
  thrown in /home/***sensitive-information***/nginx/cloud/remote.php on line 28" while reading response header from upstream, client: ***sensitive-information***, server: ***sensitive-information***.com, request: "PROPFIND /remote.php/webdav/ HTTP/1.1", upstream: "fastcgi://127.0.0.1:9003", host: "***sensitive-information***.com"
2025/02/04 18:31:07 [error] 75799#75799: *3325 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught Error: Typed static property OC::$server must not be accessed before initialization in /home/***sensitive-information***/nginx/cloud/lib/public/Server.php:39
Stack trace:
#0 /home/***sensitive-information***/nginx/cloud/index.php(83): OCP\Server::get()
#1 {main}
  thrown in /home/***sensitive-information***/nginx/cloud/lib/public/Server.php on line 39" while reading response header from upstream, client: 178.13.234.253, server: ***sensitive-information***.com, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9003", host: "***sensitive-information***.com"

Expected behavior

to be accessible as before

Nextcloud Server version

30

Operating system

Other

PHP engine version

PHP 8.3

Web server

Nginx

Database engine version

MariaDB

Is this bug present after an update or on a fresh install?

None

Are you using the Nextcloud Server Encryption module?

None

What user-backends are you using?

  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other

Configuration report

{
    "system": {
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "cloud.prismplex.com",
            "cloud.prismplex.io"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "tempdirectory": "\/mnt\/be7e159b-ef26-4d35-b5e1-d5a0477ab9e6\/data\/tmp",
        "overwrite.cli.url": "https:\/\/cloud.prismplex.com\/",
        "dbtype": "mysql",
        "version": "30.0.5.1",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "theme": "",
        "maintenance": false,
        "filelocking.enabled": true,
        "memcache.local": "\\OC\\Memcache\\APCu",
        "memcache.distributed": "\\OC\\Memcache\\Redis",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": 0,
            "dbindex": 0,
            "timeout": 1.5
        },
        "auth.bruteforce.protection.enabled": true,
        "mail_smtpmode": "smtp",
        "mail_smtpsecure": "ssl",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpauthtype": "LOGIN",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "465",
        "preview_libreoffice_path": "\/usr\/lib\/libreoffice",
        "loglevel": 3,
        "trashbin_retention_obligation": "auto",
        "logtimezone": "UTC",
        "htaccess.RewriteBase": "\/cloud",
        "mail_smtpauth": 1,
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "updater.release.channel": "stable",
        "has_rebuilt_cache": true,
        "mysql.utf8mb4": true,
        "default_phone_region": "DE",
        "encryption.legacy_format_support": false,
        "encryption.key_storage_migrated": false,
        "trusted_proxies": "***REMOVED SENSITIVE VALUE***",
        "app_install_overwrite": [
            "polls",
            "breezedark",
            "bookmarks",
            "carnet",
            "cookbook",
            "gallery",
            "twofactor_u2f"
        ],
        "enforce_theme": "",
        "maintenance_window_start": 1,
        "memories.exiftool_no_local": true,
        "memories.vod.path": "\/home\/thomson\/nginx\/cloud\/apps\/memories\/bin-ext\/go-vod-amd64",
        "memories.vod.ffmpeg": "\/usr\/bin\/ffmpeg",
        "memories.vod.ffprobe": "\/usr\/bin\/ffprobe",
        "memories.gis_type": 1,
        "memories.db.triggers.fcu": true
    }
}

List of activated Apps

Enabled:
  - activity: 3.0.0
  - admin_audit: 1.20.0
  - announcementcenter: 7.1.0
  - app_api: 4.0.5
  - bookmarks: 15.0.5
  - calendar: 5.0.9
  - camerarawpreviews: 0.8.6
  - circles: 30.0.0
  - cloud_federation_api: 1.13.0
  - comments: 1.20.1
  - contacts: 6.1.3
  - contactsinteraction: 1.11.0
  - cookbook: 0.11.2
  - dashboard: 7.10.0
  - dav: 1.31.1
  - dicomviewer: 2.3.0
  - external: 5.5.2
  - federatedfilesharing: 1.20.0
  - federation: 1.20.0
  - files: 2.2.0
  - files_downloadlimit: 3.0.0
  - files_external: 1.22.0
  - files_pdfviewer: 3.0.0
  - files_reminders: 1.3.0
  - files_sharing: 1.22.0
  - files_trashbin: 1.20.1
  - files_versions: 1.23.0
  - firstrunwizard: 3.0.0
  - forms: 4.3.6
  - gpxpod: 7.0.4
  - groupfolders: 18.0.9
  - logreader: 3.0.0
  - lookup_server_connector: 1.18.0
  - mail: 4.1.2
  - maps: 1.5.0
  - memories: 7.4.1
  - nextcloud_announcements: 2.0.0
  - notes: 4.11.0
  - notifications: 3.0.0
  - oauth2: 1.18.1
  - password_policy: 2.0.0
  - phonetrack: 0.8.2
  - photos: 3.0.2
  - polls: 7.2.9
  - previewgenerator: 5.7.0
  - privacy: 2.0.0
  - provisioning_api: 1.20.0
  - recognize: 8.2.0
  - recommendations: 3.0.0
  - related_resources: 1.5.0
  - repod: 3.5.4
  - richdocuments: 8.5.3
  - serverinfo: 2.0.0
  - settings: 1.13.0
  - sharebymail: 1.20.0
  - spreed: 20.1.3
  - support: 2.0.0
  - survey_client: 2.0.0
  - systemtags: 1.20.0
  - tasks: 0.16.1
  - text: 4.1.0
  - theming: 2.5.0
  - twofactor_backupcodes: 1.19.0
  - twofactor_totp: 12.0.0-dev
  - twofactor_webauthn: 2.1.0
  - updatenotification: 1.20.0
  - user_status: 1.10.0
  - viewer: 3.0.0
  - weather_status: 1.10.0
  - webhook_listeners: 1.1.0-dev
  - workflowengine: 2.12.0
Disabled:
  - bruteforcesettings: 3.0.0 (installed 1.0.3)
  - carnet: 0.25.6 (installed 0.25.6)
  - cospend: 3.0.11 (installed 2.0.0)
  - encryption: 2.18.0 (installed 2.8.1)
  - ownpad: 0.12.0 (installed 0.12.0)
  - suspicious_login: 8.0.0
  - twofactor_nextcloud_notification: 4.0.0
  - user_ldap: 1.21.0 (installed 1.3.1)

Nextcloud Signing status

not possible

Nextcloud Logs

none
full nginx log:
#0 /home/***sensitive-information***/nginx/cloud/remote.php(148): handleException()
#1 {main}
  thrown in /home/***sensitive-information***/nginx/cloud/remote.php on line 28" while reading response header from upstream, client: ***sensitive-information***, server: ***sensitive-information***.com, request: "PROPFIND /remote.php/webdav/ HTTP/1.1", upstream: "fastcgi://127.0.0.1:9003", host: "***sensitive-information***.com"
2025/02/04 18:31:07 [error] 75799#75799: *3325 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught Error: Typed static property OC::$server must not be accessed before initialization in /home/***sensitive-information***/nginx/cloud/lib/public/Server.php:39
Stack trace:
#0 /home/***sensitive-information***/nginx/cloud/index.php(83): OCP\Server::get()
#1 {main}
  thrown in /home/***sensitive-information***/nginx/cloud/lib/public/Server.php on line 39" while reading response header from upstream, client: 178.13.234.253, server: ***sensitive-information***.com, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9003", host: "***sensitive-information***.com"

Additional info

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    0. Needs triagePending check for reproducibility or if it fits our roadmap30-feedbackbug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions