I'm having Internal Server Error and it looks like my config is broken

Support intro

Sorry to hear you’re facing problems. :slightly_frowning_face:

The community help forum (help.nextcloud.com) is for home and non-enterprise users. Support is provided by other community members on a best effort / “as available” basis. All of those responding are volunteering their time to help you.

If you’re using Nextcloud in a business/critical setting, paid and SLA-based support services can be accessed via portal.nextcloud.com where Nextcloud engineers can help ensure your business keeps running smoothly.

Getting help

In order to help you as efficiently (and quickly!) as possible, please fill in as much of the below requested information as you can.

Before clicking submit: Please check if your query is already addressed via the following resources:

(Utilizing these existing resources is typically faster. It also helps reduce the load on our generous volunteers while elevating the signal to noise ratio of the forums otherwise arising from the same queries being posted repeatedly).

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can. :heart:

The Basics

  • Nextcloud Server version (e.g., 29.x.x):
    • latest
  • Operating system and version (e.g., Ubuntu 24.04):
    • debian 12
  • Web server and version (e.g, Apache 2.4.25):
    • 2.4.62
  • Reverse proxy and version _(e.g. nginx 1.27.2)
    • replace me
  • PHP version (e.g, 8.3):
    • 8.3
  • Is this the first time you’ve seen this error? (Yes / No):
    • yes
  • When did this problem seem to first start?
    • when trying to install and configure all needed things
  • Installation method (e.g. AlO, NCP, Bare Metal/Archive, etc.)
    • replace me
  • Are you using CloudfIare, mod_security, or similar? (Yes / No)
    • i tryed cloudflare with tunnel before i had errors on my config

Summary of the issue you are facing:

Internal Server Error

The server encountered an internal error and was unable to complete your request.
Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.
More details can be found in the webserver log.

Steps to replicate it (hint: details matter!):

Log entries

Nextcloud

Please provide the log entries from your Nextcloud log that are generated during the time of problem (via the Copy raw option from Administration settings->Logging screen or from your nextcloud.log located in your data directory). Feel free to use a pastebin/gist service if necessary.

nothing usefull found there

Web Browser

If the problem is related to the Web interface, open your browser inspector Console and Network tabs while refreshing (reloading) and reproducing the problem. Provide any relevant output/errors here that appear.

Internal Server Error

The server encountered an internal error and was unable to complete your request.
Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.
More details can be found in the webserver log.

Web server / Reverse Proxy

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

PASTE HERE

Configuration

<?php
$CONFIG = array (
  'instanceid' => 'myinstanceid',
  'passwordsalt' => 'mypasssalt',
  'secret' => 'mysecret',
  'trusted_domains' =>
  array (
    0 => '192.168.2.61',
    3 => 'nextcloudpi',
    4 => 'nextcloudpi.local',
  ),
  'datadirectory' => '/var/www/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '30.0.6.2',
  'overwritehost'     => 'nextcloudpi.local',
  'overwriteprotocol' => 'http',
  'overwrite.cli.url' => 'http://nextcloudpi.local',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => 'mypass',
  'installed' => true,
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'maintenance' => false,
  'maintenance_window_start' => 1,
  'default_phone_region' => 'BE',
  'check_data_directory_permissions' => false,
  'loglevel' => 2,
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => '/var/run/redis/redis.sock',
    'port' => 0,
    'timeout' => 0.0,
  ),
  )

Nextcloud

The output of occ config:list system or similar is best, but, if not possible, the contents of your config.php file from /path/to/nextcloud is fine (make sure to remove any identifiable information!):

[Wed Feb 26 22:49:20.408999 2025] [ssl:error] [pid 227:tid 227] AH02217: ssl_stapling_init_cert: can't retrieve issuer certificate! [subject: CN=localhost / issuer: CN=localhost / serial: 1EEDF5ADCF08666CC93AB165D124F65430A49606 / notbefore: Sep 11 07:27:29 2024 GMT / notafter: Sep  9 07:27:29 2034 GMT]
[Wed Feb 26 22:49:20.409008 2025] [ssl:error] [pid 227:tid 227] AH02604: Unable to configure certificate localhost:443:0 for stapling
[Wed Feb 26 22:50:11.172099 2025] [proxy_fcgi:error] [pid 249:tid 292] [remote 192.168.2.3:58865] AH01071: Got error 'PHP message: PHP Parse error:  syntax error, unexpected end of file in /var/www/nextcloud/config/config.php on line 40', referer: https://192.168.2.61/
[Wed Feb 26 22:51:33.151804 2025] [proxy_fcgi:error] [pid 244:tid 253] [remote 192.168.2.3:59083] AH01071: Got error 'PHP message: PHP Parse error:  syntax error, unexpected end of file in /var/www/nextcloud/config/config.php on line 40', referer: https://192.168.2.61/
[Wed Feb 26 22:55:54.577465 2025] [proxy_fcgi:error] [pid 249:tid 299] [remote 192.168.2.3:59826] AH01071: Got error 'PHP message: PHP Parse error:  syntax error, unexpected end of file in /var/www/nextcloud/config/config.php on line 40'
root@nextcloudpi:/var/log/apache2#

Apps

The output of occ app:list (if possible).

root@nextcloudpi:/var/www/nextcloud# ./occ app:list
An unhandled exception has been thrown:
ParseError: syntax error, unexpected end of file in /var/www/nextcloud/config/config.php:40
Stack trace:
#0 /var/www/nextcloud/lib/private/Config.php(40): OC\Config->readData()
#1 /var/www/nextcloud/lib/base.php(89): OC\Config->__construct()
#2 /var/www/nextcloud/lib/base.php(571): OC::initPaths()
#3 /var/www/nextcloud/lib/base.php(1134): OC::init()
#4 /var/www/nextcloud/console.php(28): require_once('...')
#5 /var/www/nextcloud/occ(11): require_once('...')
#6 {main}root@nextcloudpi:/var/www/nextcloud#

I see 192.168.2.61, but I also see a reference to localhost. How are you accessing the service through the browser?

Its an vm .61 is the vm ip and i access normally on http://192.168.2.61 it worked before but suddently not anymore and i dont see whats the problem.

Can you please set the configuration file etc. in tripple backticks so that the content is better readable, like:

```

… config file …

```

It seems that there are at least two errors. First one is related to a self-signed certificate:

The second one is related to a syntax error in your configuration file, which has most likely a higher importance. Due to the fact that you haven’t provided it in its exact fomat I cannot identify line 40 in it:

... Got error 'PHP message: PHP Parse error: syntax error, unexpected end of file in /var/www/nextcloud/config/config.php on line 40'
1 Like

on this code

<?php
$CONFIG = array (
  'instanceid' => 'instanceid',
  'passwordsalt' => 'passwdsalt',
  'secret' => 'secret',
  'trusted_domains' =>
  array (
    0 => '192.168.2.61',
    3 => 'nextcloudpi',
    4 => 'nextcloudpi.local',
  ),
  'datadirectory' => '/var/www/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '30.0.6.2',
  'overwritehost'     => 'nextcloudpi.local',
  'overwriteprotocol' => 'http',
  'overwrite.cli.url' => 'http://nextcloudpi.local',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => 'mypass',
  'installed' => true,
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'maintenance' => false,
  'maintenance_window_start' => 1,
  'default_phone_region' => 'BE',
  'check_data_directory_permissions' => false,
  'loglevel' => 2,
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => '/var/run/redis/redis.sock',
    'port' => 0,
    'timeout' => 0.0,
  ),

then i have this error:
root@nextcloudpi:/var/www/nextcloud# sudo -u www-data /var/www/nextcloud/occ maintenance:repair
An unhandled exception has been thrown:
ParseError: Unclosed ‘(’ on line 2 in /var/www/nextcloud/config/config.php:39
Stack trace:
#0 /var/www/nextcloud/lib/private/Config.php(40): OC\Config->readData()
#1 /var/www/nextcloud/lib/base.php(89): OC\Config->__construct()
#2 /var/www/nextcloud/lib/base.php(571): OC::initPaths()
#3 /var/www/nextcloud/lib/base.php(1134): OC::init()
#4 /var/www/nextcloud/console.php(28): require_once(‘…’)
#5 /var/www/nextcloud/occ(11): require_once(‘…’)
#6 {main}root@nextcloudpi:/var/www/nextcloud#

and if i try this:

<?php
$CONFIG = array (
  'instanceid' => 'instanceid',
  'passwordsalt' => 'passwdsalt',
  'secret' => 'secret',
  'trusted_domains' =>
  array (
    0 => '192.168.2.61',
    3 => 'nextcloudpi',
    4 => 'nextcloudpi.local',
  ),
  'datadirectory' => '/var/www/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '30.0.6.2',
  'overwritehost'     => 'nextcloudpi.local',
  'overwriteprotocol' => 'http',
  'overwrite.cli.url' => 'http://nextcloudpi.local',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => 'mypass',
  'installed' => true,
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'maintenance' => false,
  'maintenance_window_start' => 1,
  'default_phone_region' => 'BE',
  'check_data_directory_permissions' => false,
  'loglevel' => 2,
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => '/var/run/redis/redis.sock',
    'port' => 0,
    'timeout' => 0.0,
  ),
)

i have this error:
root@nextcloudpi:/var/www/nextcloud# sudo -u www-data /var/www/nextcloud/occ maintenance:repair
An unhandled exception has been thrown:
ParseError: syntax error, unexpected end of file in /var/www/nextcloud/config/config.php:40
Stack trace:
#0 /var/www/nextcloud/lib/private/Config.php(40): OC\Config->readData()
#1 /var/www/nextcloud/lib/base.php(89): OC\Config->__construct()
#2 /var/www/nextcloud/lib/base.php(571): OC::initPaths()
#3 /var/www/nextcloud/lib/base.php(1134): OC::init()
#4 /var/www/nextcloud/console.php(28): require_once(‘…’)
#5 /var/www/nextcloud/occ(11): require_once(‘…’)
#6 {main}root@nextcloudpi:/var/www/nextcloud#

when i lynx to the website i have

SSL error:The certificate is NOT trusted. The certificate issuer is unknown. -Continue? (n)
when i continue i have internal server error on both configs

root@nextcloudpi:/var/log/apache2# cat nc-error.log
[Thu Feb 27 00:00:01.066294 2025] [ssl:error] [pid 227:tid 227] AH02217: ssl_stapling_init_cert: can't retrieve issuer certificate! [subject: CN=localhost / issuer: CN=localhost / serial: 1EEDF5ADCF08666CC93AB165D124F65430A49606 / notbefore: Sep 11 07:27:29 2024 GMT / notafter: Sep  9 07:27:29 2034 GMT]
[Thu Feb 27 00:00:01.066364 2025] [ssl:error] [pid 227:tid 227] AH02604: Unable to configure certificate localhost:443:0 for stapling
[Thu Feb 27 05:47:19.161438 2025] [proxy_fcgi:error] [pid 7375:tid 7405] [remote 192.168.2.245:33682] AH01071: Got error 'PHP message: PHP Parse error:  syntax error, unexpected end of file in /var/www/nextcloud/config/config.php on line 40'
[Thu Feb 27 05:47:19.273297 2025] [proxy_fcgi:error] [pid 7375:tid 7400] [remote 192.168.2.245:33682] AH01071: Got error 'PHP message: PHP Parse error:  syntax error, unexpected end of file in /var/www/nextcloud/config/config.php on line 40'
[Thu Feb 27 16:19:11.641197 2025] [proxy_fcgi:error] [pid 7376:tid 7443] [client 192.168.2.61:35730] AH01071: Got error 'PHP message: PHP Parse error:  Unclosed '(' on line 2 in /var/www/nextcloud/config/config.php on line 39'
[Thu Feb 27 16:27:47.720696 2025] [proxy_fcgi:error] [pid 7376:tid 7467] [client 192.168.2.61:51494] AH01071: Got error 'PHP message: PHP Parse error:  syntax error, unexpected end of file in /var/www/nextcloud/config/config.php on line 40'
root@nextcloudpi:/var/log/apache2#

maybe its good now to read

At a minimum, you’re missing a semi-colon. See Configuration for some examples.

1 Like

i totally reinstalled it and first did the cloudflare tunnel and it all worked out

1 Like

I think the error could be found in the last line of your configuration: