If you have a large user base, might want to increase some php settings ... memory used, time to run if those are currently the defaults and have never been tweaked upwards. Reason, depending upon how ldap auth is configured, you could be pulling across a lot of data.
There's another script located in moodlecode/auth/ldap/cli/ called sync_users.php
Run as root from moodlecode directory (but could be anywhere if you put in the full path):
php auth/ldap/cli/sync_users.php
Takes no parameters and does read the settings in the configuration of LDAP in the Moodle UI. Have found the more 'accurate' the settings are for LDAP the less junk one gets into mdl_user table. By that I mean, the OU's that gets students and staff is best rather than using the top level OU + DC's for the domain. If using the latter, one could get machines, etc. ... ie, a bunch of junk as far as users go.
'spirit of sharing', Ken