Blank (Empty) Pages once upgrade to 4.3.1+

Blank (Empty) Pages once upgrade to 4.3.1+

by David Price -
Number of replies: 20
Hi

I've updated from Moodle 4.1.2+ and all seems to go well, all plugins are installed and up to date, no warnings but once installed my browser opens a blank page and when I say blank I mean empty, no source code etc.  There is no way to log in to the Admin tools and no error on the server pages.  If I try loading a page after logging in (which works) age I see nothing in the resulting page source code view, no HTML/CSS code of any kind.  

I've manually cleared out the cache, local cache and temp in the Moodle Data directory.

Any ideas, all are welcome.

Thanks


Average of ratings: -
In reply to David Price

Re: Blank (Empty) Pages once upgrade to 4.3.1+

by Ken Task -
Picture of Particularly helpful Moodlers
Did you perform the upgrade via command line as root - ownerships/permissions?
Or via GUI?

You didn't mention what theme you had been using.
Suggest adding a line to config.php to force theme to use a stock theme that comes with all versions of 4 ... that of boost:

$CFG->theme='boost';

Save config.php file no need to reboot/restart anything, just attempt access.

If that's not it ... full debugging via debug lines in config-dist.php of code into config.php.
Again, no need to reboot/restart anything but moodle should show something!
If it does, come back here and share what you saw if it doesn't lead to resolution by you!

'SoS. Ken

In reply to Ken Task

Re: Blank (Empty) Pages once upgrade to 4.3.1+

by David Price -
Hi Ken

Thanks for the reply: I did what I normally do, backed up everything, cloned the site as it is, and made sure it was working. I then delete the entire contents of the http folder and replace it with updated files and a copy of the config.

It went through all the normal checks for server status and plugin updates which it passed and then once I get the complete and reload page I get the blank/empty pages

I'll try the other methods you mention today and post my results
Thanks
David
In reply to Ken Task

Re: Blank (Empty) Pages once upgrade to 4.3.1+

by David Price -
HI Ken

No results on the page when I add what you suggest. They stay blank and code empty, not even a line of markup.

This is my config file - I might be blind to errors by now lol
<?php // Moodle configuration file

unset($CFG);
global $CFG;
$CFG = new stdClass();

$CFG->dbtype = 'mariadb';
$CFG->dblibrary = 'native';
$CFG->dbhost = 'localhost';
$CFG->dbname = 'XXXXXXXXXXXX';
$CFG->dbuser = 'XXXXXXXXXXXX';
$CFG->dbpass = 'XXXXXXXXXXXX;
$CFG->prefix = '';
$CFG->dboptions = array (
'dbpersist' => 0,
'dbport' => 3308,
'dbsocket' => '',
'dbcollation' => 'utf8mb4_general_ci',
);

$CFG->wwwroot = 'https://klmuktraining.com/online2';
$CFG->dataroot = '/var/www/vhosts/klmuktraining.com/moodledata-live';
$CFG->admin = 'admin';

$CFG->directorypermissions = 02777;

require_once(__DIR__ . '/lib/setup.php');

// There is no php closing tag in this file,
// it is intentional because it prevents trailing whitespace problems!


Thanks
David
In reply to David Price

Re: Blank (Empty) Pages once upgrade to 4.3.1+

by Ken Task -
Picture of Particularly helpful Moodlers
Moodle code is in an 'online2' directory inside a WordPress.
WordPress normally uses .htaccess files and those are hierarchael ... top level .htaccess file applies to all files/subdirectories underneath it.   Thus a rule for WP might be affecting all of moodle.

See server is under PleskLin.   Plesk normally has a setting to restrict access to code directory - is the moodledata directory path added to that restriction?

Also noticed no prefix to tables for DB.  Normally there is mdl_

Wonder if DB has some tables with a prefix and some without.

If you had CLI access to server I'd ask you to run the mysql collation script in online2/admin/cli/ or just use mariadb client use the DB for the moodle and issue 'show tables';

'SoS', Ken



'SoS', Ken

In reply to Ken Task

Re: Blank (Empty) Pages once upgrade to 4.3.1+

by Jeff Mitchell -
I am having the same issue, so I am curious as to the fix.

I'll create my own thread however, just sharing my build to see if comparisons are visible.

Stand alone server running Debian 11 with Moodle 4.1.4+

I do the Debian 12 upgrade first. Reboot.

Moodle works fine, with the exception that Moodle tells me that PHP 8 is not supported for 4.1.X

Put the server into maintenance mode and then start the upgrade to 4.3 with copying config file, all plugins, and themes. Once I refresh the page to start the upgrade process, I got php code displayed. I then checked to see if PHP 8 was enabled, which it was not. I enable PHP8, refresh my browser and the page goes white and I cannot get to any part of the admin side of things.
In reply to Jeff Mitchell

Re: Blank (Empty) Pages once upgrade to 4.3.1+

by Ken Task -
Picture of Particularly helpful Moodlers
@Jeff ....
Well, as long as you are here, starting your own thread might make things more confusing .... sooooooo ....

Since we have same issue ... maybe there will be something that relates!   
But, if you don't host same place or don't have PleskLin your environment is different ... and might be different enough to have different solutions.

Do you have command line access to your server?
IF so there is a checks.php script in code/admin/cli/
run it like: php checks.php [ENTER]
it's basically the same as the environment check from the GUI interface.
This assumes that php-cli is used/found.

So you enabled PHP 8 late ... but haven't described if you have all the PHP needed - php-cli, php-common, etc.    So, issue this:

php -m [ENTER]

That should find php-cli and it should be version 8.x and all the loaded modules for php should compare with the list of php extensions required to run a moodle.
Of recent version 4's, sodium was added as required.
Also max_input_vars should be at least 5000.


And, to see what's going on ... copy the debug lines in config-dist.php to your config.php file to see what moodle might be complaining about.


'SoS', Ken

In reply to Ken Task

Re: Blank (Empty) Pages once upgrade to 4.3.1+

by Jeff Mitchell -
This server is my dev server in which I test all updates/upgrades before I apply to production and this is before copying any new Moodle files:

Running php checks.php

root@archmood:/var/www/MoodleDev/admin/cli# php checks.php

PHP Deprecated:  Creation of dynamic property cache_config::$configlockmappings is deprecated in /var/www/MoodleDev/cache/classes/config.php on line 146

CRITICAL: Environment (core_environment)

   Status | Check                                                       

----------+--------------------------------------------------------------------

    ERROR | Environment (core_environment)                              

          |     You must solve all the environmental problems (errors) found

          |     above before proceeding to install this Moodle version!

 CRITICAL | Cron running (tool_task_cronrunning)                        

          |     The admin/cli/cron.php script has not been run for 1 year

          |     223 days and should run every 1 min.

    ERROR | Ad hoc task queue (tool_task_adhocqueue)                    

          |     Oldest task is 1 year 147 days which is more than 4 hours


In reply to Jeff Mitchell

Re: Blank (Empty) Pages once upgrade to 4.3.1+

by Ken Task -
Picture of Particularly helpful Moodlers
@Jeff
So you didn't setup a cron run in crontab - outside of moodle from the OS.

"The admin/cli/cron.php script has not been run for 1 year"

Recommendation for cron run frequency is every minute.

So, CLI again ... cd /path/to/moodlecode/admin/cli/
Make sure site is out of the maintenance mode - cron will not run if in that mode.
php maintenance.php --disable [ENTER]
Then run cron.php
php cron.php [ENTER]

That will grind away ... might even time out!
If it times out, up arrow on keyboard [ENTER]

The other bottle neck - adhoc_task
Oldest task is 1 year 147 days
Getting cron to run should also run those task that didn't complete or haven't been run in a while.

Then there is this:
"PHP Deprecated:  Creation of dynamic property cache_config::$configlockmappings is deprecated in /var/www/MoodleDev/cache/classes/config.php on line 146"
which is related to all the caches which haven't been cleaned up in a year!

cd /path/to/moodledata/
rm -fR cache/*
rm -fR localcache/*
rm -fR muc/*

If cron.php has issues running you might have to put that command in a nohup wrapper:

nohup php cron.php & [ENTER]
That will launch cron.php and begin a log of that command - but return you to your command prompt.    From time to time check the tail of output file found in same directory.

Once you do get cron/adhoc task to catch up, do setup a cron job for it.

Fun and games! [not!]
'SoS', Ken


In reply to Ken Task

Re: Blank (Empty) Pages once upgrade to 4.3.1+

by Jeff Mitchell -
Ken,

I did all you said minus setting up cron. It is a dev server with no live data to be sent out. I manually was running it during this install/setup.

That being said, I still get a white screen. It did have me wondering after reading about the OPs issue with WordPress as this particular server recently has a set up of WordPress on it.

I'm going to do some further testing and see if my white screen issue is because of the WordPress issue also.
In reply to Ken Task

Re: Blank (Empty) Pages once upgrade to 4.3.1+

by David Price -
Hi Ken

Yes you are right the main site is WP however I'm not certain that's creating the issue as we've run it on this server for about 18 months now, moodle 3 version finally upgraded to 4.1 with no issues but I take your point, and will check further.

No prefixes on the tables, the WP and Moodle DBs are separate and I will run the collation script, ty.

I have full server access via Plesk and see no errors in the log which I would expect if access was the issue.

I will check the Plesk settings but it seems strange it's affecting this from 4.1.2+ that's running in the dir 'https://klmuktraining.com/online' and I cloned this with it running perfectly before upgrading to 4.3.1+

I appreciate the response I won't have much time to work on this till the weekend but will go through this thread and feedback.

Thanks
David
In reply to Ken Task

Re: Blank (Empty) Pages once upgrade to 4.3.1+

by David Price -
Would you know if there is a way to disable all Moodle plugins from config?
Thanks
In reply to David Price

Re: Blank (Empty) Pages once upgrade to 4.3.1+

by Ken Task -
Picture of Particularly helpful Moodlers
Don't think there is any way to disable all addon plugins via config.php file if that's what you mean.

You could move additional plugin directories to hidden like so ...
Let's say there is an addon report called benchmark and it's directory is in code/reports/
cd code/reports/
mv benchmark .benchmark

Web server/moodle code not supposed to be able to see 'dot' directories like that, BUT ... get ready for tons of errors!

'SoS', Ken
 
In reply to David Price

Re: Blank (Empty) Pages once upgrade to 4.3.1+

by Ken Task -
Picture of Particularly helpful Moodlers
right after

$CFG->directorypermissions = 02777;

in config.php

add the following lines for debugging info:

@error_reporting(E_ALL | E_STRICT);
@ini_set('display_errors', '1');
$CFG->debug = (E_ALL | E_STRICT);
$CFG->debugdisplay = 1;

In addition ... site is running nginx.

and
From a config-dist.php file in 4.3.lastest code:

//=========================================================================
// 5. ADMIN DIRECTORY LOCATION  (deprecated)
//=========================================================================
// Please note: Support from this feature has been deprecated and it will be
// removed after Moodle 4.2.
//
// A very few webhosts use /admin as a special URL for you to access a
// control panel or something.  Unfortunately this conflicts with the
// standard location for the Moodle admin pages.  You can work around this
// by renaming the admin directory in your installation, and putting that
// new name here.  eg "moodleadmin".  This should fix all admin links in Moodle.
// After any change you need to visit your new admin directory
// and purge all caches.

It might be that the test instances need their own fully qualified subdomain
rather than as a sub directory.


'SoS', Ken

In reply to David Price

Re: Blank (Empty) Pages once upgrade to 4.3.1+

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers
Blank pages often suggest PHP incompatibility...what version of PHP are you on?
In reply to Emma Richardson

Re: Blank (Empty) Pages once upgrade to 4.3.1+

by David Price -
Hi Emma

Thanks for your reply: Currently running 8.0.30. I have the live site running from a different folder on the same server which is running Moodle 4.1.2+ so not a massive jump.

On the test instance, it lets me log in, and then totally empty/blank pages are served.
Thanks
David
In reply to David Price

Re: Blank (Empty) Pages once upgrade to 4.3.1+

by Usman Asar -
Picture of Plugin developers Picture of Testers
Sometimes cache's get corrupted while upgrading, delete cache and localcache folders from your moodle data folder. and refresh.
and dont worry about deleting, its a safe process, as soon as you reload, these folders will be created once again.
In reply to Usman Asar

Re: Blank (Empty) Pages once upgrade to 4.3.1+

by David Price -
Hi Usman

Thanks for the reply: I did clear out the cache etc in the moodle files dir as well as session data and tmp files but no joy. Also runs the cron perfectly which I have done several times with no joy.
Thanks
David
In reply to David Price

Re: Blank (Empty) Pages once upgrade to 4.3.1+

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers
Did you copy over the theme? And other plugins? Did you check ownership and permissions on your moodledata folder and your moodle code folder?
In reply to David Price

Re: Blank (Empty) Pages once upgrade to 4.3.1+

by David Price -
Thanks for the help everyone, sorry for the late reply but I believe I found the problem though not had a chance to test it yet.  I didn't realise but the script run on the DB tables did work correctly (I just didn't notice, probably due to the COVID I ended up having) so I had a mixture of a small amount of utf8mb3_general_ci tables and utf8mb4_general_ci tables.  After running the script 3 more times this was resolved.  I will now attempt migration again and see if I still have the issue.  Apologies, it's so often the simple thing.

Thanks all for the support and quick responces
David