I have migrated my Moodle 3.8 site to a new hosting (VPS), and after a bunch of tries it still doesn't load when I try in the browser to load the website and I am stuck at this stage, if anyone has any experience with this would be appreciated.
The previous VPS config: ubuntu 18.04, apache, php7.2, mariadb 10.1.48.
Backed up moodle folder, moodledata, sql, deployed and restored the same files on the new server.
The new VPS was new, no config. Now the config is a bit different: ubuntu 22.04, apache, php8.1.2, mariadb 10.6.16.
Initially after all the setup, copying the moodle files and restoring db, when loading the website/moodle in the browser I would get this error "Fatal error: $CFG->dataroot is not writable, admin has to fix directory permissions! Exiting."
I have changed the permissions trying to make it work:
sudo chown -R www-data:www-data /var/www/moodle
sudo chmod -R 755 /var/www/moodle
sudo chown -R www-data:www-data /var/www/moodledata
sudo chmod -R 777 /var/www/moodledata
but for some reason (because of this or other changes I kept doing to the server, now the only result I get when loading the site in my browser is "This page isn’t working [moodle.com] is currently unable to handle this request. HTTP ERROR 500".
After this, I tried to replace index.php with a simple phpinfo(); to see if Apache etc. still working fine when I load the website. Another check - I ran in my browser the website with index.php containing just a dummy connection to the sql db and sql connection is ok as well.
I am running out of ideas. Any suggestions please? Thanks!