+ Post New Thread
Results 1 to 6 of 6
Virtual Learning Platforms Thread, Moodle 2.1 LDAP Sync Users in Technical; Hi, I am currently running Moodle 2.1 and have successfully established LDAP authentication so users registered in my Active Directory ...
  1. #1

    Join Date
    Jul 2011
    Location
    York
    Posts
    3
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Moodle 2.1 LDAP Sync Users

    Hi,

    I am currently running Moodle 2.1 and have successfully established LDAP authentication so users registered in my Active Directory can log on without needing to register.

    I now would like to sync the 300+ users from AD to Moodle.

    I have read alot about the 'sync_users.php' in C:\inetpub\wwwroot\Moodle\auth\ldap\cli but I cannot seem to run the file (done through a web browser using the Moodle pathway eg moodle2/moodle etc). I am given a blank white screen. When I decided to edit it I added in the config.php location and finally got "Command line scripts can not be executed from the web interface".

    Other forums suggest this should be run through Cron, which I have established as a Scheduled task every 5mins, I do not know how to add the sync_users.php to the Cron jobs however.

    Please can somebody help.
    Thank You

  2. #2
    robk's Avatar
    Join Date
    Nov 2005
    Location
    Ashbourne
    Posts
    679
    Thank Post
    171
    Thanked 128 Times in 107 Posts
    Blog Entries
    1
    Rep Power
    47
    You need to add a scheduled job to run the cli version of php. Assuming a windows server from the paths you gave you need to find where php.exe is, and schedule it to run with a command line argument of the full path to the sync_users.php file.

  3. #3

    Join Date
    Jul 2011
    Location
    York
    Posts
    3
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    Hi,

    thank you for your response. Yes I am using Windows Server.

    I believe the php is here: C:\Program Files (x86)\PHP\v5.3\php.exe
    The sync-users is here: C:\inetpub\wwwroot\Moodle\auth\ldap\cli\sync_users .php

    Would you be able to help with the Command Line argument I would require please?

    Thank You

  4. #4

    Join Date
    Sep 2011
    Location
    Wadebridge, Cornwall
    Posts
    3
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    Quote Originally Posted by r0b0c0p View Post
    I believe the php is here: C:\Program Files (x86)\PHP\v5.3\php.exe
    The sync-users is here: C:\inetpub\wwwroot\Moodle\auth\ldap\cli\sync_users .php

    Would you be able to help with the Command Line argument I would require please?

    Thank You
    Hi,

    I believe I am experiencing similar problems to you, if you've progressed any I would appreciate an update I have a working Moodle 2.1.1 Site with LDAP Auth working & even had NTLM/Single Sign-on working nicely at one point (however thats broken again atm ) LDAP Auth is still working nicely, but I can't seem to get it to populate the Moodle User List with our users from AD? - I assume this needs to be done so users can be enrolled in courses etc?

    RE: the command line argument you were after, having done some research, I believed the correct command for my server environment was the following:
    Code:
    C:\PHP\PHP.exe -f "C:\moodle\server\moodle\auth\ldap\cli\sync_users.php"
    However... I tried this command and it paused (appeared to be doing something) then said:
    Code:
    Connecting to LDAP Server...
    And that was all, took a few seconds but unfortunately it didn't populate my user-list as I was expecting.

    You might want to try this command on your server:
    Code:
    "C:\Program Files (x86)\PHP\v5.3\php.exe" -f "C:\inetpub\wwwroot\Moodle\auth\ldap\cli\sync_users.php"
    I'd greatly appreciate any input from anyone in the know about Moodle / LDAP Integration & populating users lists so you can enrol users etc. Thanks for your time & help in advance.

  5. #5
    OutLawTorn's Avatar
    Join Date
    Jul 2007
    Location
    Sydney, Australia
    Posts
    216
    Thank Post
    8
    Thanked 8 Times in 8 Posts
    Rep Power
    32
    We found we had to do was in the Moodle > LDAP config, we had to add data mappings for all of the required fields (eg Firstname, Lastname, Mail, Location) and have that information up to date in AD so that when it creates the accounts, it can have the email address already established.

    We have a batch script that runs the following:
    Code:
    C:\php\php -d memory_limit=512M -d log_errors=1 -d error_reporting=E_ALL -d display_errors=0 -d html_errors=0 -d error_log=C:\scripts\syncfile-errors.log -f D:\web\applications\moodle\auth\ldap\cli\sync_users.php > c:\scripts\MoodleUserSync.log
    Its been a while since it was set up, but it seems to mostly do the trick. It calls php.exe then runs the moodle\auth\ldap\cli\sync_users.php, and then logs the details to C:\scripts\moodleusersync.log. It actually logs a lot of detail about the syncing process (eg users created, users suspended, users restored) but its not great for troubleshooting when some users don't sync properly.

    For sites > 1000 users, you may need to increase the "MaxPageSize" in AD so that it returns more than 1000 users (info: http://docs.moodle.org/22/en/LDAP_au...ion_using_cron)
    Last edited by OutLawTorn; 8th March 2012 at 02:34 AM.

  6. #6

    Join Date
    May 2013
    Posts
    1
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    Hello All, I am currently trying to do the same thing. I have over 45000 users in my activedirectory. I can't increase the MaxPagesize in AD to 50K as it would probably slow down the performance and/or break other apps that need the AD to work.
    Is there any other way of getting all the records to sync users?
    I have made lots of research on the moodle forums and it seems that, even in 2013, it's not resolved for a lot of people.

SHARE:
+ Post New Thread

Similar Threads

  1. Moodle 2.1 LDAP enrolment error
    By climo in forum Virtual Learning Platforms
    Replies: 1
    Last Post: 8th October 2013, 08:01 AM
  2. [Moodle] Course creator LDAP user group
    By FN-GM in forum Virtual Learning Platforms
    Replies: 14
    Last Post: 4th May 2012, 02:10 PM
  3. Moodle LDAP authentication stopped working for new users?
    By reggiep in forum Virtual Learning Platforms
    Replies: 2
    Last Post: 5th January 2010, 08:33 PM
  4. Moodle 1.9.5 LDAP user sync
    By davipton in forum Virtual Learning Platforms
    Replies: 2
    Last Post: 17th June 2009, 01:59 PM
  5. Moodle and Secure LDAP?
    By gshaw in forum Virtual Learning Platforms
    Replies: 1
    Last Post: 12th June 2009, 11:11 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •