auth_ldap_sync_users.php database issue

auth_ldap_sync_users.php database issue

by simon llewellyn -
Number of replies: 4

Hi all,

I have encountered an issue where we are trying to run auth_ldap_sync_users.php from command line but we are getting a failed to connect database error.


Our setup:


2 Linux servers

1 web server where all of Moodle sits

1 Moodles database


Both servers are running Redhat Linux 5


Connecting to the web server to run auth_ldap_sync_users.php
We are receiving this response:


# php auth_ldap_sync_users.php

Configuring temp tablePHP Notice:  Unknown table 'mdl_extuser'<br /><br />DROP TEMPORARY TABLE mdl_extuser<ul style="text-align: left"><li>line 103 of lib/dmllib.php: call to debugging()</li><li>line 2298 of lib/dmllib.php: call to execute_sql()</li><li>line 588 of auth/ldap/auth.php: call to execute_sql_arr()</li><li>line 44 of auth/ldap/auth_ldap_sync_users.php: call to auth_plugin_ldap->sync_users()</li></ul> in /var/www/html/lib/weblib.php on line 6943Creating temp table mdl_extuserPHP Notice:  Access denied for user 'moodle'@' [moodle webserver ip address] ' to database 'moodle'<br /><br />CREATE TEMPORARY TABLE mdl_extuser (username VARCHAR(64), PRIMARY KEY (username)) TYPE=MyISAM<ul style="text-align: left"><li>line 103 of lib/dmllib.php: call to debugging()</li><li>line 590 of auth/ldap/auth.php: call to execute_sql()</li><li>line 44 of auth/ldap/auth_ldap_sync_users.php: call to auth_plugin_ldap->sync_users()</li></ul> in /var/www/html/lib/weblib.php on line 6943Failed to create temporary users table - aborting


Any help would be appreciated!


Thanks
Simon

Average of ratings: -
In reply to simon llewellyn

Re: auth_ldap_sync_users.php database issue

by mark price -

I don't think you're having a connection issue

if (isset($_SERVER['REMOTE_ADDR'])) {
error_log("should not be called from web server!");
exit;
}

This is inside auth_ldap_sync_users.php
and you said "Connecting to the web server to run auth_ldap_sync_users.php"

just thought i would point that out lol

Also

I'm guessing that

Creating temp table mdl_extuserPHP Notice:  Access denied for user 'moodle'@'

is your problem, but I'm just guessing from what i can see.

I'm having problems myself with ldap sync users.

In reply to mark price

Re: auth_ldap_sync_users.php database issue

by Iñaki Arenaza -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Yup, you are right. You need to grant the 'create temporary table' permission to the moodle database user.

Saludos.
Iñaki.
Average of ratings: Useful (1)
In reply to Iñaki Arenaza

Re: auth_ldap_sync_users.php database issue

by simon llewellyn -

You was completely correct Iñaki!

solved the issue and the script is running as we speak cool

thanks for your help!

In reply to mark price

Re: auth_ldap_sync_users.php database issue

by simon llewellyn -
if (isset($_SERVER['REMOTE_ADDR'])) {
error_log("should not be called from web server!");
exit;
}

that only applies if you actually view it from its website i.e. www.websiteaddress.com/auth_ldap_sync_users.php


this script is being run through command line on the moodle server (I've stated web server and database server as our Moodle database sits on a different server)

Thanks for your reply though!