Jump to content

Recommended Posts

Posted

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

Posted
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.
Posted

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

  • 1 month later...
Posted

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:

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:

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:

"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 months later...
Posted (edited)

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:

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_authentication#Setting_up_regular_automatic_synchronisation_using_cron)

Edited by OutLawTorn
  • 1 year later...
Posted

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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...