Web Server Settings
General Web Server Settings
Firstly, make sure that your web server is set up to use index.php as a default page
(perhaps in addition to index.html, default.htm and so on). In Apache, this is done using a
DirectoryIndex parameter in your httpd.conf file, which might look like this:
DirectoryIndex index.php index.html index.htm
Just make sure index.php is in the list (and preferably towards the start of the list, for
efficiency).
Secondly, if you are using Apache 2, then you should turn on the AcceptPathInfo
variable, which allows scripts to pass arguments like http://server/file.php/arg1/arg2.
This is essential to allow relative links between your resources, and also provides a
performance boost for people using your Moodle web site. You can turn this on by adding
these lines to your httpd.conf file.
AcceptPathInfo on
Thirdly, Moodle requires a number of PHP settings to be active for it to work. On most
servers these will already be the default settings. However, some PHP servers (and some
of the more recent PHP versions) may have things set differently. These are defined in
PHP s configuration file (usually called php.ini):
magic_quotes_gpc = 1 (preferred but not necessary)
magic_quotes_runtime = 0 (necessary)
file_uploads = 1
session.auto_start = 0
session.bug_compat_warn = 0
If you don t have access to httpd.conf or php.ini on your server, or you have Moodle on a
server with other applications that require different settings, then don t worry, you can
often still OVERRIDE the default settings. To do this, you need to create a file
called .htaccess in Moodle s main directory that contains lines like the following.
This only works on Apache servers and only when Overrides have been allowed in the
main configuration.
DirectoryIndex index.php index.html index.htm
AcceptPathInfo on
php_flag magic_quotes_gpc 1
php_flag magic_quotes_runtime 0
php_flag file_uploads 1
php_flag session.auto_start 0
php_flag session.bug_compat_warn 0
You can also do things like define the maximum size for uploaded files:
LimitRequestBody 0
php_value upload_max_filesize 2M
php_value post_max_size 2M
The easiest thing to do is just copy the sample file from lib/htaccess and edit it to suit
your needs. It contains further instructions. For example, in a Unix shell:
cp lib/htaccess .htaccess
55
http://moodle.org