+ Post New Thread
Results 1 to 7 of 7
Virtual Learning Platforms Thread, Moodle LDAP Issue with custom config.php wwwroot in Technical; Hi All, In the process of setting up Moodle on Ubuntu 14.04 however when running the ldap sync I get ...
  1. #1

    Join Date
    Mar 2009
    Location
    Birmingham
    Posts
    77
    Thank Post
    26
    Thanked 8 Times in 8 Posts
    Rep Power
    13

    Moodle LDAP Issue with custom config.php wwwroot

    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-&gt;wwwroot in config.php, it must not contain trailing slash.<br />Please notify server administrator. !!!

    I currently have the moodle wwwroot set to:
    $CFG->wwwroot = 'https://' . $_SERVER["HTTP_HOST"] . '';

    As recommended here:
    Moodle two IP Addresses (LAN & Internet)

    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

  2. #2
    Jona's Avatar
    Join Date
    May 2007
    Location
    Cranleigh
    Posts
    471
    Thank Post
    14
    Thanked 51 Times in 49 Posts
    Rep Power
    24
    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.
    Quote Originally Posted by Kamran7860 View Post
    $CFG->wwwroot = 'https://' . $_SERVER["HTTP_HOST"] . '';
    Should probably be:
    $CFG->wwwroot = 'https://' . $_SERVER["HTTP_HOST"];

  3. #3

    Join Date
    Mar 2009
    Location
    Birmingham
    Posts
    77
    Thank Post
    26
    Thanked 8 Times in 8 Posts
    Rep Power
    13
    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-&gt;wwwroot in config.php, it must not contain trailing slash.<br />Please notify server administrator. !!!

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

  4. #4
    Jona's Avatar
    Join Date
    May 2007
    Location
    Cranleigh
    Posts
    471
    Thank Post
    14
    Thanked 51 Times in 49 Posts
    Rep Power
    24
    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

  5. #5
    Cache's Avatar
    Join Date
    Apr 2008
    Location
    Cumbria
    Posts
    1,261
    Thank Post
    471
    Thanked 181 Times in 178 Posts
    Blog Entries
    3
    Rep Power
    66
    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...

  6. #6

    Join Date
    Mar 2009
    Location
    Birmingham
    Posts
    77
    Thank Post
    26
    Thanked 8 Times in 8 Posts
    Rep Power
    13
    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

  7. #7
    penfold_99's Avatar
    Join Date
    Feb 2008
    Location
    East Sussex
    Posts
    985
    Thank Post
    58
    Thanked 165 Times in 117 Posts
    Rep Power
    68
    For internal access just add a zone record to your DNS which resolves the FQDN to your local IP address.

SHARE:
+ Post New Thread

Similar Threads

  1. Moodle - strange issue with courses!
    By synaesthesia in forum Virtual Learning Platforms
    Replies: 3
    Last Post: 26th November 2013, 10:41 AM
  2. Moodle died - help with PHP/MYSQL needed
    By mattjporter in forum Coding
    Replies: 16
    Last Post: 17th May 2011, 11:53 AM
  3. issue with themes after moodle 2.0 upgrade
    By chevyz71 in forum Virtual Learning Platforms
    Replies: 4
    Last Post: 4th January 2011, 10:26 AM
  4. Getting NTLM SSO to work with Moodle - Apache issue?
    By TheFopp in forum Virtual Learning Platforms
    Replies: 4
    Last Post: 3rd April 2009, 10:17 AM
  5. FreeBSD, PHP, Moodle + LDAP
    By Marci in forum Web Development
    Replies: 4
    Last Post: 25th June 2008, 08:20 AM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •