moodlerestapi间歇性失败并返回500(内部服务器错误)

xzv2uavs  于 2021-06-20  发布在  Mysql
关注(0)|答案(0)|浏览(187)

moodle rest api间歇性失败并返回500(内部服务器错误)

Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.0.30-0ubuntu0.16.04.1, Copyright (c) 1999-2017, by Zend Technologies

<?php
error_reporting(-1); // reports all errors
ini_set("display_errors", "1"); // shows all errors
ini_set("log_errors", 1);
ini_set("error_log", "php-error.log");
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
/**
 * Version details
 *
 * @package    local_lingk
 * @copyright  (C) 2018 Lingk Inc (http://www.lingk.io)
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
require_once '../config.php';
//require_once '../lib/moodlelib.php';
// require_once($CFG->dirroot.'/lib/moodlelib.php');
require_once($CFG->libdir.'/moodlelib.php');
require_once 'src/Mandrill.php'; //Not required with Composer

global $DB, $CFG, $SESSION, $USER;

$CFG = new stdClass();
$CFG->dataroot = '/usr/src/moodle/moodledata';
$CFG->cookiename = 'MoodleSession';

$USER = new stdClass();
$USER->id        = -10;
$USER->email     = 'emailed';
$USER->firstname = 'Do not reply to this email';
$USER->username  = 'noreply';
$USER->lastname  = '';
$USER->confirmed = 1;
$USER->suspended = 0;
$USER->deleted   = 0;
$USER->picture   = 0;
$USER->auth      = 'manual';
$USER->firstnamephonetic = '';
$USER->lastnamephonetic  = '';
$USER->middlename     = ''; 
$USER->alternatename  = ''; 
$USER->imagealt       = '';
$USER->maildisplay    = 1;
$USER->emailstop      = 1;

header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Headers: access");
header("Access-Control-Allow-Methods: POST");
header("Access-Control-Allow-Credentials: true");
header('Content-Type: application/json');
header("HTTP/1.0 200 Successfull operation");
// echo '=============+++++++';exit;
    $wsfunction = $_POST['wsfunction'];   
    // print_r($record);exit;
    // $client_id = $_POST['client_id'];
    // $client_secret = $POST['client_secret'];
    // $device_id = $POST['device_id'];
    $response = array();

我尝试更改apache配置和mysql配置,但是api断断续续地失败。它工作两次,第三次失败,有时成功三次,第四次失败。我是否缺少任何配置或moodle设置?

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题