Internal server error when login

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

Or for longer, use three backticks above and below the code snippet:

longer
example
here

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:

Nextcloud version (eg, 28.0.8): replace me
Operating system and version (eg, Ubuntu 22.04.4): replace me

Server version: Apache/2.4.52 (Ubuntu)
Server built: 2024-07-17T18:57:26

PHP 8.3.9 (cli) (built: Jul 5 2024 12:03:46) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.3.9, Copyright (c) Zend Technologies
with Zend OPcache v8.3.9, Copyright (c), by Zend Technologies

The issue you are facing:
Get an internal server error when login with a remode address, which is the IP of my gateway

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

Steps to replicate it:

The output of your Nextcloud log in Admin > Logging:

{"reqId":"JUbTfBQWKO0K9Rq3mmLJ","level":3,"time":"2024-07-25T15:50:54+00:00","remoteAddr":"192.168.113.240","user":"--","app":"index","method":"POST","url":"/index.php/login","message":"Call to undefined function OCA\\User_LDAP\\ldap_escape() in file '/var/www/html/nextcloud/apps/user_ldap/lib/Access.php' line 1428","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36","version":"28.0.8.1","exception":{"Exception":"Exception","Message":"Call to undefined function OCA\\User_LDAP\\ldap_escape() in file '/var/www/html/nextcloud/apps/user_ldap/lib/Access.php' line 1428","Code":0,"Trace":[{"file":"/var/www/html/nextcloud/lib/private/AppFramework/App.php","line":184,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/Route/Router.php","line":315,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/var/www/html/nextcloud/lib/base.php","line":1069,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/var/www/html/nextcloud/index.php","line":39,"function":"handleRequest","class":"OC","type":"::"}],"File":"/var/www/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","Line":169,"Previous":{"Exception":"Error","Message":"Call to undefined function OCA\\User_LDAP\\ldap_escape()","Code":0,"Trace":[{"file":"/var/www/html/nextcloud/apps/user_ldap/lib/Access.php","line":849,"function":"escapeFilterPart","class":"OCA\\User_LDAP\\Access","type":"->"},{"file":"/var/www/html/nextcloud/apps/user_ldap/lib/User_LDAP.php","line":162,"function":"fetchUsersByLoginName","class":"OCA\\User_LDAP\\Access","type":"->"},{"file":"/var/www/html/nextcloud/apps/user_ldap/lib/User_LDAP.php","line":125,"function":"getLDAPUserByLoginName","class":"OCA\\User_LDAP\\User_LDAP","type":"->"},{"function":"loginName2UserName","class":"OCA\\User_LDAP\\User_LDAP","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/nextcloud/apps/user_ldap/lib/User_Proxy.php","line":126,"function":"call_user_func_array"},{"file":"/var/www/html/nextcloud/apps/user_ldap/lib/Proxy.php","line":140,"function":"walkBackends","class":"OCA\\User_LDAP\\User_Proxy","type":"->"},{"file":"/var/www/html/nextcloud/apps/user_ldap/lib/User_Proxy.php","line":286,"function":"handleRequest","class":"OCA\\User_LDAP\\Proxy","type":"->"},{"file":"/var/www/html/nextcloud/apps/user_ldap/lib/Helper.php","line":297,"function":"loginName2UserName","class":"OCA\\User_LDAP\\User_Proxy","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/nextcloud/lib/private/legacy/OC_Hook.php","line":105,"function":"loginName2UserName","class":"OCA\\User_LDAP\\Helper","type":"::","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/nextcloud/lib/public/Util.php","line":416,"function":"emit","class":"OC_Hook","type":"::"},{"file":"/var/www/html/nextcloud/apps/password_policy/lib/ComplianceService.php","line":92,"function":"emitHook","class":"OCP\\Util","type":"::"},{"file":"/var/www/html/nextcloud/apps/password_policy/lib/Listener/BeforeUserLoggedInEventListener.php","line":45,"function":"entryControl","class":"OCA\\Password_Policy\\ComplianceService","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/EventDispatcher/ServiceEventListener.php","line":86,"function":"handle","class":"OCA\\Password_Policy\\Listener\\BeforeUserLoggedInEventListener","type":"->"},{"file":"/var/www/html/nextcloud/3rdparty/symfony/event-dispatcher/EventDispatcher.php","line":230,"function":"__invoke","class":"OC\\EventDispatcher\\ServiceEventListener","type":"->"},{"file":"/var/www/html/nextcloud/3rdparty/symfony/event-dispatcher/EventDispatcher.php","line":59,"function":"callListeners","class":"Symfony\\Component\\EventDispatcher\\EventDispatcher","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/EventDispatcher/EventDispatcher.php","line":94,"function":"dispatch","class":"Symfony\\Component\\EventDispatcher\\EventDispatcher","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/EventDispatcher/EventDispatcher.php","line":106,"function":"dispatch","class":"OC\\EventDispatcher\\EventDispatcher","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/Server.php","line":576,"function":"dispatchTyped","class":"OC\\EventDispatcher\\EventDispatcher","type":"->"},{"function":"OC\\{closure}","class":"OC\\Server","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/nextcloud/lib/private/Hooks/EmitterTrait.php","line":105,"function":"call_user_func_array"},{"file":"/var/www/html/nextcloud/lib/private/Hooks/PublicEmitter.php","line":40,"function":"emit","class":"OC\\Hooks\\BasicEmitter","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/Authentication/Login/PreLoginHookCommand.php","line":42,"function":"emit","class":"OC\\Hooks\\PublicEmitter","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/Authentication/Login/Chain.php","line":107,"function":"process","class":"OC\\Authentication\\Login\\PreLoginHookCommand","type":"->"},{"file":"/var/www/html/nextcloud/core/Controller/LoginController.php","line":353,"function":"process","class":"OC\\Authentication\\Login\\Chain","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":230,"function":"tryLogin","class":"OC\\Core\\Controller\\LoginController","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":137,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/AppFramework/App.php","line":184,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/Route/Router.php","line":315,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/var/www/html/nextcloud/lib/base.php","line":1069,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/var/www/html/nextcloud/index.php","line":39,"function":"handleRequest","class":"OC","type":"::"}],"File":"/var/www/html/nextcloud/apps/user_ldap/lib/Access.php","Line":1428},"message":"Call to undefined function OCA\\User_LDAP\\ldap_escape() in file '/var/www/html/nextcloud/apps/user_ldap/lib/Access.php' line 1428","exception":{},"CustomMessage":"Call to undefined function OCA\\User_LDAP\\ldap_escape() in file '/var/www/html/nextcloud/apps/user_ldap/lib/Access.php' line 1428"}}

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

<?php
$CONFIG = array (
  'instanceid' => 'ocmjd9gr8oq1',
  'passwordsalt' => '***REDACTED***',
  'secret' => '***REDACTED***',
  'trusted_domains' => 
  array (
    0 => 'cloud.logicworks.com.pt',
  ),
  'trusted_proxies' => 
  array (
    0 => '192.168.113.240',
  ),
  'datadirectory' => '/var/www/html/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '28.0.8.1',
  'overwrite.cli.url' => 'http://cloud.logicworks.com.pt/nextcloud',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextclouduser',
  'dbpassword' => '***REDACTED***',
  'installed' => true,
  'ldapProviderFactory' => 'OCA\\User_LDAP\\LDAPProviderFactory',
  'maintenance' => false,
  'theme' => '',
  'loglevel' => 2,
  'force_language' => 'pt',

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

192.168.113.240 - - [25/Jul/2024:16:40:58 +0100] "GET /index.php/login HTTP/1.1" 200 10854
192.168.113.240 - - [25/Jul/2024:16:40:58 +0100] "GET /core/css/server.css?v=33e2cd7e-14 HTTP/1.1" 200 18499
192.168.113.240 - - [25/Jul/2024:16:40:58 +0100] "GET /apps/theming/css/default.css?v=70e2b24f-14 HTTP/1.1" 200 4885
192.168.113.240 - - [25/Jul/2024:16:40:58 +0100] "GET /core/css/guest.css?v=33e2cd7e-14 HTTP/1.1" 200 4924
192.168.113.240 - - [25/Jul/2024:16:40:58 +0100] "GET /apps/integration_zimbra/css/zimbra-search.css?v=20dfa789-14 HTTP/1.1" 200 841
192.168.113.240 - - [25/Jul/2024:16:40:58 +0100] "GET /core/l10n/pt_PT.js?v=33e2cd7e-14 HTTP/1.1" 200 11890
192.168.113.240 - - [25/Jul/2024:16:40:58 +0100] "GET /dist/core-login.js?v=33e2cd7e-14 HTTP/1.1" 200 42083
192.168.113.240 - - [25/Jul/2024:16:40:58 +0100] "GET /apps/theming/l10n/pt_PT.js?v=33e2cd7e-14 HTTP/1.1" 200 2962
192.168.113.240 - - [25/Jul/2024:16:40:58 +0100] "GET /apps/theming/js/theming.js?v=33e2cd7e-14 HTTP/1.1" 200 370
192.168.113.240 - - [25/Jul/2024:16:40:58 +0100] "GET /index.php/apps/theming/image/logo?v=14 HTTP/1.1" 304 1357
192.168.113.240 - - [25/Jul/2024:16:40:58 +0100] "GET /dist/core-main.js?v=33e2cd7e-14 HTTP/1.1" 200 276148
192.168.113.240 - - [25/Jul/2024:16:40:58 +0100] "GET /index.php/apps/theming/image/background?v=14 HTTP/1.1" 304 1687
192.168.113.240 - - [25/Jul/2024:16:40:58 +0100] "GET /dist/core-common.js?v=33e2cd7e-14 HTTP/1.1" 200 956153
192.168.113.240 - - [25/Jul/2024:16:40:59 +0100] "GET /index.php/apps/theming/manifest?v=fa35e192 HTTP/1.1" 200 1067
::1 - - [25/Jul/2024:16:41:04 +0100] "OPTIONS * HTTP/1.0" 200 126
::1 - - [25/Jul/2024:16:41:05 +0100] "OPTIONS * HTTP/1.0" 200 126
192.168.113.240 - - [25/Jul/2024:16:41:13 +0100] "POST /index.php/login HTTP/1.1" 500 3739
192.168.113.240 - - [25/Jul/2024:16:41:13 +0100] "GET /core/css/styles.css?v=33e2cd7e-14 HTTP/1.1" 200 4132
192.168.113.240 - - [25/Jul/2024:16:41:13 +0100] "GET /core/css/header.css?v=33e2cd7e-14 HTTP/1.1" 200 1776
192.168.113.240 - - [25/Jul/2024:16:41:17 +0100] "POST /index.php/login HTTP/1.1" 500 3416
192.168.113.240 - - [25/Jul/2024:16:41:33 +0100] "-" 408 323
192.168.113.240 - - [25/Jul/2024:16:41:52 +0100] "POST /index.php/login HTTP/1.1" 500 3739
192.168.113.240 - - [25/Jul/2024:16:41:58 +0100] "GET / HTTP/1.1" 302 1160
192.168.113.240 - - [25/Jul/2024:16:41:58 +0100] "GET /index.php/login HTTP/1.1" 200 7371
192.168.113.240 - - [25/Jul/2024:16:44:06 +0100] "POST /index.php/login HTTP/1.1" 500 3739
192.168.113.240 - - [25/Jul/2024:16:44:26 +0100] "-" 408 323
192.168.113.240 - - [25/Jul/2024:16:45:00 +0100] "GET /index.php/login HTTP/1.1" 200 7698
192.168.113.240 - - [25/Jul/2024:16:45:19 +0100] "POST /index.php/login HTTP/1.1" 500 3739
192.168.113.240 - - [25/Jul/2024:16:45:39 +0100] "-" 408 323
192.168.113.240 - - [25/Jul/2024:16:50:32 +0100] "GET / HTTP/1.1" 302 4130
192.168.113.240 - - [25/Jul/2024:16:50:32 +0100] "GET /index.php/login HTTP/1.1" 200 7374
192.168.113.240 - - [25/Jul/2024:16:50:33 +0100] "GET /apps/integration_zimbra/css/zimbra-search.css?v=20dfa789-14 HTTP/1.1" 200 517
192.168.113.240 - - [25/Jul/2024:16:50:54 +0100] "POST /index.php/login HTTP/1.1" 500 3739
192.168.113.240 - - [25/Jul/2024:16:51:14 +0100] "-" 408 323
192.168.113.240 - - [25/Jul/2024:16:51:29 +0100] "GET /index.php/csrftoken HTTP/1.1" 200 436

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.

PASTE HERE

ldap_escape is a PHP function.

Are you sure you’ve installed the ldap extension in PHP?

https://docs.nextcloud.com/server/latest/admin_manual/installation/php_configuration.html

Another possibility would be it being on your PHP’s disabled functions list.

Hi,

The ldap extension is installed:

php -m | grep -i ldap

ldap

Have no disabled functions:

grep disable_functions /etc/php/8.3/apache2/php.ini

disable_functions =

grep disable_functions /etc/php/8.1/apache2/php.ini

disable_functions =

Any idea?

Thanks
José