Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-70518

Question import fails when sys_get_temp_dir() not in open_basedir

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • 3.10
    • Questions
    • None
    • MOODLE_310_STABLE

      Question import fails with "Invalid permissions detected when trying to create a directory. Turn debugging on for further details." when open_basedir prevents access to the path returned by sys_get_temp_dir(). See also this forum reply.

      This does not happen with Moodle 3.9.

      Steps to reproduce this:

      1. Export a question bank as a file.
      2. Set PHP's open_basedir to include the site's Moodledata directory but not the directory returned by sys_get_temp_dir(). You may need to configure PHP's upload_tmp_dir for file uploads to work, this location must also be within open_basedir.
      3. If necessary restart any services (e.g. Apache or PHP-FPM) to pick up the PHP configuration change.
      4. Within a course select the question bank file from step 1, and select its type (e.g. "Moodle XML format"). Click "Import".

      Expected results:
      The question bank is imported without error.

      Actual results:
      Warning: file_exists(): open_basedir restriction in effect. File(/tmp/requestdir/Q7dI) is not within the allowed path(s): (/var/www) in /var/www/moodle.example.com/moodle/lib/setuplib.php on line 1538

      Warning: file_exists(): open_basedir restriction in effect. File(/tmp/requestdir/Q7dI) is not within the allowed path(s): (/var/www) in /var/www/moodle.example.com/moodle/lib/setuplib.php on line 1548

      Warning: is_dir(): open_basedir restriction in effect. File(/tmp/requestdir/Q7dI) is not within the allowed path(s): (/var/www) in /var/www/moodle.example.com/moodle/lib/setuplib.php on line 1552

      Invalid permissions detected when trying to create a directory. Turn debugging on for further details.

      More information about this error

      Debug info: /tmp/requestdir/Q7dI can not be created, check permissions.
      Error code: invaliddatarootpermissions

      Stack trace:

      line 1554 of /lib/setuplib.php: invalid_dataroot_permissions thrown
      line 1645 of /lib/setuplib.php: call to make_writable_directory()
      line 1675 of /lib/setuplib.php: call to get_request_storage_directory()
      line 89 of /question/import.php: call to make_request_directory()

            Unassigned Unassigned
            leonstr Leon Stringer
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.