manual ldap sync failed (!!! error/generalexceptionmessage !!!)

manual ldap sync failed (!!! error/generalexceptionmessage !!!)

by Wan Hafiz -
Number of replies: 13

Hi all, 


I inherited a moodle server, and learning my way to use it since few months ago. Aside from LDAP schedule task not working, it was solid otherwise without any issue, until recently when I try to manual sync as usual, I got the error below:

root@moodle:/# php /var/www/html/moodle/auth/ldap/cli/sync_users.php

!!! error/generalexceptionmessage !!!

Is there anyway to debug this, or find more detailed error on what could be causing the error out of nowehere. Nobody touched the settings of this site, nor any update/upgrade/patching going on. 


Average of ratings: -
In reply to Wan Hafiz

Re: manual ldap sync failed (!!! error/generalexceptionmessage !!!)

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers
Turn developer level debugging on and then try to run it again and see what further messages you get.
In reply to Emma Richardson

Re: manual ldap sync failed (!!! error/generalexceptionmessage !!!)

by Wan Hafiz -

Hi Emma,


Thanks for replying. I never done debuggin on moodle before. Any chance you can guide me how to start it up and where can i see the debug output?

In reply to Wan Hafiz

Re: manual ldap sync failed (!!! error/generalexceptionmessage !!!)

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers
Right in the admin settings - server/debugging and set it to show in the browser ...
In reply to Emma Richardson

Re: manual ldap sync failed (!!! error/generalexceptionmessage !!!)

by Wan Hafiz -
Actually tried that before, and tried it again just now. Nothing shows up on the browser, and I am just looking at the settings of the page after running the manual sync command line in my putty:



Is there anyway to make it appear on the browser, or redirect the output of the debug to certain file that is readable?
In reply to Wan Hafiz

Re: manual ldap sync failed (!!! error/generalexceptionmessage !!!)

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers
If you have debugging turned on, try running it from the command line and that should give you full error...
In reply to Emma Richardson

Re: manual ldap sync failed (!!! error/generalexceptionmessage !!!)

by Wan Hafiz -
HI Emma,

As per my screenshot above, even after turning the debugging on the Site Administration->Development->Debugging in the site, when I headed to command line and run the command, it still giving me the simplified error "error/generalexceptionmessage". Tried to turn off the Display debug message option, but still no dice.

Let me know if I did anything wrong here. Or if there is any other way to manual sync my AD to the userbase in Moodle (command line, third party plugin, etc.).
In reply to Wan Hafiz

Re: manual ldap sync failed (!!! error/generalexceptionmessage !!!)

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers
Is ldap login still working? What have you done to the site/server recently? Have you checked permissions on the moodle folders?
In reply to Emma Richardson

Re: manual ldap sync failed (!!! error/generalexceptionmessage !!!)

by Wan Hafiz -
Correct, current user that already synced from LDAP are able to login as usual, I just couldn't sync to add new user from our AD at the moment.

Nothing changes on the site, it just stop working out of nowhere. Which folder permission specifically should I check?
In reply to Wan Hafiz

Re: manual ldap sync failed (!!! error/generalexceptionmessage !!!)

by Leon Stringer -
Picture of Core developers Picture of Particularly helpful Moodlers

Which version of Moodle is this? And what version of PHP is shown in PHP info? And what is shown when you run php -v?

In reply to Leon Stringer

Re: manual ldap sync failed (!!! error/generalexceptionmessage !!!)

by Wan Hafiz -
Moodle version: 3.18+ (Build 20200228)

PHP version (from phpinfo):PHP Version 7.2.34-28+ubuntu18.04.1+deb.sury.org+1

php -v output:
PHP 8.0.13 (cli) (built: Nov 22 2021 09:50:24) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.13, Copyright (c) Zend Technologies
with Zend OPcache v8.0.13, Copyright (c), by Zend Technologies

yeah looking kinda weird that both php version doesn't match. Anything I should do to match these up if they are the source of the problem?
In reply to Wan Hafiz

Re: manual ldap sync failed (!!! error/generalexceptionmessage !!!)

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers
When you say phpinfo - is that from your moodle site admin settings? And this is your server right? Not hosted? Did you maybe run updates on the server?
In reply to Emma Richardson

Re: manual ldap sync failed (!!! error/generalexceptionmessage !!!)

by Wan Hafiz -
Correct, that is from my moodle site admin settings. Yes, this is on our local server. I didn't update the moodle itself, although I might've update the OS (Ubuntu) somewhere in the past.
In reply to Wan Hafiz

Re: manual ldap sync failed (!!! error/generalexceptionmessage !!!)

by Wan Hafiz -
So talking about php, I figured its version mismatched is the cultprit and decide to roll back my Ubuntu php version from 8.0 to 7.2. by running below:

a2dismod php8.0
a2enmod php7.2
sudo service apache2 restart

update-alternatives --set php /usr/bin/php7.2

after that, php -v shows im back at 7.2, and running the command " php /var/www/html/moodle/auth/ldap/cli/sync_users.php" now works.

Still need to figure out why scheduled task of ldap syncing is not running, but I open another thread for that one. Thanks everyone!