Moodle CLI Fatal Error

Moodle CLI Fatal Error

by Bartosz Golemba -
Number of replies: 5

Hello everyone, it's my firs post so be patient and direct me to exact topic if such exists (I didn't find one).

I've got problem with executing any CLI script from command line.

After executing any of CLI console returns me message: 

"Fatal error: $CFG->dataroot is not configured properly, directory does not exist or is not accessible! Exiting."

Dataroot is set up properly, because I have no problems with using website.

My Moodle version: Moodle 3.0.3+ (Build: 20160331).

PHP version: 5.4.45

Moodle stays on dedicated server.

Average of ratings: -
In reply to Bartosz Golemba

Re: Moodle CLI Fatal Error

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

Can you tell us exactly what you are trying to run and how?  What script?  Do you have cron set up?  New site/old site?  OS?  Moodle version?

In reply to Emma Richardson

Odp: Re: Moodle CLI Fatal Error

by Bartosz Golemba -

I'm trying to run cli script to convert tables from antelope to barracuda. I tried to run such script by ssh via putty. I don't have cron, I have no idea about cron. It's old site. OS is Linux but no information from provider about distribution.

I sent Moodle version in post before but again: Moodle version: 3.0.3+

In reply to Bartosz Golemba

Re: Odp: Re: Moodle CLI Fatal Error

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Rerun the command as the 'root' user, not under your own username. 

Ideally, you should run the command as the web server's user but root/superuser should be ok.

In reply to Bartosz Golemba

Re: Moodle CLI Fatal Error

by Richard Oelmann -
Picture of Core developers Picture of Plugin developers Picture of Testers

It sounds like your command line user does not have the rights on the database (ie the 'is not accessible' part of the error message)

You may need to run the CLI script as sudo - but even then you may need to check that your local root user has the relevant access to your database.

In reply to Richard Oelmann

Odp: Re: Moodle CLI Fatal Error

by Bartosz Golemba -

Pracitcally I've got all permissions to files on server, but on db (it's hosted on phpMyAdmin) I've got not much to do (lesser than my local version of phpMyAdmin), i cannot normally drop db. I log in to db by going to address: www.sql.mywebdomain.com.pl and login credentials are:

login: name_of_db

password: my_password