After replacing PHP: Undefined constant "CURL_HTTP_VERSION_2TLS"

I have been affected by issue nextcloud/server#58528.

For recent versions of the server, requests to the app store are broken if PHP has not been built with HTTP/2 support in cURL. The user is not directly informed of any problem, but is incorrectly informed that no updates are available for any installed applications.

I am using a distribution of PHP that lacks support for the required feature. However, the vendor has offered a solution for adding support, by building PHP locally at the site of deployment.

Regrettably, the results so far have been a functional regression, rather than an improvement. Any access to the “Apps” section immediately produces an “Internal Server Error”, as do some, but not all, attempts to access the basic administrative settings.

When the settings are accessed successfully, the following is reported among the diagnostics:

An exception occurred while running the setup check: Error: Undefined constant "CURL_HTTP_VERSION_2TLS" in /mnt/aux/www/wwwroot/nextcloud/lib/private/Http/Client/Client.php:62 Stack trace: #0 /mnt/aux/www/wwwroot/nextcloud/lib/private/Http/Client/Client.php(250): OC\Http\Client\Client->buildRequestOptions() #1 /mnt/aux/www/wwwroot/nextcloud/apps/settings/lib/SetupChecks/InternetConnectivity.php(70): OC\Http\Client\Client->head() #2 /mnt/aux/www/wwwroot/nextcloud/apps/settings/lib/SetupChecks/InternetConnectivity.php(48): OCA\Settings\SetupChecks\InternetConnectivity->isSiteReachable() #3 /mnt/aux/www/wwwroot/nextcloud/lib/private/SetupCheck/SetupCheckManager.php(34): OCA\Settings\SetupChecks\InternetConnectivity->run() #4 /mnt/aux/www/wwwroot/nextcloud/apps/settings/lib/Controller/CheckSetupController.php(132): OC\SetupCheck\SetupCheckManager->runAll() #5 /mnt/aux/www/wwwroot/nextcloud/lib/private/AppFramework/Http/Dispatcher.php(205): OCA\Settings\Controller\CheckSetupController->check() #6 /mnt/aux/www/wwwroot/nextcloud/lib/private/AppFramework/Http/Dispatcher.php(118): OC\AppFramework\Http\Dispatcher->executeController() #7 /mnt/aux/www/wwwroot/nextcloud/lib/private/AppFramework/App.php(153): OC\AppFramework\Http\Dispatcher->dispatch() #8 /mnt/aux/www/wwwroot/nextcloud/lib/private/Route/Router.php(321): OC\AppFramework\App::main() #9 /mnt/aux/www/wwwroot/nextcloud/lib/base.php(1155): OC\Route\Router->match() #10 /mnt/aux/www/wwwroot/nextcloud/index.php(25): OC::handleRequest() #11 {main}

Additionally, log entries are generated like the example shown below.

I am seeking assistance to understand the meaning and resolution for the new problem in invoking cURL.


{
  "reqId": "kHezNk6qY25tBkYIDvDZ",
  "level": 3,
  "time": "2026-10-17T23:19:37+00:00",
  "remoteAddr": "x.x.x.x",
  "user": "xxx",
  "app": "index",
  "method": "GET",
  "url": "/settings/apps",
  "scriptName": "/index.php",
  "message": "Undefined constant \"CURL_HTTP_VERSION_2TLS\" in file '/mnt/aux/www/wwwroot/nextcloud/lib/private/Http/Client/Client.php' line 62",
  "userAgent": "Mozilla/5.0 (X11; Linux x86_64; rv:158.0) Gecko/20100101 Firefox/158.0",
  "version": "33.0.9.1",
  "exception": {
    "Exception": "Exception",
    "Message": "Undefined constant \"CURL_HTTP_VERSION_2TLS\" in file '/mnt/aux/www/wwwroot/nextcloud/lib/private/Http/Client/Client.php' line 62",
    "Code": 0,
    "Trace": [
      {
        "file": "/mnt/aux/www/wwwroot/nextcloud/lib/private/AppFramework/App.php",
        "line": 153,
        "function": "dispatch",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->"
      },
      {
        "file": "/mnt/aux/www/wwwroot/nextcloud/lib/private/Route/Router.php",
        "line": 321,
        "function": "main",
        "class": "OC\\AppFramework\\App",
        "type": "::"
      },
      {
        "file": "/mnt/aux/www/wwwroot/nextcloud/lib/base.php",
        "line": 1155,
        "function": "match",
        "class": "OC\\Route\\Router",
        "type": "->"
      },
      {
        "file": "/mnt/aux/www/wwwroot/nextcloud/index.php",
        "line": 25,
        "function": "handleRequest",
        "class": "OC",
        "type": "::"
      }
    ],
    "File": "/mnt/aux/www/wwwroot/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
    "Line": 150,
    "Previous": {
      "Exception": "Error",
      "Message": "Undefined constant \"CURL_HTTP_VERSION_2TLS\"",
      "Code": 0,
      "Trace": [
        {
          "file": "/mnt/aux/www/wwwroot/nextcloud/lib/private/Http/Client/Client.php",
          "line": 219,
          "function": "buildRequestOptions",
          "class": "OC\\Http\\Client\\Client",
          "type": "->"
        },
        {
          "file": "/mnt/aux/www/wwwroot/nextcloud/lib/private/App/AppStore/Fetcher/Fetcher.php",
          "line": 93,
          "function": "get",
          "class": "OC\\Http\\Client\\Client",
          "type": "->",
          "args": [
            "*** sensitive parameters replaced ***"
          ]
        },
        {
          "file": "/mnt/aux/www/wwwroot/nextcloud/lib/private/App/AppStore/Fetcher/AppFetcher.php",
          "line": 56,
          "function": "fetch",
          "class": "OC\\App\\AppStore\\Fetcher\\Fetcher",
          "type": "->"
        },
        {
          "file": "/mnt/aux/www/wwwroot/nextcloud/lib/private/App/AppStore/Fetcher/Fetcher.php",
          "line": 180,
          "function": "fetch",
          "class": "OC\\App\\AppStore\\Fetcher\\AppFetcher",
          "type": "->"
        },
        {
          "file": "/mnt/aux/www/wwwroot/nextcloud/lib/private/App/AppStore/Fetcher/AppFetcher.php",
          "line": 157,
          "function": "get",
          "class": "OC\\App\\AppStore\\Fetcher\\Fetcher",
          "type": "->"
        },
        {
          "file": "/mnt/aux/www/wwwroot/nextcloud/lib/private/Installer.php",
          "line": 379,
          "function": "get",
          "class": "OC\\App\\AppStore\\Fetcher\\AppFetcher",
          "type": "->"
        },
        {
          "file": "/mnt/aux/www/wwwroot/nextcloud/apps/settings/lib/Controller/AppSettingsController.php",
          "line": 260,
          "function": "isUpdateAvailable",
          "class": "OC\\Installer",
          "type": "->"
        },
        {
          "file": "/mnt/aux/www/wwwroot/nextcloud/apps/settings/lib/Controller/AppSettingsController.php",
          "line": 96,
          "function": "getAppsWithUpdates",
          "class": "OCA\\Settings\\Controller\\AppSettingsController",
          "type": "->"
        },
        {
          "file": "/mnt/aux/www/wwwroot/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
          "line": 205,
          "function": "viewApps",
          "class": "OCA\\Settings\\Controller\\AppSettingsController",
          "type": "->"
        },
        {
          "file": "/mnt/aux/www/wwwroot/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
          "line": 118,
          "function": "executeController",
          "class": "OC\\AppFramework\\Http\\Dispatcher",
          "type": "->"
        },
        {
          "file": "/mnt/aux/www/wwwroot/nextcloud/lib/private/AppFramework/App.php",
          "line": 153,
          "function": "dispatch",
          "class": "OC\\AppFramework\\Http\\Dispatcher",
          "type": "->"
        },
        {
          "file": "/mnt/aux/www/wwwroot/nextcloud/lib/private/Route/Router.php",
          "line": 321,
          "function": "main",
          "class": "OC\\AppFramework\\App",
          "type": "::"
        },
        {
          "file": "/mnt/aux/www/wwwroot/nextcloud/lib/base.php",
          "line": 1155,
          "function": "match",
          "class": "OC\\Route\\Router",
          "type": "->"
        },
        {
          "file": "/mnt/aux/www/wwwroot/nextcloud/index.php",
          "line": 25,
          "function": "handleRequest",
          "class": "OC",
          "type": "::"
        }
      ],
      "File": "/mnt/aux/www/wwwroot/nextcloud/lib/private/Http/Client/Client.php",
      "Line": 62
    },
    "message": "Undefined constant \"CURL_HTTP_VERSION_2TLS\" in file '/mnt/aux/www/wwwroot/nextcloud/lib/private/Http/Client/Client.php' line 62",
    "exception": "{\"class\":\"Exception\",\"message\":\"Undefined constant \\\"CURL_HTTP_VERSION_2TLS\\\" in file '/mnt/aux/www/wwwroot/nextcloud/lib/private/Http/Client/Client.php' line 62\",\"code\":0,\"file\":\"/mnt/aux/www/wwwroot/nextcloud/lib/private/AppFramework/Http/Dispatcher.php:150\",\"trace\":\"#0 /mnt/aux/www/wwwroot/nextcloud/lib/private/AppFramework/App.php(153): OC\\AppFramework\\Http\\Dispatcher->dispatch()\\n#1 /mnt/aux/www/wwwroot/nextcloud/lib/private/Route/Router.php(321): OC\\AppFramework\\App::main()\\n#2 /mnt/aux/www/wwwroot/nextcloud/lib/base.php(1155): OC\\Route\\Router->match()\\n#3 /mnt/aux/www/wwwroot/nextcloud/index.php(25): OC::handleRequest()\\n#4 {main}\",\"previous\":{\"class\":\"Error\",\"message\":\"Undefined constant \\\"CURL_HTTP_VERSION_2TLS\\\"\",\"code\":0,\"file\":\"/mnt/aux/www/wwwroot/nextcloud/lib/private/Http/Client/Client.php:62\",\"trace\":\"#0 /mnt/aux/www/wwwroot/nextcloud/lib/private/Http/Client/Client.php(219): OC\\Http\\Client\\Client->buildRequestOptions()\\n#1 /mnt/aux/www/wwwroot/nextcloud/lib/private/App/AppStore/Fetcher/Fetcher.php(93): OC\\Http\\Client\\Client->get()\\n#2 /mnt/aux/www/wwwroot/nextcloud/lib/private/App/AppStore/Fetcher/AppFetcher.php(56): OC\\App\\AppStore\\Fetcher\\Fetcher->fetch()\\n#3 /mnt/aux/www/wwwroot/nextcloud/lib/private/App/AppStore/Fetcher/Fetcher.php(180): OC\\App\\AppStore\\Fetcher\\AppFetcher->fetch()\\n#4 /mnt/aux/www/wwwroot/nextcloud/lib/private/App/AppStore/Fetcher/AppFetcher.php(157): OC\\App\\AppStore\\Fetcher\\Fetcher->get()\\n#5 /mnt/aux/www/wwwroot/nextcloud/lib/private/Installer.php(379): OC\\App\\AppStore\\Fetcher\\AppFetcher->get()\\n#6 /mnt/aux/www/wwwroot/nextcloud/apps/settings/lib/Controller/AppSettingsController.php(260): OC\\Installer->isUpdateAvailable()\\n#7 /mnt/aux/www/wwwroot/nextcloud/apps/settings/lib/Controller/AppSettingsController.php(96): OCA\\Settings\\Controller\\AppSettingsController->getAppsWithUpdates()\\n#8 /mnt/aux/www/wwwroot/nextcloud/lib/private/AppFramework/Http/Dispatcher.php(205): OCA\\Settings\\Controller\\AppSettingsController->viewApps()\\n#9 /mnt/aux/www/wwwroot/nextcloud/lib/private/AppFramework/Http/Dispatcher.php(118): OC\\AppFramework\\Http\\Dispatcher->executeController()\\n#10 /mnt/aux/www/wwwroot/nextcloud/lib/private/AppFramework/App.php(153): OC\\AppFramework\\Http\\Dispatcher->dispatch()\\n#11 /mnt/aux/www/wwwroot/nextcloud/lib/private/Route/Router.php(321): OC\\AppFramework\\App::main()\\n#12 /mnt/aux/www/wwwroot/nextcloud/lib/base.php(1155): OC\\Route\\Router->match()\\n#13 /mnt/aux/www/wwwroot/nextcloud/index.php(25): OC::handleRequest()\\n#14 {main}\"}}",
    "CustomMessage": "Undefined constant \"CURL_HTTP_VERSION_2TLS\" in file '/mnt/aux/www/wwwroot/nextcloud/lib/private/Http/Client/Client.php' line 62"
  }
}

That constant comes from PHP’s curl extension: per the PHP manual’s curl constants page, CURL_HTTP_VERSION_2TLS only exists when the extension is built against cURL 7.47.0 or newer. So your local build is either linked against an older libcurl, or it loads a different libcurl at runtime than it did at build time. You can see which one is actually loaded with php -r ‘var_dump(curl_version());’ - the PHP manual’s curl_version page documents the returned fields - and compare that with the version you built against. Rebuilding against libcurl 7.47+ (or fixing the runtime library path) should define the constant; the runtime-mismatch part is only my hypothesis, but the 7.47 requirement is documented.

[Partly written with AI assistance.]

That error usually means the PHP process serving Nextcloud still doesn’t see the HTTP/2 constant, i.e. the cURL extension it loads wasn’t built against a libcurl with HTTP/2 (nghttp2) support. A common gotcha is that the command line PHP and the PHP used by your web server (php-fpm or Apache module) are different builds, so a check from the shell can look fine while the web side is still the old one. Try `php -i | grep -i -A12 ‘^curl’` and look for ‘HTTP2 => Yes’, then compare that against the same section in a phpinfo() page served through the web server. Also check that `curl --version` lists HTTP2 among its features, since the extension inherits that from the libcurl it was compiled against. If the web server is still on the old build, restart php-fpm/Apache after the rebuild and point it at the new binary or module.