0

I want to move moodle lms from local server to live server, I moved moodeldata to httpdocs and tired to figure out httpdocs directory path on shared Linux based Plesk server. I appreciate any one helps me!

I tried like this

$CFG->dataroot='\httpdocs\moodledata';

but the result is

Fatal error: $CFG->dataroot is not configured properly, directory does not exist or is not accessible! Exiting.

ADyson
  • 57,178
  • 14
  • 51
  • 63
itom dire
  • 1
  • 1
  • As this is a linux environment, you can't use backslashes in paths. The backslash is an escape character. You should using a front slash as directory separator (`/`). For future reference, I'd advice you to only use front slashes in paths – DarkBee Dec 02 '22 at 09:29
  • I already used it many times but the result is the same – itom dire Dec 02 '22 at 09:45
  • Well of course using a direct slash would indicate "starting from the root or the home folder". If moodledata is directly inside httpdocs I'd guess your folder would be `__DIR__ . '/moodledata'` – DarkBee Dec 02 '22 at 09:53
  • Thank you for you help and still am in trouble. I tried as your suggestion(__DIR__ .'moodledata') and also I changed to '/data/www/httpdocs/moodledata' but nothing solved – itom dire Dec 02 '22 at 11:48

2 Answers2

1

On Linux, they should be forward slashes

$CFG->dataroot = '/moodledata';

Also, its a really bad idea to put the data root in a web directory (httpdocs) that's publicly available - put the data root in a directory that's outside of the web root

https://docs.moodle.org/401/en/Installing_Moodle#Create_the_.28moodledata.29_data_directory

If you are migrating, then you probably need to backup the old data root too

https://docs.moodle.org/401/en/Moodle_migration#Copy_moodledata_from_the_old_server_to_the_new_server

Russell England
  • 9,436
  • 1
  • 27
  • 41
0

Thanks all for your help! And now I changed as

  1. $CFG->dataroot ='/data/www/example.com/moodledata'; then
  2. I moved moodledata from httpdocs to home-directory and it worked correctly.
itom dire
  • 1
  • 1