Installing Moodle on ISPconfig server.

Discussion in 'Installation/Configuration' started by johnsw16, Oct 31, 2008.

  1. johnsw16

    johnsw16 New Member

    I have moved some moodle installs (v1.5.3+) to a new webserver running ISPConfig. I think it is working in that I can see the site, users, files, etc.

    The next stage was to upgrade (v1.6 -> 1.8 -> 1.9) which I've spent hours today tying to do...the problems I am having with this make me suspect that the main install may also have a problem.

    When upgrading I get permissions error on the moodledata directory ("can't find or create file /var/xxxx/xxx/xxx/"). On other servers I have put moodledata in /var/www/moodledata (777) with the install in /var/www/html/xxxx and this works fine.

    The client area in ISPConfig is, for example, /var/www/web20/ with the website in /var/www/web20/web/. So I've put the moodle install there and the files in /var/www/web20/moodledata. Now there is a problem: whatever permissions I use I get this find/create file error when trying to upgrade. I've tried 777, 707, changing the owner:group to apache:apache, using +s to try to force the ownership to remain with the web20 user, moving the data directory to /var/www/ and /var/www/html/ (i.e outside the clients own area) and even into /srv/ but all to no avail. In each case there are error messages with the moodle unable to create new files and/or directories.

    Has anyone done this and have a definiative set of permissions and locations for this directory under ISPConfig?

    All help gratefully received. Especially as this is the last day of half term and it will be being used on Monday...!
  2. johnsw16

    johnsw16 New Member


    Safe mode was enabled in ISPConfig.

    Just in case it helps - DO NOT check the safe-mode box when configuring a site for a client in ISPConfig as this adds various php settings which stop apache writing to the directory. So, with this unchecked, the upgrade went without a hitch with the original set-up (i.e. /var/www/web20/moodledata with web20_admin:web20 / 777).
  3. nenad

    nenad Member


    can you please describe installation of moodle on ISP running server in more details, step-by-step ?

  4. johnsw16

    johnsw16 New Member

    I must assume you already have an existing ISPConfig controlled server - either you are a client on one or you manage one. If you are a client then the critical thing to find out is whether you are in php safe mode or not. If you are and you cannot change it then I Moodle will not work. You either give up now or ask the administrator to change it for you. All they need to do is make sure than the php safe mode button is NOT checked.

    Of course you also need to be able to create a MySQL database - ISPConfig has its own phpMyAdmin to make this easy to so. As long as the administrator has (a) installed this addition and (b) given you the ability to create a database (or has already created it for you).

    Finally you also need ftp access.

    Assuming that you have all this and the relevant usernames, passwords, etc then you are good to go. I'm doing the following from memory but if all the above works for you then it is just a standard Moodle install. (see the site for details).

    (1) Download the latest moodle install and ftp it to you home directory
    (2) If all you want is a moodle install then you don't need your standard web directory (unless you intend to install moodle inside your site - e.g. mysite/moodle/ - in which case copy and expand the tar file inside the web directory.) so copy it just in case (cp -Rp web web.orig) then expand the tar file and rename it "web".
    (3) Create a database (collation utf-8) in phpMyAdmin or use the one set up for you.
    (4) Go up a level (so you see "web" as one of the directories listed along with cgi, etc) and create a directory for the moodle data (called, for example, "moodledata"!) It is important for security that this directory is out side the normal web directory. This should get the correct permissions but you may need to chmod it to 777 if there are problem - I run my own server and can go into the command line to do this. If you are a client of another administrator this will be a problem but, as I say, as long as apache can read and write to this directory all should be well. (It is this that is not allowed if you are restricted to safe mode).
    (5) Copy the config-dist.php file to config.php
    (6) Edit this file to give you the correct paths - site URL, site path (will probably be something like /var/www/web54/web/), data path (/var/www/web54/moodledata/) and the database details (dbname, host [ localhost]. username, passwd, prefix).
    (7) Then access you site - the scripts will detect this as a new install and if all is well take you through the rest of the install and database creation. If there are settings missing or wrong it will put up quite good error messages.

    Hope this helps and good luck!
  5. nenad

    nenad Member

    Thank you

    In meanwhile, I installed moodle by myself and installation matches procedure which you posted :)

    Thank you, I think it's nice to have this kind of setup instructions reminder here at How To Forge :)
  6. nenad

    nenad Member

    moodledata problem


    I have a very strange problem.
    I have set-up Debian Lenny (perfect install) with ISPConfog 3.
    No problems at all.

    Then I created reseller (client 2) and user under him (client 3).
    Then I downloaded and unpacked all files for Moodle 1.9.7.
    Unpacked it under client 3, set up permissions etc.

    Then I created moodledata directoy, set up permissions etc.
    And then Moodle was unable to procecced wit hinstalation because it was unable to see or write into directry moodledata. Note: moodledata is OUTSIDE of Web directoy. PHP safe mode is OFF.

    So, here it is:

    After some 30 minutes, and after changing ownership (including setting to www-data) and permissions finally I found out that if I point installation to /var/www/clients/client3/web1/tmp (owner: client2, group: web1, permissions: 0777) then installation will go further.

    However, when I try to apply those settings for permissions from tmp directory to my moodledata directory it FAILS! Even if I delete moodledata and create different directory with different name and try to apply settings such as R/W: 0777, Owner web1, group client2 (or client 3) IT FAILS !!!

    What I am doing wrong ???
    Last edited: Apr 5, 2012
  7. nenad

    nenad Member


    I ralised that even if safe mode is OFF there is open_basedir.
    So I added path to the moodledata here:

    open_basedir="/var/www/clients/client3/web1/web/moodledata:/var/www/clients/client3/web1/web:/var/www/clients/client3/web1/tmp: ....... etc"

    Now, the question is:

    1) Did I resolve tha tproblem with proper solution?
    2) Is it going to be permaennt or ISPConfig3 is going to rewrite it sooner or later because of something?
  8. falko

    falko Super Moderator Howtoforge Staff

    You must add the path the the open_basedir field on the Options tab of the website in ISPConfig because otherwise your change will be overwritten.
  9. nenad

    nenad Member

    Moodle + ISPConfig email problem

    Although I set up that server 6 months ago, I haven't really used it until now. I noticed that Moodle is not sending link for registration. So, I wondered if server is able to send emails anyway. Here is log from ISPConfig:

    I tried even to send email as root using mail command, but with no success.
    What baffles me is that the server name is "" - it was, but later I moved it into other network, and renamed it everywhere to ??

    So, please, can someone instruct me where to change this servername to reflect real servername?

    Also, what should I do in order to make email work?

    Moreover, I created one mailbox with user and password, but
    Squiremail at says that user doesn't exist?

    P.S. I installed linux box according to this manual:
  10. till

    till Super Moderator Staff Member ISPConfig Developer

    Please add a DNS A-record for the domain that points to the IP-address of your server in the authoritive dns server of the domain or check the following files for this name and replace it with the new one:


    and restart the server afterwards
  11. nenad

    nenad Member

    I don't see why should I do it?

    New server name is at domain

    Please clarify,

    Thank you

    OK, I found it it, old servername was in /etc/mailname
    Last edited: Oct 15, 2012
  12. till

    till Super Moderator Staff Member ISPConfig Developer

    Please reread my answer, I posted you two options.
  13. nenad

    nenad Member

    I did what you told me, but still no sucess :(

    My domain name is and my server name is (however there is no pointer in A records to

    I created email domain (in ISPConfig) as - should I rename it to ? Also, I created Mailbox on that email domain, but I still can't login ?

    And there is some error in:

  14. till

    till Super Moderator Staff Member ISPConfig Developer

    No. Please remove from email domains in ispconfiug, it causes the email failure you posted above.

    Ok, nd the mssing A-Record is the reason for your first error,Please add it.
  15. nenad

    nenad Member

    OK, I did what you told me, and even renamed server from to (I renamed it everywhere) because I have moodle installation under - just to avoid any confusion between servername and directory name (which will later become subdomain).

    Also, I did what is writen at teh end of manual
    19.2 SquirrelMail

    Rebooted server, deleted and created new mailbox at domain, but I still can't login to nor I can send mail as root using command mail?

    I am confused, what I am doing wrong?

    P.S. When I reload apache it says:
    piks:~# /etc/init.d/apache2 reload
    Reloading web server config: apache2[Mon Oct 15 15:30:22 2012] [warn] NameVirtualHost has no VirtualHosts
  16. till

    till Super Moderator Staff Member ISPConfig Developer

    Which error do you get now in the mail.log file?

    Thas ok and not a error.
  17. nenad

    nenad Member

    Strange enough, looks like there's no error?

    Except this (could be prior to server reboot)
  18. till

    till Super Moderator Staff Member ISPConfig Developer

    The mail output looks fine except of the gmail name resolution issie. Please take a look at the file /etc/resolv.conf and ensure that the nameserver listed there is reachable from your server and working.

    And please check that you enabled maildir as email storage format in ispconfig server settings.
  19. nenad

    nenad Member

    Yes, name server can resolve - I checked both with dig and lynx - I tried with and they do connect (resolve).

    As for
    I can't find where is setting :confused:

    I just have this:
    Last edited: Oct 15, 2012
  20. nenad

    nenad Member

Share This Page