So I customized moodle code and ran it in command line .
CLI_SCRIPT flag is true in my script. there is no error when running it in command line but when I schedule it in webmin and tried to run. It gave following error.
Command line scripts can not be executed from the web interfaceAny help will be appreciated.