Config.Php Setting Error

Config.Php Setting Error

by ümit demir -
Number of replies: 12

Hello,

I have uploaded my moodle local website to my hosting.

I have imported moodle database with same name.

I set moodledata directory with 777 permissons.

I had the error below.

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

to fix the error I made changes in config.php file

$CFG->wwwroot   = 'http://www.uzakademi.org';

$CFG->dataroot  = '/home/neduzaka/moodledata';

$CFG->admin     = 'admin';


$CFG->directorypermissions = 0777;


But now I have "http 500" error. Thank you all for response.


Ümit DEMİR


Average of ratings: -
In reply to ümit demir

Re: Config.Php Setting Error

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Find the 500 error in your web server's error log? What does it say?


You may need to enable Debugging which you will need to do by copying (and uncommenting) the relevant lines from section 7 of config-dist.php into your config.php. It is very well commented. 

If that still doesn't show anything, then it may simply be a typo in your config.php as that's what you touched last. Unfortunately, Error 500 tells you absolutely nothing so we need to get more information. 

In reply to Howard Miller

Ynt: Re: Config.Php Setting Error

by ümit demir -

Thanks a lot for your response. I copied section 7 lines but I got same error.

Error log is below

"PHP Parse error:  syntax error, unexpected '', array('' (T_CONSTANT_ENCAPSED_STRING) in /home/neduzaka/public_html/lib/moodlelib.php on line 3222"

The code in that line is

line 3221: if ($pref = $DB->get_record('user_preferences', array('userid' => $user->id, 'name' => 'email_bounce_count'))) {  

line 3222: $pref->value = (!empty($reset)) ? 0 : $pref->value+1;


Ümit DEMİR

In reply to ümit demir

Re: Ynt: Re: Config.Php Setting Error

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

Before we go any further.... 

- which version of Moodle?

- which version of PHP?

In reply to Howard Miller

Ynt: Re: Ynt: Re: Config.Php Setting Error

by ümit demir -


Moodle version: 3.1

PHP: 5.4

In reply to ümit demir

Re: Ynt: Re: Ynt: Re: Config.Php Setting Error

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

PHP has to be newer than 5.4.4 although you should probably be using 5.6.x as 5.4 is no longer supported and 5.5 is on the way to not being. 

Other than that, I'm struggling to see what might be wrong here. 

In reply to ümit demir

Re: Ynt: Re: Ynt: Re: Config.Php Setting Error

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

If php version is not high enough, I have seen it throw config.php errors.  If you are also getting a white screen, I would suspect that is the problem.  Upgrade your php version and then try again.

In reply to Emma Richardson

Ynt: Re: Ynt: Re: Ynt: Re: Config.Php Setting Error

by ümit demir -

Thanks a lot for your responses. I will contact with my hosting.


Ümit DEMİR

In reply to ümit demir

Re: Config.Php Setting Error

by Ken Task -
Picture of Particularly helpful Moodlers

Attempting to access site I see nothing ... 'white screen of death'.   While you have set permissions at 0777 etc. what about ownership of files?   Local to what type of hosting?   Shared?    Check config.php file ... it must be readable by all.   The issue with moodledata happens to be where it's located.   If on a shared host that  doesn't allow web service access outside of a public_html directory contained in your user space (/home/neduzaka) you might have to place moodledata inside public_html and then put an .htaccess file that allows no visitor to browse that directory.

The .htaccess file would have:

deny from all
AllowOverride None

in it.

'spirit of sharing', Ken

In reply to Ken Task

Ynt: Re: Config.Php Setting Error

by ümit demir -

I made changes in config.php and copied directory

$CFG->dataroot  = '/home/neduzaka/public_html/moodledata';


I set htaccess file. But nothing changed. I will try to change my hosting php version.


Thanks a lot.


Ümit DEMİR

In reply to ümit demir

Re: Ynt: Re: Config.Php Setting Error

by Ken Task -
Picture of Particularly helpful Moodlers

Seems I might not have explained very well ... there are probably few folks in these forums that host a Moodle where you host yours.   Hosting providers are NOT all the same, but they generally don't leave 'wiggle room' for placement of a moodledata directory in an apache web service readable directory.   The public_html was a guess.   Do you have a public_html directory and is that where your Moodle code is located?

Does your hosting provider allow .htaccess files?   Those types of files should not require rstart of apache service but ...

Is the hosting server running some other sort of protections like suPHP or seLinux that might be involved with your issue?

'spirit of sharing', Ken

In reply to Ken Task

Ynt: Re: Ynt: Re: Config.Php Setting Error

by ümit demir -

Hello,


I have changed my php version to 5.5. I started to install in my domain. But now I can not pass the database selection screen. There is no Next Button to pass the screen. Screenshot is in attach.

I created moodledata directory in root and empty moodle database in host.


Ümit DEMİR

Attachment database.png
In reply to ümit demir

Re: Ynt: Re: Ynt: Re: Config.Php Setting Error

by Ken Task -
Picture of Particularly helpful Moodlers

Docs at Moodle:
https://docs.moodle.org/31/en/Unix_or_Linux_Installation
don't cover LiteSpeed.   Nothing wrong with your choice of web server, but
it does mean one has to learn the "antidote" to the "poison" chosen.

For LiteSpeed, suggest your best resource for configuration/running are at:
https://www.litespeedtech.com/products/litespeed-web-server/overview
https://www.litespeedtech.com/docs/webserver/
There is a LiteSpeed forum Install/Confiuration
https://www.litespeedtech.com/support/forum/forums/install-configuration.11/
that might be your best source for setting up web server.

Strongly suggest that the current location of moodledata directory
is NOT a good one in /root

Would suggest a directory to which LiteSpeed may already have access.

Won't give guessing examples as it appears you will attempt those without
really knowing.  Since the initial pages for installing Moodle are showing
(even though there is an error) it appears that 'document root' and PHP is working.

After reading what I can find on configuration of LiteSpeed, it appears there
might be a virtual host configuration file for the domain you are using.
In that config file there is a path to where the code for Moodle currently
resides.   Suggest putting moodledata along that path and maybe at same level
of the directory where the moodle code resides. ** BUT AGAIN **, refer to
LiteSpeed docs for the *best/most secure* setup.

Someone who host Moodle with LiteSpeed care to step in here and help out?

Since the php script doesn't appear to finish ... missing buttons at bottom, etc. to continue ... php settings might be extremely low ... time for a php script to execute ... OR ... there are some other additions to your operating system (like CentOS's seLinux) ... that might be involved.

Since LiteSpeed could be installed on all flavors of Linux, disclosing what flavor and version of Linux you are running might help others help you.

'spirit of sharing', Ken