Difference between revisions of "Installation FAQ"

Jump to: navigation, search

Note: You are currently viewing documentation for Moodle 3.2. Up-to-date documentation for the latest stable version of Moodle is probably available here: Installation FAQ.

(Why are all my pages blank?)
m (formatting)
Line 1: Line 1:
This page contains answers to some of the most frequently asked questions by people installing Moodle. If you have followed the instructions in [[Installing_Moodle|installing Moodle]] but you still have a problem, then this page is probably the best place to be.
 
 
If you don't find your answer here try the [http://moodle.org/mod/forum/index.php?id=5 Using Moodle] course on moodle.org. Start by searching the forums using a few keywords, in case your problem has already been discussed. If you don't find anything, then try posting your question into the appropriate forum - somebody will usually be able to help you.
 
 
If you have tried a number of solutions without resolving an issue, and you are running behind a firewall, it may be advisable to try re-configuring your firewall to ensure that it is not blocking a required function or necessary communication. Firewalls very rarely cause problems with Moodle but are occasionally responsible for reduced functionality due to a mis-configuration in the firewall settings.
 
 
 
===Uploaded files give "File not found"===
 
===Uploaded files give "File not found"===
  
:For example: Not Found: The requested URL /moodle/file.php/2/myfile.jpg was not found on this server.
+
For example: Not Found: The requested URL /moodle/file.php/2/myfile.jpg was not found on this server.
  
:Your web server needs to be configured to allow the part of the URL after a script name to be passed directly to the script. This is usually enabled in Apache 1, but is usually disabled by default in Apache 2. To turn it on, add this line to your '''httpd.conf''', or to a '''.htaccess''' file in your local directory (see [[Installing Moodle]] for more details):
+
Your web server needs to be configured to allow the part of the URL after a script name to be passed directly to the script. This is usually enabled in Apache 1, but is usually disabled by default in Apache 2. To turn it on, add this line to your ''httpd.conf'', or to a ''.htaccess'' file in your local directory (see [[Installing Moodle]] for more details):
  
:<pre>'''AcceptPathInfo''' on</pre>
+
'''AcceptPathInfo''' on
  
:Note, this will ONLY work for Apache versions 2.x.
+
Note, this will ONLY work for Apache versions 2.x.
  
:If you are not using Apache 2 and you still have this problem (unlikely) then you can switch Moodle to use an alternative method. The disadvantages are a slight loss of performance for your users and you won't be able to use relative links within HTML resources.
+
If you are not using Apache 2 and you still have this problem (unlikely) then you can switch Moodle to use an alternative method. The disadvantages are a slight loss of performance for your users and you won't be able to use relative links within HTML resources.
  
:To use this alternative method: login as Admin, go into the "Configure Variables" page and change the setting for "'''slasharguments'''". You should now be able to access your uploaded files.
+
To use this alternative method, you should change the ''slasharguments'' variable in the Operating System section of Administration >> Configuration >> [[Admin/config|Variables]]. You should now be able to access your uploaded files.
  
 
===PHP - is it installed and what version do I have?===
 
===PHP - is it installed and what version do I have?===
  
:Make a new file on your web site called info.php, containing the following text, and call it from your browser:
+
Make a new file on your web site called ''info.php'', containing the following text, and call it from your browser:
  
:<pre><?PHP phpinfo() ?></pre>
+
<?PHP phpinfo() ?>
  
:If nothing happens then you don't have PHP installed. See the installation docs for some information about where to download it for your computer.
+
If nothing happens then you don't have PHP installed. See the installation docs for some information about where to download it for your computer.
  
 
===Why are all my pages blank?===
 
===Why are all my pages blank?===
  
Check the dirroot variable in config.php. You must use complete, absolute pathnames e.g.
+
Check the dirroot variable in ''config.php''. You must use complete, absolute pathnames e.g.
  
 
  $CFG->dirroot = "d:\inetpub\sites\www.yoursite.com\web\moodle";
 
  $CFG->dirroot = "d:\inetpub\sites\www.yoursite.com\web\moodle";
  
Another reason might be that PHP has not been configured to support MySQL. This is common on Redhat and OpenBSD installations. In this case, an error is generated, but since error displays are often disabled by default, all that is seen on the browser is a blank screen. To determine if this is
+
Another reason might be that PHP has not been configured to support MySQL. This is common on Redhat and OpenBSD installations. In this case, an error is generated, but since error displays are often disabled by default, all that is seen on the browser is a blank screen. To determine if this is your problem, insert this as the second line in your ''config.php'' file
your problem, insert this as the second line in your config.php file
 
  
 
  phpinfo();
 
  phpinfo();
Line 42: Line 35:
 
===My pages show fatal errors such as : call to undefined function: get_string()===
 
===My pages show fatal errors such as : call to undefined function: get_string()===
  
:If you see errors like:
+
If you see errors like:
  
:<pre>Parse error: parse error, unexpected T_VARIABLE in c:\program files\easyphp\www\moodle\config.php on line 94 Fatal error: Call to undefined function: get_string() in c:\program files\easyphp\www\moodle\mod\resource\lib.php on line 11</pre>
+
Parse error: parse error, unexpected T_VARIABLE in c:\program files\easyphp\www\moodle\config.php on line 94 Fatal error: Call to undefined function: get_string() in c:\program files\easyphp\www\moodle\mod\resource\lib.php on line 11
  
:then it's likely you have left out a semi-colon or ending quote from a line in config.php (previous to line 94).
+
then it's likely you have left out a semi-colon or ending quote from a line in ''config.php'' (previous to line 94).
  
:Another reason could be that you have opened config.php in a program like Word to edit it, and saved it as a HTML web page, instead of a proper text file.
+
Another reason could be that you have opened ''config.php'' in a program like Word to edit it, and saved it as a HTML web page, instead of a proper text file.
  
 
===Why do I keep getting error messages about "headers already sent"?===
 
===Why do I keep getting error messages about "headers already sent"?===
  
:If you see errors like this:
+
If you see errors like this:
  
:<pre>Warning: Cannot add header information - headers already sent by (output started at /webs/moodle/config.php:87) in /webs/moodle/lib/moodlelib.php on line 1322 Warning: Cannot add header information - headers already sent by (output started at /webs/moodle/config.php:87) in /webs/moodle/lib/moodlelib.php on line 1323 Warning: Cannot add header information - headers already sent by (output started at /webs/moodle/config.php:87) in /webs/moodle/login/index.php on line 54</pre>
+
Warning: Cannot add header information - headers already sent by (output started at /webs/moodle/config.php:87) in /webs/moodle/lib/moodlelib.php on line 1322 Warning: Cannot add header information - headers already sent by (output started at /webs/moodle/config.php:87) in /webs/moodle/lib/moodlelib.php on line 1323 Warning: Cannot add header information - headers already sent by (output started at /webs/moodle/config.php:87) in /webs/moodle/login/index.php on line 54
  
:you have blank lines or spaces after the final ?> in your config.php file. Sometimes text editors add these - for example Notepad on Windows - so you may have to try a different text editor to remove these spaces or blank lines completely.
+
you have blank lines or spaces after the final <code>?></code> in your ''config.php'' file. Sometimes text editors add these - for example Notepad on Windows - so you may have to try a different text editor to remove these spaces or blank lines completely.
  
 
===I keep getting this error: Failed opening required '/web/moodle/lib/setup.php'===
 
===I keep getting this error: Failed opening required '/web/moodle/lib/setup.php'===
  
:In your config.php, the setting that you use for the dirroot variable must be the '''complete path from the root of your server's hard drive'''.
+
In your ''config.php'', the setting that you use for the dirroot variable must be the complete path from the root of your server's hard drive.
  
:Sometimes people only use the path from their home directory, or relative to the root of the web server directory.
+
Sometimes people only use the path from their home directory, or relative to the root of the web server directory.
  
 
===Any text I add with an apostrophe (') or a quote (") causes errors or comes up with a slash added===
 
===Any text I add with an apostrophe (') or a quote (") causes errors or comes up with a slash added===
  
:Problems caused by apostrophes are caused by incorrect "magic quotes" settings. Moodle requires the following settings (which are usually the default):
+
Problems caused by apostrophes are caused by incorrect "magic quotes" settings. Moodle requires the following settings (which are usually the default):
  
:<pre>magic_quotes_gpc = On</pre>
+
magic_quotes_gpc = On
:<pre>magic_quotes_runtime = Off</pre>
+
magic_quotes_runtime = Off
  
:Please see [[Installing Moodle]] for more details.
+
Please see [[Installing Moodle]] for more details.
  
 
===I keep getting error messages about session_start===
 
===I keep getting error messages about session_start===
  
:If you see errors like this:
+
If you see errors like this:
  
:<pre>Warning: session_start() [function.session-start]: open(/tmp\sess_d40f380d37d431fc1516e9a895ad9ce0, O_RDWR) failed: No such file or directory (2) in G:\web\moodle\lib\setup.php on line 123</pre>
+
Warning: session_start() [function.session-start]: open(/tmp\sess_d40f380d37d431fc1516e9a895ad9ce0, O_RDWR) failed: No such file or directory (2) in G:\web\moodle\lib\setup.php on line 123
:<pre>Warning: session_start() [function.session-start]: open(/tmp\sess_d40f380d37d431fc1516e9a895ad9ce0, O_RDWR) failed: No such file or directory (2) in G:\web\moodle\lib\setup.php on line 123</pre>
+
Warning: session_start() [function.session-start]: open(/tmp\sess_d40f380d37d431fc1516e9a895ad9ce0, O_RDWR) failed: No such file or directory (2) in G:\web\moodle\lib\setup.php on line 123
:<pre>Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at G:\web\moodle\lib\setup.php:1) in G:\web\moodle\lib\setup.php on line 123</pre>
+
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at G:\web\moodle\lib\setup.php:1) in G:\web\moodle\lib\setup.php on line 123
  
:these are all related to the fact that PHP is failing to save "session" files on your hard disk (in a directory called /tmp). Usually the reason is that you don't HAVE a directory called /tmp on your computer. This is usually the case with Windows installations.
+
these are all related to the fact that PHP is failing to save "session" files on your hard disk (in a directory called /tmp). Usually the reason is that you don't HAVE a directory called /tmp on your computer. This is usually the case with Windows installations.
  
:The solution is to fix the PHP setting for this path to point to a real directory. You can do this in your php.ini file:
+
The solution is to fix the PHP setting for this path to point to a real directory. You can do this in your ''php.ini'' file:
  
:<pre>session.save_path = C:\temp</pre>
+
session.save_path = C:\temp
  
:or otherwise in a .htaccess file in your main moodle directory:
+
or otherwise in a ''.htaccess'' file in your main moodle directory:
  
:<pre>php_value session.save_path "/home/moodle/sessions"</pre>
+
php_value session.save_path "/home/moodle/sessions"
  
 
===When I go to the admin page, I get told to make dirroot blank!===
 
===When I go to the admin page, I get told to make dirroot blank!===
  
:If you see errors like this:
+
If you see errors like this:
  
:<pre>Please fix your settings in config.php: You have: $CFG->dirroot = "/home/users/fred/public_html/moodle"; but it should be: $CFG->dirroot = "";</pre>
+
Please fix your settings in config.php: You have: $CFG->dirroot = "/home/users/fred/public_html/moodle"; but it should be: $CFG->dirroot = "";
  
:then you have encountered a small bug that occurs on some servers. The problem is with the error-checking mechanism, not with your actual path. To fix it, find this line (line 66) in the file admin/index.php:
+
then you have encountered a small bug that occurs on some servers. The problem is with the error-checking mechanism, not with your actual path. To fix it, find this line (line 66) in the file ''admin/index.php'':
  
:<pre>if ($dirroot != $CFG->dirroot) {</pre>
+
if ($dirroot != $CFG->dirroot) {
  
:and change it to this:
+
and change it to this:
  
:<pre>if (!empty($dirroot) and $dirroot != $CFG->dirroot) {</pre>
+
if (!empty($dirroot) and $dirroot != $CFG->dirroot) {
  
 
===I login but the login link doesn't change. I am logged in and can navigate freely.===
 
===I login but the login link doesn't change. I am logged in and can navigate freely.===
  
:Make sure the URL in your $CFG->wwwroot setting is exactly the same as the one you are actually using to access the site.
+
Make sure the URL in your <code>$CFG->wwwroot</code> setting is exactly the same as the one you are actually using to access the site.
 
 
===When trying to add a resource I receive error messages.===
 
 
 
:Assuming you are using Apache, then it's quite likely that your setting in config.php for $CFG->wwwroot is different from the actual URL you are using to access the site. Also try turning off "'''secureforms'''" in the admin settings.
 
  
===I can't log in - I just stay stuck on the login screen.===
+
===When trying to add a resource I receive error messages===
  
:The most common cause for this is that your own computer (not your Moodle server) has a firewall that is stripping referrer information from the browser. Here are some instructions for fixing [http://service1.symantec.com/SUPPORT/nip.nsf/46f26a2d6dafb0a788256bc7005c3fa3/b9b47ad7eddd343b88256c6b006a85a8?OpenDocument&src=bar_sch_nam Norton firewall products].
+
Assuming you are using Apache, then it's quite likely that your setting in ''config.php'' for <code>$CFG->wwwroot</code> is different from the actual URL you are using to access the site. Also try turning off the ''secureforms'' variable in the security section of Administration >> Configuration >> [[Admin/config|Variables]].
  
:The server admin can also fix this for everyone by editing the Moodle configuration page and changing the variable "'''secureforms'''" to "No".
+
===I can't log in - I just stay stuck on the login screen===
  
:Another possible cause of this problem is that sessions are not configured properly on the server. You can test this by calling the script <nowiki>http://yourserver/moodle/lib/session-test.php</nowiki>.
+
The most common cause for this is that your own computer (not your Moodle server) has a firewall that is stripping referrer information from the browser. Here are some instructions for fixing [http://service1.symantec.com/SUPPORT/nip.nsf/46f26a2d6dafb0a788256bc7005c3fa3/b9b47ad7eddd343b88256c6b006a85a8?OpenDocument&src=bar_sch_nam Norton firewall products].
  
 +
The server admin can also fix this for everyone by changing the ''secureforms'' variable to 'No' in the security section of Administration >> Configuration >> [[Admin/config|Variables]].
  
 +
Another possible cause of this problem is that sessions are not configured properly on the server. You can test this by calling the script <nowiki>http://yourserver/moodle/lib/session-test.php</nowiki>.
  
 
===Why doesn't my Moodle site display the time and date correctly?===
 
===Why doesn't my Moodle site display the time and date correctly?===
  
:Each language requires a specific language code (called a '''locale''' code) to allow dates to be displayed correctly. The language packs contain default standard codes, but sometimes these don't work on Windows servers.
+
Each language requires a specific language code (called a '''locale''' code) to allow dates to be displayed correctly. The language packs contain default standard codes, but sometimes these don't work on Windows servers.
  
:You can find the correct locale codes for Windows on these two pages: [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_crt_language_strings.asp Language codes] and [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_crt_country_strings.asp Country/region] codes.(eg "esp_esp" for spanish)
+
You can find the correct locale codes for Windows on these two pages: [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_crt_language_strings.asp Language codes] and [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_crt_country_strings.asp Country/region] codes (e.g. "esp_esp" for spanish)
  
:These new locale codes can be entered on the Admin -> Configure -> Variables page, where they override the ones in the currently chosen language pack.
+
These new locale codes can be entered on the Administration >> Configuration >> [[Admin/config|Variables]] page, where they override the ones in the currently chosen language pack.
  
 
===Email copies are not being sent from my forums===
 
===Email copies are not being sent from my forums===
  
You '''must''' set up cron properly if you want Moodle to send out automatic email from forums, assignments etc. This same process also performs a number of clean-up tasks such as deleting old unconfirmed users, unenrolling old students and so on.
+
You ''must'' set up cron properly if you want Moodle to send out automatic email from forums, assignments etc. This same process also performs a number of clean-up tasks such as deleting old unconfirmed users, unenrolling old students and so on.
  
Basically, you need to set up a process to regularly call the script <code><nowiki>http://yoursite/admin/cron.php</nowiki></code>. Please see [[Installing_Moodle#Set_up_cron | Installing Moodle set up cron]].
+
Basically, you need to set up a process to regularly call the script <code><nowiki>http://yoursite/admin/cron.php</nowiki></code>. Please see [[Installing_Moodle#Set_up_cron|Installing Moodle set up cron]].
  
 
'''Tip:''' Try the default setting in Moodle variables page. Leave the smtphost blank. This will be acceptable for the majority of users.
 
'''Tip:''' Try the default setting in Moodle variables page. Leave the smtphost blank. This will be acceptable for the majority of users.
  
==See also==
 
*[[Installing Moodle]]
 
*[[Installing Apache, MySQL and PHP]]
 
*[[Upgrading Moodle]]
 
*[[Step by Step Installation Guide for Windows]]
 
*[[Step by Step Installation Guide for RedHat]]
 
*[[Step by Step Installation Guide for Debian GNU/Linux]]
 
 
[[Category:Administrator]]
 
[[Category:Administrator]]
 
[[Category:FAQ]]
 
[[Category:FAQ]]
 
[[Category:Installation]]
 
[[Category:Installation]]

Revision as of 08:13, 30 December 2005

Uploaded files give "File not found"

For example: Not Found: The requested URL /moodle/file.php/2/myfile.jpg was not found on this server.

Your web server needs to be configured to allow the part of the URL after a script name to be passed directly to the script. This is usually enabled in Apache 1, but is usually disabled by default in Apache 2. To turn it on, add this line to your httpd.conf, or to a .htaccess file in your local directory (see Installing Moodle for more details):

AcceptPathInfo on

Note, this will ONLY work for Apache versions 2.x.

If you are not using Apache 2 and you still have this problem (unlikely) then you can switch Moodle to use an alternative method. The disadvantages are a slight loss of performance for your users and you won't be able to use relative links within HTML resources.

To use this alternative method, you should change the slasharguments variable in the Operating System section of Administration >> Configuration >> Variables. You should now be able to access your uploaded files.

PHP - is it installed and what version do I have?

Make a new file on your web site called info.php, containing the following text, and call it from your browser:

<?PHP phpinfo() ?>

If nothing happens then you don't have PHP installed. See the installation docs for some information about where to download it for your computer.

Why are all my pages blank?

Check the dirroot variable in config.php. You must use complete, absolute pathnames e.g.

$CFG->dirroot = "d:\inetpub\sites\www.yoursite.com\web\moodle";

Another reason might be that PHP has not been configured to support MySQL. This is common on Redhat and OpenBSD installations. In this case, an error is generated, but since error displays are often disabled by default, all that is seen on the browser is a blank screen. To determine if this is your problem, insert this as the second line in your config.php file

phpinfo();

then reload the web page. Examine the output closely to see if MySQL is supported. If not look for a package you are missing.

My pages show fatal errors such as : call to undefined function: get_string()

If you see errors like:

Parse error: parse error, unexpected T_VARIABLE in c:\program files\easyphp\www\moodle\config.php on line 94 Fatal error: Call to undefined function: get_string() in c:\program files\easyphp\www\moodle\mod\resource\lib.php on line 11

then it's likely you have left out a semi-colon or ending quote from a line in config.php (previous to line 94).

Another reason could be that you have opened config.php in a program like Word to edit it, and saved it as a HTML web page, instead of a proper text file.

Why do I keep getting error messages about "headers already sent"?

If you see errors like this:

Warning: Cannot add header information - headers already sent by (output started at /webs/moodle/config.php:87) in /webs/moodle/lib/moodlelib.php on line 1322 Warning: Cannot add header information - headers already sent by (output started at /webs/moodle/config.php:87) in /webs/moodle/lib/moodlelib.php on line 1323 Warning: Cannot add header information - headers already sent by (output started at /webs/moodle/config.php:87) in /webs/moodle/login/index.php on line 54
you have blank lines or spaces after the final
?>
in your config.php file. Sometimes text editors add these - for example Notepad on Windows - so you may have to try a different text editor to remove these spaces or blank lines completely.

I keep getting this error: Failed opening required '/web/moodle/lib/setup.php'

In your config.php, the setting that you use for the dirroot variable must be the complete path from the root of your server's hard drive.

Sometimes people only use the path from their home directory, or relative to the root of the web server directory.

Any text I add with an apostrophe (') or a quote (") causes errors or comes up with a slash added

Problems caused by apostrophes are caused by incorrect "magic quotes" settings. Moodle requires the following settings (which are usually the default):

magic_quotes_gpc = On
magic_quotes_runtime = Off

Please see Installing Moodle for more details.

I keep getting error messages about session_start

If you see errors like this:

Warning: session_start() [function.session-start]: open(/tmp\sess_d40f380d37d431fc1516e9a895ad9ce0, O_RDWR) failed: No such file or directory (2) in G:\web\moodle\lib\setup.php on line 123
Warning: session_start() [function.session-start]: open(/tmp\sess_d40f380d37d431fc1516e9a895ad9ce0, O_RDWR) failed: No such file or directory (2) in G:\web\moodle\lib\setup.php on line 123
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at G:\web\moodle\lib\setup.php:1) in G:\web\moodle\lib\setup.php on line 123

these are all related to the fact that PHP is failing to save "session" files on your hard disk (in a directory called /tmp). Usually the reason is that you don't HAVE a directory called /tmp on your computer. This is usually the case with Windows installations.

The solution is to fix the PHP setting for this path to point to a real directory. You can do this in your php.ini file:

session.save_path = C:\temp

or otherwise in a .htaccess file in your main moodle directory:

php_value session.save_path "/home/moodle/sessions"

When I go to the admin page, I get told to make dirroot blank!

If you see errors like this:

Please fix your settings in config.php: You have: $CFG->dirroot = "/home/users/fred/public_html/moodle"; but it should be: $CFG->dirroot = "";

then you have encountered a small bug that occurs on some servers. The problem is with the error-checking mechanism, not with your actual path. To fix it, find this line (line 66) in the file admin/index.php:

if ($dirroot != $CFG->dirroot) {

and change it to this:

if (!empty($dirroot) and $dirroot != $CFG->dirroot) {

I login but the login link doesn't change. I am logged in and can navigate freely.

Make sure the URL in your
$CFG->wwwroot
setting is exactly the same as the one you are actually using to access the site.

When trying to add a resource I receive error messages

Assuming you are using Apache, then it's quite likely that your setting in config.php for
$CFG->wwwroot
is different from the actual URL you are using to access the site. Also try turning off the secureforms variable in the security section of Administration >> Configuration >> Variables.

I can't log in - I just stay stuck on the login screen

The most common cause for this is that your own computer (not your Moodle server) has a firewall that is stripping referrer information from the browser. Here are some instructions for fixing Norton firewall products.

The server admin can also fix this for everyone by changing the secureforms variable to 'No' in the security section of Administration >> Configuration >> Variables.

Another possible cause of this problem is that sessions are not configured properly on the server. You can test this by calling the script http://yourserver/moodle/lib/session-test.php.

Why doesn't my Moodle site display the time and date correctly?

Each language requires a specific language code (called a locale code) to allow dates to be displayed correctly. The language packs contain default standard codes, but sometimes these don't work on Windows servers.

You can find the correct locale codes for Windows on these two pages: Language codes and Country/region codes (e.g. "esp_esp" for spanish)

These new locale codes can be entered on the Administration >> Configuration >> Variables page, where they override the ones in the currently chosen language pack.

Email copies are not being sent from my forums

You must set up cron properly if you want Moodle to send out automatic email from forums, assignments etc. This same process also performs a number of clean-up tasks such as deleting old unconfirmed users, unenrolling old students and so on.

Basically, you need to set up a process to regularly call the script
http://yoursite/admin/cron.php
. Please see Installing Moodle set up cron.

Tip: Try the default setting in Moodle variables page. Leave the smtphost blank. This will be acceptable for the majority of users.