Problem upgrading to 3.11.2

Problem upgrading to 3.11.2

by Eduardo Gutiérrez -
Number of replies: 19

Hi i have upgreded to 3.11 and im facing this error:


. /** * 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) && optional_param('redirect', 1, PARAM_BOOL) === 0) { $urlparams['redirect'] = 0; } $PAGE->set_url('/', $urlparams); $PAGE->set_pagelayout('frontpage'); $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(); } $hassiteconfig = has_capability('moodle/site:config', context_system::instance()); if ($hassiteconfig && moodle_needs_upgrading()) { redirect($CFG->wwwroot .'/'. $CFG->admin .'/index.php'); } // If site registration needs updating, redirect. \core\hub\registration::registration_reminder('/index.php'); if (get_home_page() != HOMEPAGE_SITE) { // Redirect logged-in users to My Moodle overview if required. $redirect = optional_param('redirect', 1, PARAM_BOOL); if (optional_param('setdefaulthome', false, PARAM_BOOL)) { set_user_preference('user_home_page_preference', HOMEPAGE_SITE); } else if (!empty($CFG->defaulthomepage) && ($CFG->defaulthomepage == HOMEPAGE_MY) && $redirect === 1) { redirect($CFG->wwwroot .'/my/'); } else if (!empty($CFG->defaulthomepage) && ($CFG->defaulthomepage == HOMEPAGE_USER)) { $frontpagenode = $PAGE->settingsnav->find('frontpage', null); if ($frontpagenode) { $frontpagenode->add( get_string('makethismyhome'), new moodle_url('/', array('setdefaulthome' => true)), navigation_node::TYPE_SETTING); } else { $frontpagenode = $PAGE->settingsnav->add(get_string('frontpagesettings'), null, navigation_node::TYPE_SETTING, null); $frontpagenode->force_open(); $frontpagenode->add(get_string('makethismyhome'), new moodle_url('/', array('setdefaulthome' => true)), navigation_node::TYPE_SETTING); } } } // Trigger event. course_view(context_course::instance(SITEID)); $PAGE->set_pagetype('site-index'); $PAGE->set_docs_path(''); $editing = $PAGE->user_is_editing(); $PAGE->set_title($SITE->fullname); $PAGE->set_heading($SITE->fullname); $courserenderer = $PAGE->get_renderer('core', 'course'); echo $OUTPUT->header(); $siteformatoptions = course_get_format($SITE)->get_format_options(); $modinfo = get_fast_modinfo($SITE); $modnamesused = $modinfo->get_used_module_names(); // Print Section or custom info. if (!empty($CFG->customfrontpageinclude)) { // Pre-fill some variables that custom front page might use. $modnames = get_module_types_names(); $modnamesplural = get_module_types_names(true); $mods = $modinfo->get_cms(); include($CFG->customfrontpageinclude); } else if ($siteformatoptions['numsections'] > 0) { echo $courserenderer->frontpage_section1(); } // Include course AJAX. include_course_ajax($SITE, $modnamesused); echo $courserenderer->frontpage(); if ($editing && has_capability('moodle/course:create', context_system::instance())) { echo $courserenderer->add_new_course_button(); } echo $OUTPUT->footer();


I dont know even what it means, so i cant solve it....Any help would be apreciated

Till now moodle always worked fine to me and i access it in this address:httP;//localhost:8080/moodle

Thanks in advance

Average of ratings: -
In reply to Eduardo Gutiérrez

Re: Problem upgrading to 3.11.2

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Create a file phpinfo.php in the Moodle code directory, that is where the Moodle config.php is, with this single line as content:

<?php phpinfo(); ?>
Then visit yoursite/phpinfo.php in your browser. What happens?
In reply to Visvanath Ratnaweera

Re: Problem upgrading to 3.11.2

by Eduardo Gutiérrez -
Thanks for you help...actually it appears a blank page.

My version of php is 8.1

eduardo@MiPcLinux:/var/www/html/moodle$ php -m
[PHP Modules]
calendar
Core
ctype
curl
date
dom
exif
FFI
fileinfo
filter
ftp
gd
gettext
hash
iconv
intl
json
ldap
libxml
mbstring
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_pgsql
pgsql
Phar
posix
pspell
readline
Reflection
session
shmop
SimpleXML
soap
sockets
sodium
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
xml
xmlreader
xmlrpc
xmlwriter
xsl
Zend OPcache
zip
zlib

[Zend Modules]
Zend OPcache


eduardo@MiPcLinux:/var/www/html/moodle$ php -v
PHP 8.1.2 (cli) (built: Aug 17 2022 13:08:39) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.2, Copyright (c) Zend Technologies
    with Zend OPcache v8.1.2, Copyright (c), by Zend Technologies


Attachment Captura desde 2022-09-16 19-06-10.png
In reply to Eduardo Gutiérrez

Re: Problem upgrading to 3.11.2

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Moodle doesn't support pHP 8.1. So that's *a* problem - but I don't think it's all that's going on here.
In reply to Howard Miller

Re: Problem upgrading to 3.11.2

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Plus whatever PHP the server has and whatever the Moodle version is installed, the yoursite/phpinfo.php described earlier should bring that well-known long table of inside the PHP.

P.S. PHP compatibility of various Moodle versions are summarized in this chart: http://www.syndrega.ch/blog/#php-and-dbms-compatibility-of-major-moodle-releases.
In reply to Visvanath Ratnaweera

Re: Problem upgrading to 3.11.2

by Eduardo Gutiérrez -
But it says:
PHP 8.0 support is being implemented for Moodle 3.11 and 4.0 as well as backported to 3.9. See MDL-70745.

Php is supposed to be compatible with previous versions of php....it has back compatibility....
In reply to Eduardo Gutiérrez

Re: Problem upgrading to 3.11.2

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
a) Now you are talking about PHP 8.0. In the OP it was 8.1.

b) MDL-70745 is about PHP 8.0. And it says at the top Fix Version/s: 3.11.8, 4.0.2.
In reply to Visvanath Ratnaweera

Re: Problem upgrading to 3.11.2

by Eduardo Gutiérrez -
Id try to update to 3.11.8 and see what happens.
If this is the problem i think moodle should update ASAP as 8.1 is the default version in Ubuntu 22.04 which is an standard in Linux distributions.

Also php recommends to leave 7.X
In reply to Eduardo Gutiérrez

Re: Problem upgrading to 3.11.2

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
You might think that but it doesn't change the current situation - which is Moodle isn't compatible with PHP 8.1
In reply to Howard Miller

Re: Problem upgrading to 3.11.2

by Eduardo Gutiérrez -
Its strange because as said and also said by php developers any version of php, specially 8.1 is backwards compatible / all 7.4 programs or scripts should work in 8.X).
In reply to Eduardo Gutiérrez

Re: Problem upgrading to 3.11.2

by Eduardo Gutiérrez -
Now i suspect that is another issue and not the php version.

I have upgraded to 3.11.10: and also 4.1 and i have similar errors:

error 3.11.10
. /** * 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) && optional_param('redirect', 1, PARAM_BOOL) === 0) { $urlparams['redirect'] = 0; } $PAGE->set_url('/', $urlparams); $PAGE->set_pagelayout('frontpage'); $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(); } $hassiteconfig = has_capability('moodle/site:config', context_system::instance()); if ($hassiteconfig && moodle_needs_upgrading()) { redirect($CFG->wwwroot .'/'. $CFG->admin .'/index.php'); } // If site registration needs updating, redirect. \core\hub\registration::registration_reminder('/index.php'); if (get_home_page() != HOMEPAGE_SITE) { // Redirect logged-in users to My Moodle overview if required. $redirect = optional_param('redirect', 1, PARAM_BOOL); if (optional_param('setdefaulthome', false, PARAM_BOOL)) { set_user_preference('user_home_page_preference', HOMEPAGE_SITE); } else if (!empty($CFG->defaulthomepage) && ($CFG->defaulthomepage == HOMEPAGE_MY) && $redirect === 1) { redirect($CFG->wwwroot .'/my/'); } else if (!empty($CFG->defaulthomepage) && ($CFG->defaulthomepage == HOMEPAGE_USER)) { $frontpagenode = $PAGE->settingsnav->find('frontpage', null); if ($frontpagenode) { $frontpagenode->add( get_string('makethismyhome'), new moodle_url('/', array('setdefaulthome' => true)), navigation_node::TYPE_SETTING); } else { $frontpagenode = $PAGE->settingsnav->add(get_string('frontpagesettings'), null, navigation_node::TYPE_SETTING, null); $frontpagenode->force_open(); $frontpagenode->add(get_string('makethismyhome'), new moodle_url('/', array('setdefaulthome' => true)), navigation_node::TYPE_SETTING); } } } // Trigger event. course_view(context_course::instance(SITEID)); $PAGE->set_pagetype('site-index'); $PAGE->set_docs_path(''); $editing = $PAGE->user_is_editing(); $PAGE->set_title($SITE->fullname); $PAGE->set_heading($SITE->fullname); $courserenderer = $PAGE->get_renderer('core', 'course'); echo $OUTPUT->header(); $siteformatoptions = course_get_format($SITE)->get_format_options(); $modinfo = get_fast_modinfo($SITE); $modnamesused = $modinfo->get_used_module_names(); // Print Section or custom info. if (!empty($CFG->customfrontpageinclude)) { // Pre-fill some variables that custom front page might use. $modnames = get_module_types_names(); $modnamesplural = get_module_types_names(true); $mods = $modinfo->get_cms(); include($CFG->customfrontpageinclude); } else if ($siteformatoptions['numsections'] > 0) { echo $courserenderer->frontpage_section1(); } // Include course AJAX. include_course_ajax($SITE, $modnamesused); echo $courserenderer->frontpage(); if ($editing && has_capability('moodle/course:create', context_system::instance())) { echo $courserenderer->add_new_course_button(); } echo $OUTPUT->footer();

Also i have test the latest moodle-dev 4.1 and it gives::
. /** * 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) && optional_param('redirect', 1, PARAM_BOOL) === 0) { $urlparams['redirect'] = 0; } $PAGE->set_url('/', $urlparams); $PAGE->set_pagelayout('frontpage'); $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(); } $hassiteconfig = has_capability('moodle/site:config', context_system::instance()); if ($hassiteconfig && moodle_needs_upgrading()) { redirect($CFG->wwwroot .'/'. $CFG->admin .'/index.php'); } // If site registration needs updating, redirect. \core\hub\registration::registration_reminder('/index.php'); if (get_home_page() != HOMEPAGE_SITE) { // Redirect logged-in users to My Moodle overview if required. $redirect = optional_param('redirect', 1, PARAM_BOOL); if (optional_param('setdefaulthome', false, PARAM_BOOL)) { set_user_preference('user_home_page_preference', HOMEPAGE_SITE); } else if (!empty($CFG->defaulthomepage) && ($CFG->defaulthomepage == HOMEPAGE_MY) && $redirect === 1) { redirect($CFG->wwwroot .'/my/'); } else if (!empty($CFG->defaulthomepage) && ($CFG->defaulthomepage == HOMEPAGE_USER)) { $frontpagenode = $PAGE->settingsnav->find('frontpage', null); if ($frontpagenode) { $frontpagenode->add( get_string('makethismyhome'), new moodle_url('/', array('setdefaulthome' => true)), navigation_node::TYPE_SETTING); } else { $frontpagenode = $PAGE->settingsnav->add(get_string('frontpagesettings'), null, navigation_node::TYPE_SETTING, null); $frontpagenode->force_open(); $frontpagenode->add(get_string('makethismyhome'), new moodle_url('/', array('setdefaulthome' => true)), navigation_node::TYPE_SETTING); } } } // Trigger event. course_view(context_course::instance(SITEID)); $PAGE->set_pagetype('site-index'); $PAGE->set_docs_path(''); $editing = $PAGE->user_is_editing(); $PAGE->set_title($SITE->fullname); $PAGE->set_heading($SITE->fullname); $courserenderer = $PAGE->get_renderer('core', 'course'); echo $OUTPUT->header(); $siteformatoptions = course_get_format($SITE)->get_format_options(); $modinfo = get_fast_modinfo($SITE); $modnamesused = $modinfo->get_used_module_names(); // Print Section or custom info. if (!empty($CFG->customfrontpageinclude)) { // Pre-fill some variables that custom front page might use. $modnames = get_module_types_names(); $modnamesplural = get_module_types_names(true); $mods = $modinfo->get_cms(); include($CFG->customfrontpageinclude); } else if ($siteformatoptions['numsections'] > 0) { echo $courserenderer->frontpage_section1(); } // Include course AJAX. include_course_ajax($SITE, $modnamesused); echo $courserenderer->frontpage(); if ($editing && has_capability('moodle/course:create', context_system::instance())) { echo $courserenderer->add_new_course_button(); } echo $OUTPUT->footer();
In reply to Eduardo Gutiérrez

Re: Problem upgrading to 3.11.2

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Looks very much like your original post. Can you see the answer I posted to that post?
In reply to Visvanath Ratnaweera

Re: Problem upgrading to 3.11.2

by Eduardo Gutiérrez -
Sorry i forgot to say: the same result...blank page.
I suppose you refer to use phpinfo.php in the moole directory.

Sorry english is not my mother language, and some things are difficult to me...
In reply to Eduardo Gutiérrez

Re: Problem upgrading to 3.11.2

by Eduardo Gutiérrez -
I made some progress ( or not smile )... i reinstalled php8.1 and liapache2-mod-php, and also installed php-fpm package, though in installation tutorial dont show as a requisite. Also i installed clamav that i hadnt in my system. Now in moodle 4.1 im facing:

When i go to the main page: http://localhost:8080/moodle then redirects to http://localhost:8080/moodle/admin/index.php :

And lots of errors came out:

Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /var/www/html/moodle/lib/dml/pgsql_native_moodle_database.php on line 597

Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /var/www/html/moodle/lib/dml/pgsql_native_moodle_database.php on line 597

Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /var/www/html/moodle/lib/dml/pgsql_native_moodle_database.php on line 597

Warning: ini_set(): Session ini settings cannot be changed after headers have already been sent in /var/www/html/moodle/lib/classes/session/file.php on line 74

Warning: ini_set(): Session ini settings cannot be changed after headers have already been sent in /var/www/html/moodle/lib/classes/session/file.php on line 75

Warning: session_name(): Session name cannot be changed after headers have already been sent in /var/www/html/moodle/lib/classes/session/manager.php on line 378

Warning: session_set_cookie_params(): Session cookie parameters cannot be changed after headers have already been sent in /var/www/html/moodle/lib/classes/session/manager.php on line 393

Warning: ini_set(): Session ini settings cannot be changed after headers have already been sent in /var/www/html/moodle/lib/classes/session/manager.php on line 395

Warning: ini_set(): Session ini settings cannot be changed after headers have already been sent in /var/www/html/moodle/lib/classes/session/manager.php on line 396

Warning: ini_set(): Session ini settings cannot be changed after headers have already been sent in /var/www/html/moodle/lib/classes/session/manager.php on line 397

Warning: ini_set(): Session ini settings cannot be changed after headers have already been sent in /var/www/html/moodle/lib/classes/session/manager.php on line 398

Warning: ini_set(): Session ini settings cannot be changed after headers have already been sent in /var/www/html/moodle/lib/classes/session/manager.php on line 401

Warning: ini_set(): Session ini settings cannot be changed after headers have already been sent in /var/www/html/moodle/lib/classes/session/manager.php on line 402

Warning: ini_set(): Session ini settings cannot be changed after headers have already been sent in /var/www/html/moodle/lib/classes/session/manager.php on line 403

Warning: session_start(): Session cannot be started after headers have already been sent in /var/www/html/moodle/lib/classes/session/handler.php on line 45

Deprecated: substr(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/html/moodle/lib/setuplib.php on line 634

Deprecated: substr(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/html/moodle/lib/setuplib.php on line 634

Deprecated: substr(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/html/moodle/lib/setuplib.php on line 639


And also:

Error

error/Se produjo un error mientras se comunicaba con el servidor
Debug info:
Error code: Se produjo un error mientras se comunicaba con el servidor
$a contents:
Stack trace:
  • line 159 of /lib/classes/session/manager.php: core\session\exception thrown
  • line 139 of /lib/classes/session/manager.php: call to core\session\manager::start_session()
  • line 829 of /lib/setup.php: call to core\session\manager::start()
  • line 29 of /config.php: call to require_once()
  • line 94 of /admin/index.php: call to require()
I attach an image if its clearer:
Attachment Captura desde 2022-09-18 19-56-16.png
In reply to Eduardo Gutiérrez

Re: Problem upgrading to 3.11.2

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Moodle 4.1 hasn't been released yet. So you're using an Alpha version of Moodle with an unsupported version of PHP and wondering why you have problems?


In reply to Howard Miller

Re: Problem upgrading to 3.11.2

by Eduardo Gutiérrez -
As far as i know, there are new features and things in for example 8.1 that are not present in 8.0 or 7.4.
But if you program something in 7.4, for example moodle, if you use 8.0 it should work... Not intensively and in educational context, but with some students we caught code made in 7.4...and change the version to 8.0 and it worked fine without problems....We made a web to manage polls...

Perhaps im confused...
In reply to Eduardo Gutiérrez

Re: Problem upgrading to 3.11.2

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

You have the idea that they don't do anything in newer versions of PHP that break things in code written for older versions. They do. It happens with every version. In something is complex as Moodle, PHP features will have been used that no longer work the same way in PHP 8.1. They may not work at all or may create warnings.

The server requirements are written for each Moodle version for a reason. If you don't stick to them then you are on your own.
In reply to Howard Miller

Re: Problem upgrading to 3.11.2

by Eduardo Gutiérrez -
Thanks, i wrote to php i their told me you were right....i thought that php code that for example works for 7.4 should work in 8.0 or 8.1... so i opened this issue, because i thought there was another kind of problem. As i want to stay in 8.1 i d have to wait till November to the 4.1 release of Moodle...Meanwhile id try to download the weekly development releases, just i have some luck....
Thanks again
In reply to Eduardo Gutiérrez

Re: Problem upgrading to 3.11.2

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
I'm not sure what to say. The latest versions of Moodle are compatible with PHP 8.0. They are NOT compatible with PHP 8.1.

PHP 8.1 is not "backward compatible" with PHP 8.0 or (especially) PHP 7.4. It just isn't. That's not true.


Average of ratings: Useful (1)