# Question2Answer LDAP admin login error 500

**URL:** https://forum.yunohost.org/t/question2answer-ldap-admin-login-error-500/37823
**Category:** Support apps
**Tags:** question2answer, english
**Created:** [July 22, 2025, 2:49pm UTC](https://forum.yunohost.org/t/question2answer-ldap-admin-login-error-500/37823 "2025-07-22T14:49:37Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![kozmotronik](https://forum.yunohost.org/user_avatar/forum.yunohost.org/kozmotronik/32/10891_2.png) [@kozmotronik](https://forum.yunohost.org/u/kozmotronik)
#### Post date: [July 22, 2025, 2:49pm UTC](https://forum.yunohost.org/t/question2answer-ldap-admin-login-error-500/37823/1 "2025-07-22T14:49:37Z")

</div>

**What type of hardware are you using** : VPS bought online  
**What YunoHost version are you running** : 12.0.17  
**What app is this about** : Question2Answer

### Describe your issue

I’ve just installed the Question2Answer app, so far so good. But when I try to login to the admin interface as set in the setup page, the app returns the error `500`. When I check the nginx log I see an `Call to undefined function ldap_connect()` error thrown.

I checked if there is a reported issue and found one but without response:

> [@Blank screen after admin log-in](https://forum.yunohost.org/t/blank-screen-after-admin-log-in/29703):
>
> Greetings from Germany! My YunoHost server Hardware: VPS bought online YunoHost version: 11.2.11.3 (stable). I have access to my server : Through SSH | through the webadmin | direct access via keyboard / screen | … Are you in a special context or did you perform some particular tweaking on your YunoHost instance ? : no Description of my issue I’ve done a fresh install of Yunohost and configured DNS with lets encrypt. After I’ve installed question2answer (on a subpath) I can open the page …

Could you guys please recommend a remedy for this? Thank you!

### Share relevant logs or error messages

```log
2025/07/22 17:17:23 [error] 559844#559844: *4127 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught Error: Call to undefined function ldap_connect() in /var/www/question2answer/qa-plugin/qa-ldap-login/LDAPServer.php:10
Stack trace:
#0 /var/www/question2answer/qa-plugin/qa-ldap-login/qa-ldap-process.php(36): LDAPServer->connectWithServer()
#1 /var/www/question2answer/qa-plugin/qa-ldap-login/qa-ldap-process.php(58): ldap_process()
#2 /var/www/question2answer/qa-include/pages/login.php(62): require_once('...')
#3 /var/www/question2answer/qa-include/app/page.php(183): require('...')
#4 /var/www/question2answer/qa-include/qa-page.php(47): qa_get_request_content()
#5 /var/www/question2answer/qa-include/qa-index.php(189): require('...')
#6 /var/www/question2answer/index.php(27): require('...')
#7 {main}
  thrown in /var/www/question2answer/qa-plugin/qa-ldap-login/LDAPServer.php on line 10" while reading response header from upstream, client: 212.253.8.111, server: ****************, request: "POST /q2a/index.php/login?to=index.php%2Fadmin HTTP/2.0", upstream: "fastcgi://unix:/var/run/php/php8.0-fpm-question2answer.sock:", host: "****************", referrer: "https:// **************** /q2a/index.php/login?to=index.php%2Fadmin"

```

---

<div class="post-metadata">

### Author: ![kozmotronik](https://forum.yunohost.org/user_avatar/forum.yunohost.org/kozmotronik/32/10891_2.png) [@kozmotronik](https://forum.yunohost.org/u/kozmotronik)
#### Post date: [July 23, 2025, 6:13am UTC](https://forum.yunohost.org/t/question2answer-ldap-admin-login-error-500/37823/2 "2025-07-23T06:13:05Z")

</div>

Here I’ve come with the solution. With the help of ChatGPT (since I am not a web expert), I diagnosed the error message and find out that `php8.0-ldap` package was absent in the system. This absence was causing that LDAP login error message.

So, just install the package and restart the FPM:

```sh
apt update
apt install php8.0-ldap
systemctl restart php8.0-fpm

```

It seems that this installation step should have been added to the installation script by the maintainer.

I wish you knew @hermann-san bro 🥲

## EDIT-1 - One more issue with non-LDAP users and a workaround

Well, there is one more issue after fixing the LDAP login. This time, a new **non-LDAP user** can register successfully, but cannot proceed login because the code in `$ROOT/qa-plugin/qa-ldap-login/qa-ldap-process.php` file does not allow normal login flow because of these lines:

```php
} else {
        if(!qa_opt('ldap_login_allow_normal')) {
          // FIXME somehow print a message
          qa_redirect('login');
          exit();
        }
}

```

Removing that `else` block completely fixes the login flow and allow non-LDAP users to login. But this is a dirty way to solve this problem. A **Yunohost level solution** would be the best to overcome these 2 issues.

### EDIT-2 - Just discovered a cleaner solution for non-LDAP login

After examining some of the qa-ldap-process.php source code, I noticed the following option that causes redirection to the login page: **`ldap_login_allow_normal`**.  
This option determines whether a user without an LDAP account can log in. However, I couldn’t find this option on the admin page. So, while searching for the source of this option, I looked at the `qa-include/app/options.php` file and found that this option is taken from the database. I opened the database with AdminerEvo and started looking at the `qa_options` table. And finally, I found what I was looking for here: the `ldap_login_allow_normal` option was here. Since it did not have a default value, the application’s LDAP plugin did not allow normal login. I changed its value to `1`, saved it, and tried normal login again. This time, without making any changes to the plugin’s source code, I was able to log in as a normal user.

Well I think this solution may be implemented in the Yunohost’s installer script of the package of this application.

Hope this workaround help to others that want to use this app in Yunohost

---

<div class="post-metadata">

### Author: ![hermann-san](https://forum.yunohost.org/user_avatar/forum.yunohost.org/hermann-san/32/2639_2.png) [@hermann-san](https://forum.yunohost.org/u/hermann-san)
#### Post date: [July 23, 2025, 2:34pm UTC](https://forum.yunohost.org/t/question2answer-ldap-admin-login-error-500/37823/3 "2025-07-23T14:34:07Z")

</div>

awesome work 🙂  
Thanks a lot for sharing it.  
Hopefully the Yunohost people see this or maybe a [Github issue](https://github.com/YunoHost-Apps/question2answer_ynh) need to be opened.

---

<div class="post-metadata">

### Author: ![kozmotronik](https://forum.yunohost.org/user_avatar/forum.yunohost.org/kozmotronik/32/10891_2.png) [@kozmotronik](https://forum.yunohost.org/u/kozmotronik)
#### Post date: [July 23, 2025, 5:55pm UTC](https://forum.yunohost.org/t/question2answer-ldap-admin-login-error-500/37823/4 "2025-07-23T17:55:30Z")

</div>

It looks like the repo hasn’t been updated since last year.

I will try to fix the problems I’ve found and create a PR, but I don’t promise anything 🙂.

I will try to contribute to Yunohost for the first time. That’s why I need to read the documentation first.

---

<div class="post-metadata">

### Author: ![system](https://forum.yunohost.org/uploads/default/original/2X/f/f59fe8e3ee6b100b4f574d30d6e30479c68b89f0.png) [@system](https://forum.yunohost.org/u/system)
#### Post date: [August 7, 2025, 5:56pm UTC](https://forum.yunohost.org/t/question2answer-ldap-admin-login-error-500/37823/5 "2025-08-07T17:56:09Z")

</div>

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.
