I extracted the downloaded Moodle moodle-latest-401.tgz

I extracted the downloaded Moodle moodle-latest-401.tgz

by Doulos Xavier -
Number of replies: 7

I extracted the downloaded Moodle 'moodle-latest-401.tgz'

mp@greatwall:/var/www/html

drwxr-xr-x 59 1005 1005     4096 Mar 21 16:41 moodle/
-rw-r--r--  1 root root 65146261 Mar 21 15:04 moodle-latest-401.tgz

When I go to the http://192.168.18.153/moodle/ I am just seeing a text file like this, without the Moodle install. Any idea what is going on?

<?php
// 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/>;.

/**
 * Moodle frontpage.
 *
 * @package    core
 * @copyright  1999 onwards Martin Dougiamas (http://dougiamas.com)
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */

if (!file_exists('./config.php')) {
    header('Location: install.php');
    die;
}

require_once('config.php');
require_once($CFG->dirroot .'/course/lib.php');
require_once($CFG->libdir .'/filelib.php');

redirect_if_major_upgrade_required();

$urlparams = array();
if (!empty($CFG->defaulthomepage) &&
        ($CFG->defaulthomepage == HOMEPAGE_MY || $CFG->defaulthomepage == HOMEPAGE_MYCOURSES) &&
        optional_param('redirect', 1, PARAM_BOOL) === 0
) {
    $urlparams['redirect'] = 0;
}
$PAGE->set_url('/', $urlparams);
$PAGE->set_pagelayout('frontpage');
$PAGE->add_body_class('limitedwidth');
$PAGE->set_other_editing_capability('moodle/course:update');
$PAGE->set_other_editing_capability('moodle/course:manageactivities');
$PAGE->set_other_editing_capability('moodle/course:activityvisibility');

// Prevent caching of this page to stop confusion when changing page after making AJAX changes.
$PAGE->set_cacheable(false);

require_course_login($SITE);

$hasmaintenanceaccess = has_capability('moodle/site:maintenanceaccess', context_system::instance());

// If the site is currently under maintenance, then print a message.
if (!empty($CFG->maintenance_enabled) and !$hasmaintenanceaccess) {
    print_maintenance_message();
}

 

Average of ratings: -
In reply to Doulos Xavier

Re: I extracted the downloaded Moodle moodle-latest-401.tgz

by Leon Stringer -
Picture of Core developers Picture of Particularly helpful Moodlers

Your web server does not have PHP installed/configured. If you have recently installed PHP restart the web server processes to apply the change. You can check if PHP is configured with a PHP info page. See this reply and this reply.

In reply to Leon Stringer

Re: I extracted the downloaded Moodle moodle-latest-401.tgz

by Doulos Xavier -
When I type is php -v I see this. so PHP is installed right?

mp@greatwall:/var/www/html$ php -v
PHP 8.1.32 (cli) (built: Mar 13 2025 18:26:45) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.32, Copyright (c) Zend Technologies
with Zend OPcache v8.1.32, Copyright (c), by Zend Technologies
 
Ran this command sudo a2enmod php8.1
 
 

PHP Version 8.1.32

System Linux replicagreatwall 5.4.0-211-generic #231-Ubuntu SMP Tue Mar 11 17:06:58 UTC 2025 x86_64
Build Date Mar 13 2025 18:26:45
Build System Linux
Server API Apache 2.0 Handler
Virtual Directory Support disabled
Configuration File (php.ini) Path /etc/php/8.1/apache2
Loaded Configuration File /etc/php/8.1/apache2/php.ini
Scan this dir for additional .ini files /etc/php/8.1/apache2/conf.d
 
Still the http://192.168.18.153/moodle is showing text 
 
Then I changed the owner of 'moodle' file to www-data
 
drwxr-xr-x 59 www-data 1005     4096 Mar 21 16:41 moodle/
 
Now it is showing the Moodle install page. 
 
In reply to Doulos Xavier

Re: I extracted the downloaded Moodle moodle-latest-401.tgz

by Ken Task -
Picture of Particularly helpful Moodlers

Not quite 'fixed' as you've changed the owner but not the group.

chown www-data:www-data moodle -R

See the :www-data ... that's the group.

moodle is the code directory

-R means recursive ... meaning the moodle directory and then every subdirectory file in the moodle directory.

'SoS', Ken

In reply to Doulos Xavier

Re: I extracted the downloaded Moodle moodle-latest-401.tgz

by Ken Task -
Picture of Particularly helpful Moodlers

+1 to Leon's response.

In addition:

drwxr-xr-x 59 1005 1005     4096 Mar 21 16:41 moodle/

shows 4 days ago - date bolded above - and the user/group bolded above indicates the system doesn't know that user id nor group id.

And why are we going after yet another version of moodle - a 4.1 no less?

Previous posting:

https://moodle.org/mod/forum/discuss.php?d=467018#p1874997

was about a 4.5 attempt.

And an issue with h5p libraries - I will respond again there. :|

'SoS', Ken

In reply to Ken Task

Re: I extracted the downloaded Moodle moodle-latest-401.tgz

by Doulos Xavier -

Thanks Ken, I am creating a replica of the production. Not sure why the user and the group is 1005. What should be the user and group?

In reply to Doulos Xavier

Re: I extracted the downloaded Moodle moodle-latest-401.tgz

by Ken Task -
Picture of Particularly helpful Moodlers

So the goal is to rebuild the production site and you've chosen the route of restoring course backups from old server to new server.

Then you MUST do this ... in the old server from code/admin/cli/ run:

php uninstall_plugins.php --show-contrib

That will produce a list of addons installed.

Example from a live 4.1.highest

mod_checklist   Checklist
mod_questionnaire       Questionnaire
block_checklist Checklist
filter_wiris    MathType by WIRIS
atto_wiris      MathType by WIRIS
tool_coursearchiver     Course Archiver
tool_health     Health center
format_grid     Grid
format_onetopic Onetopic format
format_topcoll  Collapsed Topics
report_allbackups       All backups
report_benchmark        Moodle Benchmark
report_coursesize       Course size
report_coursestats      Courses usage statistics
report_modstats Module Usage Statistics
gradeexport_checklist   Checklist
local_mailtest  eMail Test

Now on your new server, you must install those addons prior ... PRIOR ... to any atttempt to restore a course backup.

Catch 22 for you might be the authentication setup on old server.

So to see if users on that system are setup to authenticate by some method other than manual run this db query on the DB for the moodle on the original server.

select id, auth, firstname from mdl_user;

If you see in the auth column anything other than manual you must setup that method of authentication on the new server.

The course backups you are taking are full with users and each user has an authentication method.   If you do NOT setup those authentications, users will not be able to login to the new server.

Consult Moodle docs for how to setup those external authentications.

https://docs.moodle.org/405/en/Authentication

'SoS', Ken