Jump to content

Recommended Posts

Posted

Hi All,

 

In the process of setting up Moodle on Ubuntu 14.04 however when running the ldap sync I get the following error:

 

PHP Deprecated: Comments starting with '#' are deprecated in /etc/php5/cli/conf.d/05-opcache.ini on line 3 in Unknown on line 0

PHP Notice: Undefined index: HTTP_HOST in /var/www/html/moodle/config.php on line 20

!!! Detected incorrect $CFG->wwwroot in config.php, it must not contain trailing slash.

Please notify server administrator. !!!

 

I currently have the moodle wwwroot set to:

$CFG->wwwroot = 'https://' . $_SERVER["HTTP_HOST"] . '';

 

As recommended here:

http://www.edugeek.net/forums/virtual-learning-platforms/68681-moodle-two-ip-addresses-lan-internet-3.html

 

However if change it back to the original the LDAP script works fine.

$CFG->wwwroot = 'https://IP_ADDRESS';

 

How do I get Moodle accessible on the LAN and WAN and have LDAP working ?

 

Thanks

Posted

Hi Kamran,

I'm not sure what your trying to do, but the trailing . " of the line below is what is throwing a syntax error.

$CFG->wwwroot = 'https://' . $_SERVER["HTTP_HOST"] . '';

Should probably be:

$CFG->wwwroot = 'https://' . $_SERVER["HTTP_HOST"];

Posted

Hi Jona,

 

Your correct. have changed it but still get the same error.

 

PHP Deprecated: Comments starting with '#' are deprecated in /etc/php5/cli/conf.d/05-opcache.ini on line 3 in Unknown on line 0

PHP Notice: Undefined index: HTTP_HOST in /var/www/html/moodle/config.php on line 20

!!! Detected incorrect $CFG->wwwroot in config.php, it must not contain trailing slash.

Please notify server administrator. !!!

 

For some reason it thinks it has a trailing slash ???

Posted

The problem is that your second error (the one mentioning line 20) is saying that $_SERVER["HTTP_HOST"] is undefined and therefore is evaulating to blank, hence the trailing slash is actually the leading slash of your https://

 

According to: PHP: $_SERVER - Manual HTTP_HOST may not be set:

'HTTP_HOST'

Contents of the Host: header from the current request, if there is one.

 

You might want to try using $_SERVER['SERVER_NAME'] instead.

 

Jona

Posted

I remember reading on the Moodle forum somewhere that you should set the config.php to be your url you access Moodle through because various components depend on it. There was also something I think that said the cli script wouldn't correctly evaulte $_SERVER and so won't run correctly.

 

https://moodle.org/mod/forum/discuss.php?d=265453

 

Might not be directly related to your problem though...

Posted

Tried 'SERVER_NAME' however ldap sync still didn't work.

 

Looks like your correct. If you want to use Moodle server from Internet, use real DNS hostname in $CFG->wwwroot. so have chnaged it to the internet dns name and it all works know.

 

For the internal access problem looks like "Masquerading" will be the best option:

 

http://docs.moodle.org/en/Masquerading

 

Thanks for your help :)

  • 4 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...