Operating system and version (e.g., Ubuntu 24.04):
replace me
Web server and version (e.g, Apache 2.4.25):
replace me
Reverse proxy and version _(e.g. nginx 1.27.2)
replace me
PHP version (e.g, 8.3):
replace me
Is this the first time you’ve seen this error? (Yes / No):
replace me
When did this problem seem to first start?
replace me
Installation method (e.g. AlO, NCP, Bare Metal/Archive, etc.)
replace me
Are you using CloudfIare, mod_security, or similar? (Yes / No)
replace me
Summary of the issue you are facing:
I created this but not sure where to put it.
#!/usr/bin/env php
<?php
/**
* nextcloud_info.php
*
* Gathers:
* - Nextcloud Server version
* - OS + version
* - Web server + version
* - Reverse proxy + version (via “Via” header if available)
* - PHP version
* - Prompts for:
* * First‑time seeing this error?
* * When did it first start?
* * Installation method
* * Using Cloudflare, mod_security, etc.
*
* Usage:
* php nextcloud_info.php
* (or via web—just hit it in your browser)
*/
// 1) Nextcloud version
$ncRoot = __DIR__;
$versionFile = $ncRoot . '/version.php';
$nextcloudVersion = 'unknown';
if (file_exists($versionFile)) {
$v = file_get_contents($versionFile);
if (preg_match("/\\\$OC_VersionString\\s*=\\s*'([^']+)'/", $v, $m)) {
$nextcloudVersion = $m[1];
}
}
// 2) OS/version
$osPretty = PHP_OS_FAMILY + ' ' + PHP_OS;
// 3) Web server
$webServer = $_SERVER['SERVER_SOFTWARE'] ?? php_sapi_name();
// 4) Reverse proxy via headers
$headers = function_exists('getallheaders') ? getallheaders() : [];
$viaHeader = $headers['Via'] ?? $headers['HTTP_VIA'] ?? 'not detected';
// 5) PHP version
$phpVersion = PHP_VERSION;
// Output as Markdown
$md = "## The Basics\n";
$md .= "* Nextcloud Server version _(e.g., 29.x.x)_: \n - `{$nextcloudVersion}`\n";
$md .= "* Operating system and version _(e.g., Ubuntu 24.04)_: \n - `{$osPretty}`\n";
$md .= "* Web server and version _(e.g, Apache 2.4.25)_: \n - `{$webServer}`\n";
$md .= "* Reverse proxy and version _(e.g. nginx 1.27.2)_: \n - `{$viaHeader}`\n";
$md .= "* PHP version _(e.g, 8.3)_: \n - `{$phpVersion}`\n";
$md .= "* Is this the first time you've seen this error? (Yes / No): \n - `yes`\n";
$md .= "* When did this problem seem to first start? \n - `today`\n";
$md .= "* Installation method _(e.g. AIO, NCP, Bare Metal/Archive, etc.)_: \n - `docker hub image`\n";
$md .= "* Are you using Cloudflare, mod_security, or similar? _(Yes / No)_: \n - no`\n";
// Print to screen
header('Content-Type: text/plain; charset=UTF-8');
echo $md;
there is a occ command to get all the config settings:
sudo -u www-data php occ config:list
I cannot find it right know, but I think I have seen an option where an app lets you generate a header for a report with all required information. Some information is available on the serverinfo (that is one of the last items in the admin interface).
However, in case of problems this might not be available. And if you call php from command line, you don’t see the webserver, and if you have different php versions installed, you won’t know which one is running on your webserver.
It might be interesting, but in such a case it would be best to create an app.
what happens if someone does not have docker? Or if they use nginx? And they have perhaps a apache and nginx setup on their system? So this could only work when called from within Nextcloud (through webserver).
this is the command line interface configuration. Very unexperienced users (especially on webhosting) might have different php versions available, and the version used by the web server can be different.
I’m not sure if the NextcloudPi and/or AIO already have some functions to print out environment details.
Yes, it assumes nc is run in a container, with the specified names.
I’m not using NextcloudPi. The nextcloud container (probably) has only the one php version.
My rationale: the easier it is made to collect the required data the more likely it will be complete and up-to-date. I hate to go through all the different location to locate that no doubt relevant information.
In a more general case it would be extremely helpful and fancy if most of this info was readibly available directly from the dash.
If you are using a Debian-based operating system like Ubuntu, you can obtain extensive information — not only about the running PHP instances or installed and running web servers, but much more — with the > janitor < script.
Simply run:
janitor
If it is not yet installed, you can install it with:
Explanation:
- the first line downloads the script into the directory /usr/local/bin
- the second line makes it executable
The information module is designed so that additional modules can be easily added. These range from simple command calls or file content outputs to complex information gathering — for example, the PHP information module temporarily starts a web server for each installed PHP version without disrupting productive web server operations. This allows precise testing for any configuration errors that would otherwise be hard to detect.
Hundreds of hours of development work went into this project.
I would be very happy to receive suggestions and requests for additional information modules!
Please submit them as a “sysinf request” at: