General help

 
 
Picture of Khalid Mehmood
External database authentication Automatic Synchronisation script erros
 

 moodle-2.4., 1Apache Version :2.4.2,   PHP Version :5.4.3  

I have mapped my external database fileds with moodle fileds and I can succsfully login to   the moodle  using external db and when i loged in it creates the new user in moodle

now i want to add all external users in my moodle site for this I am running 

Automatic Synchronisation script but it is not working

my script is 

goto run

type CMD

cd D:\wamp\bin\php\php5.4.3\

D:\wamp\bin\php\php5.4.3>php –c  D:\wamp\bin\apache\apache2.4.2 \bin\php.ini D:\wamp\www\moodle\auth\db\cli\sync_users.php > dev/null -v > moodle_enrol_db_sync.txt 2> moodle_enrol_db_sync_error.txt

IT SHOWs Following Error

Notice: Use of undefined constant OCI_COMMIT_ON_SUCCESS - assumed 'OCI_COMMIT_ON_SUCCESS' in D:\wamp\www\moodle\lib\adodb\adodb.inc.php on line 4308

Call Stack:
0.0005 236456 1. {main}() D:\wamp\www\moodle\auth\db\cli\sync_users.php:0
0.2261 22926776 2. auth_plugin_db->sync_users() D:\wamp\www\moodle\auth\db\cli\sync_users.php:91
0.2261 22928320 3. auth_plugin_db->get_userlist() D:\wamp\www\moodle\auth\db\auth.php:242
0.2261 22928648 4. auth_plugin_db->db_init() D:\wamp\www\moodle\auth\db\auth.php:464
0.2261 22929008 5. ADONewConnection() D:\wamp\www\moodle\auth\db\auth.php:123

 please help me how I run Automatic Synchronisation script for user 

authentication

 

 
Average of ratings: -
Picture of Howard Miller
Re: External database authentication Automatic Synchronisation script erros
Group DevelopersGroup Documentation writersGroup Particularly helpful Moodlers

I'm assuming (it would be useful if you told us) that the external database is Oracle.

Have you definitely got the Oracle extension for PHP installed. It won't be by default.

 
Average of ratings: -
Picture of Khalid Mehmood
Re: External database authentication Automatic Synchronisation script erros
 

Thanks for the reply 

Yes sir I have installed moodle on mysql (wamp)

and my external db is oracle 10.2

and php extention oci8 in enabled in wamp and I can access oracle db using oci functions 

 
Average of ratings: -
Picture of Howard Miller
Re: External database authentication Automatic Synchronisation script erros
Group DevelopersGroup Documentation writersGroup Particularly helpful Moodlers

No idea then. We need someone who has experience of accessing an Oracle database from Windows. Might be a long wait unfortunately sad

If it was me... I would write a short PHP script on the Moodle server to *prove* that PHP can access your Oracle database with no problems.

 
Average of ratings: -
Picture of Khalid Mehmood
Re: External database authentication Automatic Synchronisation script erros
 

as I have written in my first post that I can successfuly login to the moodle using external db user it means that external db authentication plugin is working with my external(oracle) db

http://docs.moodle.org/23/en/External_database_authentication

but i can not run the script 

Automatic Synchronisation

The above method adds new users only when they log in. If you want user accounts to be created in Moodle independent of actual logins, the db authentication plugin offers a script you can run regularly via 'cron'. A typical cron entry will be as follows...

0 * * * *    /usr/bin/php /path/to/moodle/auth/db/cli/sync_users.php >dev/null

This runs every hour (adjust as required). It reads the entire table updating and creating local Moodle users.

 

 
Average of ratings: -
Picture of Howard Miller
Re: External database authentication Automatic Synchronisation script erros
Group DevelopersGroup Documentation writersGroup Particularly helpful Moodlers

Yes - but... the CLI PHP is a completely different binary to the one that runs on the web server. It may not have the same extensions included. I really don't know much about Windows, I don't use it, but I would make sure that command-line PHP can access Oracle. My guess is that you'll find it can't.

 
Average of ratings: -
Picture of Khalid Mehmood
Re: External database authentication Automatic Synchronisation script erros
 

Now it works fine infect there was 2 main mistakes

1- I did not added tns in tnsnames.ora for oracle 

2- files path was not correct now it is working with following  pathes

php  -c D:\wamp\bin\apache\Apache2.4.2\bin\php.ini D:\wamp\www\moodle\auth\db\cli\sync_users.php > dev/null -v > moodle_enrol_db_sync.txt 2> moodle_enrol_db_sync_error.txt

Thanks All for your reply

 
Average of ratings: -