https://docs.moodle.org/20/en/api.php?action=feedcontributions&user=Kaw&feedformat=atomMoodleDocs - User contributions [en]2024-03-28T23:08:07ZUser contributionsMediaWiki 1.39.6https://docs.moodle.org/20/en/index.php?title=Administrator_documentation&diff=61612Administrator documentation2009-08-15T16:12:33Z<p>Kaw: Undo revision 61549 by Mooletmfam003 (Talk)</p>
<hr />
<div>The purpose of this page is to list useful links by general topics for administrators of a Moodle site.<br />
==Table of Contents==<br />
__TOC__<br />
<br />
== Installation & Upgrading ==<br />
<br />
*[[Installation Quickstart]] for an overview of the installation steps<br />
*[[Installing Moodle]] for detailed installation instructions<br />
*[[Installation FAQ]]<br />
*[[Installing AMP|Options for installing Apache, MySQL and PHP]]<br />
*[[Upgrading|Upgrading Moodle]]<br />
*[[Installing contributed modules or plugins]]<br />
<br />
[[Administrator documentation#Table of Contents|Top]]<br />
<br />
== System-specific Instructions & Packages ==<br />
<br />
===Unix/Linux-based===<br />
* [[SUSE Linux Server 10|Automated Installation Guide for SUSE Linux Enterprise Server 10]] operating system<br />
* [[RedHat Linux installation|Step-by-step Installation Guide for RedHat]] operating system<br />
* [[Debian GNU/Linux installation|Step-by-step Installation Guide for Debian GNU/Linux]] operating system<br />
* [[Step-by-step Install Guide for Ubuntu]]<br />
* [[Step-by-step Install Guide for Ubuntu using apt-get]]<br />
* [[Step-by-step Install Guide for Zenwalk-5.0]]<br />
* [[OLPC XS installation|Step by Step Installation Guide for the One Laptop per Child XS Server (Beta)]]<br />
* [[Step-by-step Install Guide for Solaris 10 with Oracle 10]]<br />
<br />
===Windows===<br />
* [[Windows installation|Windows installations with instructions for Windows NT/2000/2003 servers]]<br />
* [[Windows installation using XAMPP|Windows installation using XAMPP: Apache, MySQL and PHP]]<br />
* [[Development:Windows_Installer_anywhere|MoodleAnywhere]] another Windows installation package<br />
* [[Installing Moodle on Windows Vista]] - how to<br />
<br />
===Mac===<br />
* [[Complete Install Packages for Mac OS X | Complete Install Packages for Mac OS X 10.3/10.4/10.5]]<br />
* [[Step-by-step Guide for Installing Moodle on Mac OS X 10.4 Client|Step by Step Installation on a Mac OS X 10.4 Client using the internal web server]]<br />
* [[Step by Step Installation on a Mac OS X 10.5 Server|Step by step Installation on a Mac OS X 10.5 Server]]<br />
<br />
===Web Hosts===<br />
* [[1and1_MySQL_installation | Installation on '''1and1''' web hosting]]<br />
* [[powweb_MySQL_installation | Step-by-step Installation on '''Powweb''' web hosting]]<br />
<br />
===Database===<br />
* [[Installing Oracle for PHP]]<br />
* [[Installing MSSQL for PHP]]<br />
* [[Installing Postgres for PHP]]<br />
<br />
[[Administrator documentation#Table of Contents|Top]]<br />
<br />
==Security, Performance and Roles==<br />
<br />
*[[Security]] contains important security procedures for a production site<br />
*[[Performance | Performance and optimization]] for ideas on improving the speed of your installation<br />
*[[Manage roles | Managing roles]] For Moodle 1.7 and later.<br />
*[[Reducing spam in Moodle]]<br />
*[[suhosin]] is an advanced protection system for PHP installation. It was designed to protect servers and users from known and unknown flaws in PHP applications and the PHP core.<br />
<br />
[[Administrator documentation#Table of Contents|Top]]<br />
== FAQs ==<br />
<br />
*[[Installation FAQ]]<br />
*[[Beginning Administration FAQ]]<br />
*[[Administration FAQ]]<br />
*[[Backup and restore FAQ]]<br />
*[[Errors FAQ]]<br />
<br />
[[Administrator documentation#Table of Contents|Top]]<br />
<br />
== Configuration Settings ==<br />
*[[Site administration block]] contains configuration setting links<br />
*[[Notification page]] used to update versions<br />
*[[Variables]]<br />
*[[Site settings]]<br />
*[[Themes]]<br />
*[[Language]]<br />
*[[Activity modules administration]]<br />
*[[Blocks administration]]<br />
*[[Filters]]<br />
*[[Backup settings]]<br />
*[[HTML editor settings]]<br />
*[[Calendar settings]]<br />
*[[Maintenance mode]]<br />
<br />
* See also: <br />
**[[Location of admin settings in 1.7|Comparison between configuration settings in Moodle 1.6 & 1.7]]<br />
<br />
[[Administrator documentation#Table of Contents|Top]]<br />
==User Management==<br />
<br />
*[[Authentication]]<br />
*[[Add new user|Add a new user]] - on a site<br />
*[[Upload users]] - from a file to a site, and into existing course and group, some existing user global updates<br />
*[[User_profile_fields]]<br />
*[[Enrolment plugins]]<br />
**[[Flat file]] - enrol existing users in a course<br />
*[[Roles and capabilities|Assigning user a role]] - typical assignments include:<br />
**[[Students|Enrol students in a course]]<br />
**[[Unenrolment]] Student<br />
**[[Courses (administrator)|Assign teachers]] - to a course<br />
**[[Assign creators|Assign course creators]] - in a site<br />
**[[Assign administrators]] - in a site<br />
<br />
[[Administrator documentation#Table of Contents|Top]]<br />
<br />
==Other==<br />
<br />
*[[Courses (administrator)|Courses]] and [[Course formats|course formats]]<br />
*[[Reports (administrator)]] and [[Logs]]<br />
*[[Site files]]<br />
*[[Moodle database|Database]]<br />
*[[Environment]]<br />
*[[Moodle Network]] and Moodle [[Community hub]]<br />
*[[Streaming Media]]<br />
*[[Case studies (administrator)]]<br />
*[[Anti-virus]]<br />
*[[System Monitoring and Server Statistic Software]]<br />
*[[Integrate Moodle, LDAP and SIMS.net]]<br />
*[[How to rebuild context paths]]<br />
*[[Hacking the Moodle 2.0 database transfer script to convert a Moodle 1.9 site]]<br />
*[[Category:ProxyProblems]]<br />
<br />
[[Administrator documentation#Table of Contents|Top]]<br />
<br />
==See also==<br />
<br />
*[[:Category:Administrator | Index of all Administrator-related pages]]<br />
*[[Integrations]]<br />
*[[CVS for Administrators]]<br />
*[[Email processing]]<br />
*[[Search engine optimization]]<br />
*[[Messaging]]<br />
*[[Migration]]<br />
*[[Metacourses]]<br />
*[[Block layout]]<br />
*[[Customizing Moodle]]<br />
*[[Administrator do's and don'ts]]<br />
*[[Using Moodle book]] Chapter 16: Moodle Administration<br />
*[[Administration hacks]]<br />
<br />
[[Administrator documentation#Table of Contents|Top]]<br />
<br />
[[Category: Administrator]]<br />
[[cs:Rukověť správce]]<br />
[[es:Documentación para Administradores]]<br />
[[eu:Kudeatzaileentzako dokumentazioa]]<br />
[[fr:Documentation administrateur]]<br />
[[ja:管理者ドキュメント]]<br />
[[ko:관리자 문서]]<br />
[[nl:Documentatie voor beheerders]]<br />
[[pt:Documentação para administradores]]<br />
[[ru:Администраторам]]<br />
[[sk:Dokumentácia pre správcov]]<br />
[[zh:管理员文档]]<br />
[[pl:Administrator documentation]]<br />
[[fi:Ylläpitäjän opas]]<br />
[[de:Dokumentation für Administratoren]]</div>Kawhttps://docs.moodle.org/20/en/index.php?title=Performance_recommendations&diff=60854Performance recommendations2009-08-03T13:21:33Z<p>Kaw: /* MySQL performance */ InnodB *may* improve performance</p>
<hr />
<div>Location: ''Administration > Server > Performance''<br />
<br />
<br />
Moodle can be made to perform very well, at small usage levels or scaling up to many thousands of users. The factors involved in performance are basically the same as for any PHP-based database-driven system. When trying to optimize your server, try to focus on the factor which will make the most difference to the user. For example, if you have relatively more users browsing than accessing the database, look to improve the webserver performance.<br />
<br />
<br />
==Obtain a baseline benchmark==<br />
<br />
Before attempting any optimization, you should obtain a baseline benchmark of the component of the system you are trying to improve. For Linux try [http://lbs.sourceforge.net/ LBS] and for Windows use the Performance Monitor. Once you have quantitative data about how your system is performing currently, you'll be able to determine if the change you have made as has any real impact.<br />
<br />
The overall aim of adjustments to improve performance is to use RAM (cacheing) and to reduce disk-based activity. It is especially important to try to eliminate swap file usage as much as you can. If your system starts swapping, this is a sign that you need more RAM. <br />
<br />
The '''optimization order preference''' is usually: primary storage (more RAM), secondary storage (faster hard disks/improved hard disk configuration), processor (more and faster).<br />
<br />
==Scalability==<br />
<br />
Moodle's design (with clear separation of application layers) allows for strongly scalable setups. (Please check the list of [[Large installations|large Moodle installations]].)<br />
<br />
Large sites usually separate the web server and database onto separate servers, although for smaller installations this is typically not necessary.<br />
<br />
It is possible to load-balance a Moodle installation, for example by using more than one webserver. The separate webservers should query the same database and refer to the same filestore area, but otherwise the separation of the application layers is complete enough to make this kind of clustering feasible. Similarly, the database could be a cluster of servers (e.g. a MySQL cluster), but this is not an easy task and you should seek expert support, e.g. from a Moodle Partner.<br />
<br />
'''See also''': <br />
*[[Server cluster]]<br />
*[http://moodle.org/mod/forum/discuss.php?d=4801 Scalability] forum discussion.<br />
*[http://moodle.org/mod/forum/discuss.php?d=57202 Moodle clustering] forum discussion.<br />
*[http://moodle.org/mod/forum/discuss.php?d=44470 Software load balancing] forum discussion.<br />
*[http://moodle.org/mod/forum/discuss.php?d=49986 TCP load balancing] forum dicsussion.<br />
<br />
==Hardware configuration==<br />
'''Note''': The fastest and most effective change that you can make to improve performance is to '''increase the amount of RAM on your web server''' - get as much as possible (eg 4GB). Increasing primary memory will reduce the need for processes to swap to disk and will enable your server to handle more users.<br />
* Better performance is gained by obtaining the best '''processor capability''' you can, i.e. dual or dual core processors. A modern BIOS should allow you to enable hyperthreading, but check if this makes a difference to the overall performance of the processors by using a [http://en.wikipedia.org/wiki/Super_PI CPU benchmarking tool].<br />
* If you can afford them, use '''SCSI hard disks''' instead of SATA drives. SATA drives will increase your system's CPU utilization, whereas SCSI drives have their own integrated processors and come into their own when you have multiple drives. If you must have SATA drives, check that your motherboard and the drives themselves support NCQ (Native Command Queuing).<br />
* Purchase hard disks with a '''low seek time'''. This will improve the overall speed of your system, especially when accessing Moodle's reports.<br />
* Size your '''swap file''' correctly. The general advice is to set it to 4 x physical RAM.<br />
* Use a '''RAID disk system'''. Although there are many different RAID configurations you can create, the following generally works best:<br />
** install a hardware RAID controller (if you can)<br />
** the operating system and swap drive on one set of disks configured as RAID-1.<br />
** Moodle, Web server and Database server on another set of disks configured as RAID-5.<br />
* Use '''gigabit ethernet''' for improved latency and throughput. This is especially important when you have your webserver and database server separated out on different hosts.<br />
* Check the settings on your '''network card'''. You may get an improvement in performance by increasing the use of buffers and transmit/receive descriptors (balance this with processor and memory overheads) and off-loading TCP checksum calculation onto the card instead of the OS.<br />
* Read this [http://moodle.org/mod/forum/discuss.php?d=68579 Case Study] on a server stress test with 300 users. <br />
* See this [http://elearning.sgu.ac.jp/doc/PT/ accompanying report] on network traffic and server loads.<br />
* See the [[Moodle.org configuration]]<br />
* Also see this SFSU presentation at Educause (using VMWare): [http://www.educause.edu/Resources/AnOpenSourceLMSforaMissionCrit/162843]<br />
<br />
==Operating System==<br />
* You can use [http://en.wikipedia.org/wiki/Linux Linux](recommended), Unix-based, Windows or Mac OS X for the server '''operating system'''. *nix operating systems generally require less memory than Mac OS X or Windows servers for doing the same task as the server is configured with just a shell interface. Additionally Linux does not have licensing fees attached, but can have a big learning curve if you're used to another operating system. If you have a large number of processors running SMP, you may also want to consider using a highly tuned OS such as [http://en.wikipedia.org/wiki/Solaris_Operating_Environment Solaris].<br />
* Check your own OS and '''vendor specific instructions''' for optimization steps.<br />
** For Linux look at the [http://linuxperf.sourceforge.net/ Linux Performance Team] site. <br />
** For Linux investigate the hdparm command, e.g. hdparm -m16 -d1 can be used to enable read/write on multiple sectors and DMA. Mount disks with the async and noatime options.<br />
** For Windows set the sever to be optimized for network applications (Control Panel, Network Connections, LAN connection, Properties, File & Printer Sharing for Microsoft Networks, Properties, Optimization). You can also search the [http://technet.microsoft.com/ Microsoft TechNet site] for optimization documents.<br />
<br />
==Web server performance==<br />
<br />
Installing [http://www.mozilla.com/en-US/ Firefox] and the [https://addons.mozilla.org/en-US/firefox/addon/1843 firebug] extension will allow you to watch the time it takes for each page component to load. Also, the [https://addons.mozilla.org/en-US/firefox/addon/5369 Yslow] extension will evaluate your page against Yahoo's [http://www.skrenta.com/2007/05/14_rules_for_fast_web_pages_by_1.html 14 rules] ([http://video.yahoo.com/video/play?vid=1040890 video]) for fast loading websites.<br />
<br />
===PHP performance===<br />
* You are strongly recommended to use a '''PHP accelerator''' to ease CPU load, such as [http://pecl.php.net/apc APC], [http://www.php-accelerator.co.uk/ PHPA], [http://trac.lighttpd.net/xcache/ Xcache] or [http://eaccelerator.net/ eAccelerator]. (Take care to choose a PHP accelerator that is known to work well with your version of PHP and note that Turck MMCache is [http://turckmmcache.exeprod.com/TheManifestoEnglish no longer maintained] and can cause failures with PHP 5). <br />
* Improvements in read/write performance can be improved by putting the cached PHP pages on a [[TMPFS]] filesystem - but remember that you'll lose the cache contents when there is a power failure or the server is rebooted.<br />
* Performance of PHP is better when installed as an '''Apache/IIS ISAPI module''' (rather than a CGI).<br />
* Also check the '''memory_limit''' in php.ini, reduce it to 16M for Moodle version earlier than 1.7 ([http://moodle.org/mod/forum/discuss.php?d=39656 See this forum discussion]). For Moodle 1.7 or later, it is recommended that the value of memory_limit should be 40M. As of [http://www.php.net/ChangeLog-5.php PHP 5.2.1] the default value for the memory_limit directive is 128M.<br />
<br />
===Apache performance===<br />
* If you are using Apache on a Windows server, use the build from [http://www.apachelounge.com Apache Lounge] which is reported to have [http://moodle.org/mod/forum/discuss.php?d=93358 performance and stability improvements] compared to the official Apache download. Note that this is an unofficial build, so may not keep up with official releases.<br />
* Set the '''MaxClients''' directive correctly. Use this formula to help (which uses 80% of available memory to leave room for spare):<br />
MaxClients = Total available memory * 80% / Max memory usage of apache process<br />
:Memory usage of apache process is usually 10MB, so a general rule of thumb is to divide your available memory in megabytes by 10 to get the value of MaxClients. To find the max memory usage of apache processes read the value from the shell command:<br />
#ps -ylC httpd --sort:rss<br />
<br />
:If you need to increase the value of '''MaxClients''' beyond 256, you will also need to set the '''ServerLimit''' directive. <br />
<br />
:'''Warning''': Do not be tempted to set the value of MaxClients higher than your available memory as your server will consume more RAM than available and start to swap to disk. <br />
* Consider reducing the '''number of modules''' that Apache loads in the httpd.conf file to the minumum necessary to reduce the memory needed. <br />
* Use the '''latest version of Apache''' - Apache 2 has an improved memory model which reduces memory usage further.<br />
* For Unix/Linux systems, consider lowering '''MaxRequestsPerChild''' in httpd.conf to as low as 20-30 (if you set it any lower the overhead of forking begins to outweigh the benefits). <br />
* For a heavily loaded server, consider setting '''KeepAlive Off''' (do this only if your Moodle pages do not contain links to resources or uploaded images) or lowering the '''KeepAliveTimeout''' to between 2 and 5. The default is 15 (seconds) - the higher the value the more server processes will be kept waiting for possibly idle connections. A more accurate value for KeepAliveTimeout is obtained by observing how long it takes your users to download a page. After altering any of the KeepAlive variables, monitor your CPU utilization as there may be an additional overhead in initiating more worker processes/threads.<br />
* A warning about the previous performance tip. Microsoft Internet Explorer has a (little) known bug that causes seriously problems with SSL-enabled Apache websites. The issue is that if a web server's KeepAlive timeout is set to less than 60 seconds (say to the default of 15 seconds), MSIE can get confused about whether a keep-alive connection is available or not. As a result, any browser POST requests (which always use a keep-alive if available) will fail to reach the server. This is easily reproduced with postings to the Moodle forums. Using MSIE, connect to an ssl-enabled Moodle site. Write a quick forum post, and submit it when the form has been displayed for between 15 seconds and 60 seconds. You will see a browser error message, and your post content will be lost. In some cases, doing this will even crash the Windows TCP stack on the client machine. ''' So, if your site is SSL-enabled, and you use Apache, you should set the KeepAliveTimeout to at least 60 seconds'''.<br />
* As an alternative to using KeepAlive Off, consider setting-up a '''Reverse Proxy server''' infront of the Moodle server to cache HTML files with images. You can then return Apache to using keep-alives on the Moodle server.<br />
* If you do not use a .htaccess file, set the '''AllowOverride''' variable to AllowOverride None to prevent .htaccess lookups.<br />
* Set '''DirectoryIndex''' correctly so as to avoid content-negotiation. Here's an example from a production server:<br />
DirectoryIndex index.php index.html index.htm<br />
* Unless you are doing development work on the server, set '''ExtendedStatus Off''' and disable mod_info as well as mod_status.<br />
* Leave '''HostnameLookups Off''' (as default) to reduce DNS latency.<br />
* Consider reducing the value of '''TimeOut''' to between 30 to 60 (seconds). <br />
* For the '''Options directive''', avoid Options Multiviews as this performs a directory scan. To reduce disk I/O further use<br />
Options -Indexes FollowSymLinks<br />
*'''Caching''' - Apache can be told to make pages load a lot faster by specifying that the browser should cache some various page elements such as images and reuse them from local memory rather than ask for them again every time a page is requested. How to do this varies slightly between OSes but there are two basic steps:<br />
<br />
# Install and enable mod_expires - refer to documentation or man pages<br />
# Add this code to the virtual server config file within the <directory> section for the root directory (or within the .htaccess file if AllowOverrides is On):<br />
<IfModule mod_expires.c><br />
ExpiresActive On<br />
ExpiresDefault "access plus 1 seconds"<br />
ExpiresByType text/html "access plus 1 seconds"<br />
ExpiresByType image/gif "access plus 1 week"<br />
ExpiresByType image/jpeg "access plus 1 week"<br />
ExpiresByType image/png "access plus 1 week"<br />
ExpiresByType text/css "access plus 1 week"<br />
ExpiresByType text/javascript "access plus 1 week"<br />
ExpiresByType application/x-javascript "access plus 1 week"<br />
ExpiresByType text/xml "access plus 1 seconds"<br />
</IfModule><br />
<br />
The effect is to make everything stay in the cache except HTML and XML, which change dynamically. It's possible to gain a several hundred percent decrease in load times this way. Adjust the cache times according to how often your images etc change.<br />
<br />
More info: [http://www.metaskills.net/blog/heuristics/sysadmin/how-to-control-browser-caching-with-apache-2 www.metaskills.net]<br />
<br />
===IIS performance===<br />
All alter this location in the registry:<br />
HKLM\SYSTEM\CurrentControlSet\Services\Inetinfo\Parameters\<br />
* The equivalent to KeepAliveTimeout is '''ListenBackLog''' (IIS - registry location is HKLM\ SYSTEM\ CurrentControlSet\ Services\ Inetinfo\ Parameters). Set this to between 2 to 5.<br />
*Change the '''MemCacheSize''' value to adjust the amount of memory (Mb) that IIS will use for its file cache (50% of available memory by default).<br />
*Change the '''MaxCachedFileSize''' to adjust the maximum size of a file cached in the file cache in bytes. Default is 262,144 (256K).<br />
*Create a new DWORD called '''ObjectCacheTTL''' to change the length of time (in milliseconds) that objects in the cache are held in memory. Default is 30,000 milliseconds (30 seconds).<br />
<br />
===Lighttpd performance===<br />
You can increase web server performance by using the '''light-weight webserver''' [http://www.lighttpd.net/ lighttpd] in combination with PHP in fastCGI-mode. Lighttpd has a lower memory consumption than Apache - typically 10M for each process. See this [[lighttpd | MoodleDocs Lighttpd page]] for configuration and administration links.<br />
<br />
==Database performance==<br />
<br />
Moodle contains a script which will display some key database performance statistics from the [http://phplens.com/lens/adodb/docs-perf.htm ADOdb performance monitor]. Run the script in your browser as in the following example:<br />
<br />
http://www.mymoodle.com/admin/dbperformance.php<br />
<br />
Use the data displayed as a guide to tune and improve the performance of your database server.<br />
<br />
===MySQL performance===<br />
<br />
The following are MySQL specific settings which can be adjusted for better performance in your my.cnf (my.ini in Windows). The file contains a list of settings and their values. To see the current values use these commands<br />
SHOW STATUS;<br />
SHOW VARIABLES; <br />
'''Important''': You must make backups of your database before attempting to change any MySQL server configuration. After any change to the my.cnf, restart mysqld.<br />
<br />
If you are able, the [http://wiki.mysqltuner.com/MySQLTuner MySQLTuner] tool can be run against your MySQL server and will calculate appropriate configuration values for most of the following settings based on your current load, status and variables automatically.<br />
<br />
* Enable the '''query cache''' with <br />
query_cache_type = 1. <br />
For most Moodle installs, set the following:<br />
query_cache_size = 36M <br />
query_cache_min_res_unit = 2K. <br />
The query cache will improve performance if you are doing few updates on the database. <br />
* Set the '''table cache''' correctly. For Moodle 1.6 set <br />
table_cache = 256 #(table_open_cache in MySQL > 5.1.2)<br />
(min), and for Moodle 1.7 set <br />
table_cache = 512 #(table_open_cache in MySQL > 5.1.2)<br />
(min). The table cache is used by all threads (connections), so monitor the value of opened_tables to further adjust - if opened_tables > 3 * table_cache(table_open_cache in MySQL > 5.1.2) then increase table_cache upto your OS limit. Note also that the figure for table_cache will also change depending on the number of modules and plugins you have installed. Find the number for your server by executing the mysql statement below. Look at the number returned and set table_cache to this value.<br />
mysql>SELECT COUNT(table_name) FROM information_schema.tables WHERE table_schema='yourmoodledbname';<br />
* Set the '''thread cache''' correctly. Adjust the value so that your thread cache utilization is as close to 100% as possible by this formula:<br />
thread cache utilization (%) = (threads_created / connections) * 100<br />
* The '''key buffer''' can improve the access speed to Moodle's SELECT queries. The correct size depends on the size of the index files (.myi) and in Moodle 1.6 or later (without any additional modules and plugins), the recommendation for this value is key_buffer_size = 32M. Ideally you want the database to be reading once from the disk for every 100 requests so monitor that the value is suitable for your install by adjusting the value of key_buffer_size so that the following formulas are true:<br />
key_read / key_read_requests < 0.01<br />
key_write / key_write_requests <= 1.0<br />
* Set the '''maximum number of connections''' so that your users will not see a "Too many connections" message. Be careful that this may have an impact on the total memory used. MySQL connections usually last for milliseconds, so it is unusual even for a heavily loaded server for this value to be over 200.<br />
* Manage '''high burst activity'''. If your Moodle install uses a lot of quizzes and you are experiencing performance problems (check by monitoring the value of threads_connected - it should not be rising) consider increasing the value of back_log.<br />
* '''Optimize your tables weekly and after upgrading Moodle'''. It is good practice to also optimize your tables after performing a large data deletion exercise, e.g. at the end of your semester or academic year. This will ensure that index files are up to date. Backup your database first and then use:<br />
mysql>CHECK TABLE mdl_tablename;<br />
mysql>OPTIMIZE TABLE mdl_tablename;<br />
:The common tables in Moodle to check are mdl_course_sections, mdl_forum_posts, mdl_log and mdl_sessions (if using dbsessions). Any errors need to be corrected using REPAIR TABLE (see the [http://dev.mysql.com/doc/refman/5.0/en/repair-table.html MySQL manual] and this [http://moodle.org/mod/forum/discuss.php?d=58208#p279638 forum script]).<br />
* '''Maintain the key distribution'''. Every month or so it is a good idea to stop the mysql server and run these myisamchk commands.<br />
#myisamchk -a -S /pathtomysql/data/moodledir/*.MYI<br />
:'''Warning''': You must stop the mysql database process (mysqld) before running any myisamchk command. If you do not, you risk data loss.<br />
* Reduce the number of '''temporary tables saved to disk'''. Check this with the created_tmp_disk_tables value. If this is relatively large (>5%) increase tmp_table_size until you see a reduction. Note that this will have an impact on RAM usage.<br />
* Moodle's tables are in the MyISAM format, so '''turn InnoDB off''' if you feel there is no performance gain. Add <code>skip-innodb</code> to your <code>my.cnf</code> file. If you must use InnoDB, you'll have to convert all of Moodle's tables. To do this run the innodb script:<br />
<br />
http://www.mymoodle.com/admin/innodb.php<br />
<br />
:See also [http://moodle.org/mod/forum/discuss.php?d=12961 this forum discussion] which looks at the MyISAM vs InnoDB options.<br />
<br />
===PostgreSQL performance===<br />
<br />
There are some good papers around on tuning PostgreSQL, and Moodle's case does not seem to be different to the general case.<br />
<br />
The first thing to recognise is that if you really need to worry about tuning you should be using a separate machine for the database server. If you are not using a separate machine then the answers to many performance questions are substantially muddied by the memory requirements of the rest of the application.<br />
<br />
You should probably '''enable autovacuum''', unless you know what you are doing. Many e-learning sites have predictable periods of low use, so disabling autovacuum and running a specific vacuum at those times can be a good option. Or perhaps leave autovacuum running but do a full vacuum weekly in a quiet period.<br />
<br />
Set '''shared_buffers''' to something reasonable. For versions up to 8.1 my testing has shown that peak performance is almost always obtained with buffers < 10000, so if you are using such a version, and have more than 512M of RAM just set shared_buffers to 10,000 (8MB).<br />
<br />
The buffer management had a big overhaul in 8.2 and "reasonable" is now a much larger number. I have not conducted performance tests with 8.2, but the recommendations from others are generally that you should now scale shared_buffers much more with memory and may continue to reap benefits even up to values like 100,000 (80MB). Consider using 1-2% of system RAM.<br />
<br />
PostgreSQL will also assume that the operating system is caching its files, so setting '''effective_cache_size''' to a reasonable value is also a good idea. A reasonable value will usually be (total RAM - RAM in use by programs). If you are running Linux and leave the system running for a day or two you can look at 'free' and under the 'cached' column you will see what it currently is. Consider taking that number (which is kB) and dividing it by 10 (i.e. allow 20% for other programs cache needs and then divide by 8 to get pages). If you are not using a dedicated database server you will need to decrease that value to account for usage by other programs.<br />
<br />
Some other useful parameters that can have positive effects, and the values I would typically set them to on a machine with 4G RAM, are:<br />
<br />
work_mem = 10240<br />
<br />
That's 10M of RAM to use instead of on-disk sorting and so forth. That can give a big speed increase, but it is per connection and 200 connections * 10M is 2G, so it can theoretically chew up a lot of RAM.<br />
<br />
maintenance_work_mem = 163840<br />
<br />
That's 160M of RAM which will be used by (e.g.) VACUUM, index rebuild, cluster and so forth. This should only be used periodically and should be freed when those processes exit, so I believe it is well worth while.<br />
<br />
max_fsm_pages = 100000<br />
max_fsm_relations = 5000<br />
<br />
These are used to hold the free-space map, and if they are too small you will see performance degradation after the database has been operating for some time. The exact numbers to set can be gleaned from the output of VACUUM VERBOSE, which prints the required FSM pages at the end of it's run. The 5x increase seems to be useful for a Moodle installation, from experience.<br />
<br />
wal_buffers = 64<br />
<br />
These buffers are used for the write-ahead log, and there have been a number of reports on the PostgreSQL mailing lists of improvement from this level of increase.<br />
<br />
This is a little out of date now (version 8.0) but still worth a read: http://www.powerpostgresql.com/Docs<br />
<br />
And there is lots of good stuff here as well: http://www.varlena.com/varlena/GeneralBits/Tidbits/index.php<br />
<br />
''Based on Andrew McMillan's post at [http://moodle.org/mod/forum/discuss.php?d=68558 Tuning PostgreSQL] forum thread.''<br />
<br />
===Other database performance links===<br />
* Consider using a '''distributed cacheing system''' like [http://en.wikipedia.org/wiki/Memcached memcached] but note that memcached does not have any security features so it should be used behind a firewall.<br />
* Consider using PostgreSQL. See [[Arguments in favour of PostgreSQL]] and [http://moodle.org/mod/forum/discuss.php?d=49195 how to migrate from MySQL to PostgreSQL] (forum discussion).<br />
* [[Increasing the database connection lifetime | Try increasing the database connection lifetime]]<br />
* [http://dev.mysql.com/doc/refman/5.0/en/server-parameters.html General advice on tuning MySQL parameters] (advice from the MySQL manual)<br />
* [http://www.mysqlperformanceblog.com/2007/11/01/innodb-performance-optimization-basics/ InnoDB performance optimization] taken from the [http://www.mysqlperformanceblog.com/ MySQL performance blog] site.<br />
<br />
==Moodle Admin settings==<br />
* In Moodle 1.7 or later, set the '''Cache type''' for your server: Site Admin -> Server -> Performance -> Cache type. There are several options available. <br />
:*If you do not have eaccelerator or mmemcached installed, choose "internal" (which makes use of the record/internal cache - see the next bullet point). <br />
:* If you have a single server and have compiled '''eaccelerator with shared memory support''', set the cache type to the eaccelerator option. <br />
:* If you have a '''separate memcached server''', set the cache type to memcached and enter a csv list of server IP addresses.<br />
* Enable the '''record/internal cache''': Site Admin -> Server -> Performance -> Record cache = True. Set the maximum amount of memory allocated to the cache in the Int Cache Max box. This will enable a primary cache for database records, without using any database engine cache, e.g. MySQL/PostgreSQL cache. See [http://tracker.moodle.org/browse/MDL-7196 this Tracker entry] for a full discussion.<br />
* Enable the '''language cache'''.<br />
* Large log files can cause overall performance to degrade over time. If you observe that the site has gradually got slower loading pages in the browser, '''reduce your Log life time''' setting (Admin/Server/Cleanup).<br />
* Performance can be greatly improved by allowing Moodle to use the system '''zip/unzip''' commands (rather than PHP-based zip libraries) - visit Admin/Server/System Paths and enter the path to the relevant executables. (Similarly, filling in the path to '''du''' will improve Moodle's speed at listing directory contents.)<br />
* Note that using '''secure web connections''' ('''https''' rather than '''http''') carries a higher processing burden, both for the webserver and the client - particularly because cacheing cannot be used as effectively, so the number of file requests is likely to increase dramatically. For this reason using https for all Moodle pages is not recommended. You can enable https just for the login screen, simply from Moodle's config page.<br />
* Check your '''filters'''. Having too many filters active can have serious effects on server load, especially on lower-end systems. The number of active filters has a direct effect on the perceived latency of your site; that is the time taken for each page impression. <br />
* Enable the '''text cache''' but do not "Filter all strings" unless you have a specific need. If in doubt profile the performance, and see how your changes affect the processing time.<br />
* Check your '''anti-virus''' measures on the server. Although they are useful for preventing security holes being exploited, some "On-Demand" scanners can affect performance by scanning page content (word, ppt files etc).<br />
* If there are performance problems loading course pages, check the '''Resource module settings'''. The setting resource_filterexternalpages is known to slow-down course pages and should be set to 'No' for better performance.<br />
* Check your '''forum settings'''. To improve performance set forum_trackreadposts = No and forum_usermarksread = Yes (this will impact on the convenience of your users' forum experience). Also consider setting the time of the day when old posts are cleared from the read table (forum_cleanreadtime) to when your site is less busy.<br />
<br />
==Performance of different Moodle modules==<br />
<br />
Moodle's activity modules, filters, and other plugins can be activated/deactivated. If necessary, you may wish to deactivate some features (such as chat) if not required - but this isn't necessary. Some notes on the performance of certain modules:<br />
<br />
* The '''Chat''' module is [http://moodle.org/mod/forum/discuss.php?d=37979&parent=175079 said] to be a hog in terms of frequent HTTP requests to the main server. This can be reduced by setting the module to use ''Streamed'' updates, or, if you're using a Unix-based webserver, by running the chat in daemon mode. When using the Chat module use the configuration settings to tune for your expected load. Pay particular attention to the ''chat_old_ping'' and ''chat_refresh'' parameters as these can have greatest impact on server load.<br />
* The '''Quiz''' module is known to stretch database performance. Try to optimise your database server by tuning. See [http://moodle.org/mod/forum/discuss.php?d=25616&parent=120770 for a brief report on performance for 55 students simultaneously using quizzes]<br />
** See this Case Study for an extensive server stress test with 300 quiz users.[http://moodle.org/mod/forum/discuss.php?d=68579] And this accompanying report on network traffic and server loads. [http://elearning.sgu.ac.jp/doc/PT/]<br />
* The Moodle '''Cron''' task is triggered by calling the script ''cron.php''. If this is called over HTTP (e.g. using wget or curl) it can take a large amount of memory on large installations. If it is called by directly invoking the php command (e.g. ''php -f /path/to/moodle/directory/admin/cron.php'') efficiency can be much improved.<br />
* The '''Recent activities''' block is consuming to much resources if you have huge number of records <code>mdl_log</code>. this is being tested to optimize the SQL query.<br />
<br />
==Moodle Image Optimization==<br />
<br />
The base images delivered in the original Moodle distribution package provide unoptimized graphics, most of which can benefit from lossless recompression utilizing [http://optipng.sourceforge.net/ optipng] for PNGs, [http://www.lcdf.org/gifsicle/ gifsicle] for GIFs and [http://www.kokkonen.net/tjko/projects.html jpegoptim] for JPGs. Optimized graphics transfer faster and provide a faster perceived response for clients[http://www.websiteoptimization.com/speed/12/], especially distance learners. The following example will recursively optimize (without any loss of quality) all the graphics and image files included in a base Moodle installation directory on a server with the above commands installed and available.<br />
<br />
<pre><br />
find /example/directory/moodle-1.9 -iname '*.png' -exec optipng -o7 {} \;<br />
find /example/directory/moodle-1.9 -iname '*.gif' -exec gifsicle -O2 -b {} \;<br />
find /example/directory/moodle-1.9 -iname '*.jpg' -exec jpegoptim -p {} \;<br />
</pre><br />
<br />
Both [http://optipng.sourceforge.net/ optipng] and [http://www.lcdf.org/gifsicle/ gifsicle] are provided in the base repositories of most newer Linux distributions; [http://www.kokkonen.net/tjko/projects.html jpegoptim] must be downloaded and installed manually.<br />
<br />
==See also==<br />
<br />
*[[Performance FAQ]]<br />
*Using Moodle [http://moodle.org/mod/forum/view.php?f=94 Hardware and Performance forum]<br />
<br />
There have been a lot of discussions on moodle.org about performance, here are some of the more interesting and (potentially) useful ones:<br />
<br />
* [http://moodle.org/mod/forum/discuss.php?d=83057 Performance woes!]<br />
* [http://moodle.org/mod/forum/discuss.php?d=57028 Performance perspectives - a little script]<br />
* [http://moodle.org/mod/forum/discuss.php?d=88927 Comments on planned server hardware]<br />
* [http://moodle.org/mod/forum/discuss.php?d=102978#p461624 Moodle performance in a pil by Martin Langhoff]<br />
[[Category:Performance]]<br />
<br />
[[fr:Performance]]<br />
[[ja:パフォーマンス]]<br />
[[pl:Wydajność]]</div>Kawhttps://docs.moodle.org/20/en/index.php?title=Upgrading&diff=49351Upgrading2009-01-25T13:45:56Z<p>Kaw: /* Check the requirements */ Clarification</p>
<hr />
<div>Moodle is designed to upgrade cleanly from one version to the next. Please refer to [[Upgrading to Moodle 1.6]], [[Upgrading to Moodle 1.8]] or [[Upgrading to Moodle 1.9]] for particular considerations related to the upgraded version. <br />
<br />
Changes that have been made to the original code, such as installing a contributed module (non-standard module) or a site edit of a php file, may not upgrade. This includes modifications to standard themes, that will be overwritten during an upgrade.<br />
<br />
For those using cpanel, you can use [http://ic.eflclasses.org/tutorials/howtoupgrademoodlewithcpanel.swf this tutorial]. It is a bit rough around the edges and is a little dated, but you should get the idea.<br />
<br />
<br />
__TOC__<br />
<br />
When upgrading a Moodle installation you should follow these steps:<br />
<br />
==Check the requirements==<br />
Spend some time re-reading the [[Installing Moodle | installation documentation]] and documentation for the new version. Check the system requirements for the target version you want to upgrade-to in ''Administration > Server > [[Environment]]''.<br />
<br />
== Backup important data ==<br />
<br />
Although it is not strictly necessary, it is always a good idea to make a backup of any production system before a major upgrade, just in case you need to revert back to the older version for some reason. In fact, it's a good idea to automate your server to backup your Moodle installation daily, so that you can skip this step.<br />
<br />
There are three areas that need backing up:<br />
<br />
=== 1. The Moodle software directory itself ===<br />
<br />
Make a separate copy of these files before the upgrade, so that you can retrieve your config.php and any modules you have added like themes, languages etc<br />
<br />
=== 2. Your data directory ===<br />
<br />
This is where uploaded content resides (such as course resources and student assignments) so it is very important to have a backup of these files anyway. Sometimes upgrades may move or rename directories within your data directory.<br />
<br />
=== 3. Your database ===<br />
<br />
Most Moodle upgrades will alter the database tables, adding or changing fields. Each database has different ways to backup. One way of backing up a MySQL database is to 'dump' it to a single SQL file. The following example shows Unix commands to dump the database called "moodle":<br />
<br />
mysqldump -u username -p -C -Q -e -a moodle > moodle-backup-2007-04-01.sql<br />
(The "-a" switch is deprecated and should be replaced by "--create-options")<br />
<br />
Substitute your database user account for username. The -p flag will prompt you for the password for the username specified by -u.<br />
<br />
If your database host is different from the host you want to execute the backup command (usually the web server), you have to specify it with the -h option to mysqldump:<br />
<br />
mysqldump -u username -p -h databasehost -C -Q -e -a moodle > moodle-backup-2007-04-01.sql <br />
<br />
You can also use the "Export" feature in Moodle's optional "MySQL Admin" web interface to do the same thing on all platforms. In Moodle v1.9 and greater, this is located in '''Site Administration''' -> '''Server''' -> '''Database'''. This interface can also be downloaded from http://download.moodle.org/modules/integrations.php. It is an integration of PHPMyAdmin for the Moodle administration interface.<br />
<br />
==== SQL dump caveats ====<br />
<br />
* Please note that there are a '''LOT''' of options possible for mysqldump. Please talk with your Systems Administrator (if you have one) or similar to see if there are site-specific flags you should use for your SQL dump.<br />
** For example, if your local installation is running MySQL 5.2 and you are moving to a system running MySQL 5.0 or 4.1, you really ought to use the "--compat=mysql40" flag. (This is not too uncommon of a situation given the nature of ISP hosting as compared to local user Moodle setups)<br />
* This seems obvious, but should be said outright: These instructions only work for dumping from MySQL! Postgresql, Oracle, and other database servers have different tools to dump databases.<br />
* Given the example mysql import lines, above, you really should use the --no-create-db flag. If your database locally is named something differently from the migration site, not including this flag could cause problems.<br />
<br />
== Install the new Moodle software ==<br />
<br />
=== Using a downloaded archive ===<br />
<br />
@Do not overwrite an old installation unless you know what you are doing ... sometimes old files can cause problems in new installations. The best way is to rename the current Moodle directory to something else, then unpack the new Moodle archive into the old location.<br />
<br />
Linux<br />
mv moodle moodle.backup<br />
tar xvzf moodle-1.1.tgz<br />
<br />
Next, copy across your config.php, any other plugins such as custom themes, and your .htaccess file if you created one:<br />
<br />
cp moodle.backup/config.php moodle<br />
cp -pr moodle.backup/theme/mytheme moodle/theme/mytheme<br />
<br />
Don't forget to <br />
<br />
sudo chown www-data moodle/config.php<br />
<br />
if necessary.<br />
<br />
where www-data is whatever user the Apache user is on your system. This is often 'apache' or 'www'.<br />
You can find out by doing 'ls -l' in your /var/www/moodle folder (or wherever your moodle site is)<br />
and then looking at the owner and group.<br />
<br />
so you may see something like<br />
<br />
ls -l<br />
<br />
...lots of lines...<br />
<br />
-rw-r--r-- 1 apache system 784 Jun 28 2007 config.php <br />
<br />
...lots more lines...<br />
<br />
so the owner is apache and the group is system. <br />
<br />
To replicate this on your new system you can do 'chown apache:system config.php' <br />
<br />
or to do a whole group do<br />
<br />
chown apache:system ./*<br />
<br />
and recursively<br />
<br />
chown -R apache:system ./*<br />
<br />
=== Using CVS ===<br />
<br />
You can use CVS for updating or upgrading your Moodle.<br />
First you need to do a CVS checkout in your (empty) Moodle root directory.<br />
<br />
You can use any of our [[CVS_for_Administrators#CVS_Servers|CVS Mirror servers]]. Just replace '''SERVER.cvs.moodle.org''' in the instructions below with the name of the mirror server you chose!.<br />
<br />
'''For Linux servers'''<br />
<br />
To do a CVS checkout of Moodle, you first have to logon to the Moodle CVS server.<br />
<br />
<nowiki>cvs -d:pserver:anonymous@SERVER.cvs.moodle.org:/cvsroot/moodle login</nowiki><br />
No password for anonymous, so just hit the Enter button.<br />
<br />
Go to the directory where you want the Moodle root to come and type<br />
<br />
<nowiki>cvs -z3 -d:pserver:anonymous@SERVER.cvs.moodle.org:/cvsroot/moodle co -r MOODLE_18_STABLE moodle</nowiki> <br />
(where MOODLE_18_STABLE is the desired version)<br />
<br />
To update, just go into the Moodle root directory and update to the new files:<br />
<br />
cvs update -dP<br />
To update to a new version type in the following and change 18 to whatever newest version upgrade number is<br />
cvs -Q update -dP -r MOODLE_18_STABLE<br />
<br />
Make sure you use the "d" parameter to create new directories if necessary, and the "P" parameter to prune empty directories.<br />
<br />
'''For Windows servers'''<br />
<br />
You can use Tortoise CVS to do the initial checkout and the updates.<br />
<br />
If you have been editing Moodle files, watch the messages very closely for possible conflicts. All your customised themes and non-standard plugins will be untouched.<br />
<br />
Don't forget to visit the admin page after the CVS update process has completed.<br />
<br />
== Finishing the upgrade ==<br />
<br />
The last step is to trigger the upgrade processes within Moodle.<br />
<br />
To do this just visit the admin page of your installation e.g. ''<nowiki>http://example.com/moodle/admin</nowiki>''<br />
<br />
It doesn't matter if you are logged in as admin or not. If you are upgrading from some older versions you would not be able to login before the upgrade anyway.<br />
<br />
Moodle will automatically detect the new version and perform all the database or filesystem upgrades that are necessary. If there is anything it can't do itself (very rare) then you will see messages telling you what you need to do.<br />
<br />
Assuming all goes well (no error messages) then you can start using your new version of Moodle and enjoy the new features!<br />
<br />
Please note that if you are running a large scale of moodle site (e.g. have more tha 10,000+ courses and 40,000+ users), make sure that you do your own performance profiling testing before you upgrade to Moodle 1.8.x, as there are still quite a few outstanding (unresolved) performance issues in 1.8.x for large user base installations.<br />
<br />
== Verify the upgrade (optional) ==<br />
<br />
If you wish to confirm that the database definitions in the upgraded database match the definitions of a new, clean install (which they should) you might like to look at [[Verify Database Schema]].<br />
<br />
==Upgrading more than one version==<br />
<br />
In general, it is recommended to upgrade via each version of Moodle, for example 1.7 -> 1.8 -> 1.9. An exception to this is when upgrading from 1.5 or 1.6, when it is recommended that 1.7 is skipped, in other words upgrade 1.5 -> 1.6 -> 1.8 -> 1.9. (The main reason for this recommendation is that the default roles settings obtained when upgrading to 1.7 are not ideal for 1.8 onwards.)<br />
<br />
==See also==<br />
<br />
*[[Installing Moodle]]<br />
*[[Installation FAQ]]<br />
*[[Upgrading to Moodle 1.6]]<br />
*[[Upgrading to Moodle 1.8]]<br />
*[[Upgrading to Moodle 1.9]]<br />
*Using Moodle [http://moodle.org/mod/forum/view.php?id=28 Installation problems] forum<br />
*[http://otaru-jc.ac.jp/hagley/howtoupgrademoodlewithcpanel.swf How to upgrade Moodle with cpanel tutorial]<br />
<br />
Using Moodle forum discussions:<br />
*[http://moodle.org/mod/forum/discuss.php?d=26731&parent=125858 Using cvs]<br />
*[http://moodle.org/mod/forum/discuss.php?d=56915 Upgrading from 1.5.2 to 1.7]<br />
*[http://moodle.org/mod/forum/discuss.php?d=56991 Upgrade nightmares.... any help appreciated]<br />
*[http://moodle.org/mod/forum/discuss.php?d=62463 After upgrading i get "Your site may not be secure." msg]<br />
*[http://moodle.org/mod/forum/discuss.php?d=104887 Best practices for QA]<br />
<br />
[[Category:Installation]]<br />
<br />
[[es:Actualización de moodle]]<br />
[[fr:Mise à jour]]<br />
[[ja:アップグレード]]<br />
[[nl:Upgraden]]<br />
[[zh:升级]]<br />
[[pl:Aktualizacja]]</div>Kawhttps://docs.moodle.org/20/en/index.php?title=Administrator_documentation&diff=43490Administrator documentation2008-09-13T18:10:39Z<p>Kaw: /* System-specific Instructions & Packages */</p>
<hr />
<div>The purpose of this page is to list useful links by general topics for administrators.<br />
<br />
== Installation & Upgrading ==<br />
<br />
*[[Installation Quickstart]] for an overview of the installation steps<br />
*[[Installing Moodle]] for detailed installation instructions<br />
*[[Installation FAQ]]<br />
*[[Installing AMP|Options for installing Apache, MySQL and PHP]]<br />
*[[Upgrading|Upgrading Moodle]]<br />
<br />
== System-specific Instructions & Packages ==<br />
<br />
'''Unix/Linux-based'''<br />
* [[SUSE Linux Server 10|Automated Installation Guide for SUSE Linux Enterprise Server 10]] operating system<br />
* [[RedHat Linux installation|Step by Step Installation Guide for RedHat]] operating system<br />
* [[Debian GNU/Linux installation|Step by Step Installation Guide for Debian GNU/Linux]] operating system<br />
* [[Step-by-step Install Guide for Ubuntu]]<br />
* [[Step-by-step Install Guide for Ubuntu using apt-get]]<br />
* [[Step-by-step Install Guide for Zenwalk-5.0]]<br />
* [[OLPC XS installation|Step by Step Installation Guide for the One Laptop per Child XS Server (Beta)]]<br />
* [[Step-by-step Install Guide for Solaris 10 with Oracle 10]]<br />
<br />
'''Windows'''<br />
* [[Windows installation|Windows installations with instructions for Windows NT/2000/2003 servers]]<br />
* [[Windows installation using XAMPP|Windows installation using XAMPP: Apache, MySQL and PHP]]<br />
* [[Development:Windows_Installer_anywhere|MoodleAnywhere]] another Windows installation package<br />
* [[Installing Moodle on Windows Vista]] - how to<br />
<br />
'''Mac'''<br />
* [[Complete Install Packages for Mac OS X | Complete Install Packages for Mac OS X 10.3/10.4/10.5]]<br />
* [[Step-by-step Guide for Installing Moodle on Mac OS X 10.4 Client|Step by Step Installation on a Mac OS X 10.4 Client using the internal web server]]<br />
* [[Step by Step Installation on a Mac OS X 10.5 Server]]<br />
<br />
'''Web Hosts'''<br />
* [[1and1_MySQL_installation | Installation on 1and1 web hosting]]<br />
<br />
'''Others'''<br />
* [[Installing Oracle for PHP]]<br />
<br />
==Security, Performance and Roles==<br />
<br />
*[[Security]] contains important security procedures for a production site<br />
*[[Performance | Performance and optimization]] for ideas on improving the speed of your installation<br />
*[[Manage roles | Managing roles]] For Moodle 1.7 and later.<br />
*[[suhosin]] is an advanced protection system for PHP installation. It was designed to protect servers and users from known and unknown flaws in PHP applications and the PHP core.<br />
<br />
== FAQs ==<br />
<br />
*[[Installation FAQ]]<br />
*[[Administration FAQ]]<br />
*[[Backup FAQ]]<br />
<br />
== Configuration Settings ==<br />
*[[Site administration block]] contains configuration setting links<br />
*[[Notification page]] used to update versions<br />
*[[Variables]]<br />
*[[Site settings]]<br />
*[[Themes]]<br />
*[[Language]]<br />
*[[Activity modules administration]]<br />
*[[Blocks administration]]<br />
*[[Filters]]<br />
*[[Backup settings]]<br />
*[[HTML editor settings]]<br />
*[[Calendar settings]]<br />
*[[Maintenance mode]]<br />
<br />
* See also: <br />
**[[Location of admin settings in 1.7|Comparison between configuration settings in Moodle 1.6 & 1.7]]<br />
<br />
==User Management==<br />
<br />
*[[Authentication]]<br />
*[[Add new user|Add a new user]] - on a site<br />
*[[Upload users]] - from a file to a site, and into existing course and group, some existing user global updates<br />
*[[Enrolment plugins]]<br />
**[[Flat file]] - enrol existing users in a course<br />
*[[Roles and capabilities|Assigning user a role]] - typical assignments include:<br />
**[[Students|Enrol students in a course]]<br />
**[[Courses (administrator)|Assign teachers]] - to a course<br />
**[[Assign creators|Assign course creators]] - in a site<br />
**[[Assign administrators]] - in a site<br />
<br />
==Other==<br />
<br />
*[[Courses (administrator)|Courses]] and [[Course formats|course formats]]<br />
*[[Reports (administrator)]] and [[Logs]]<br />
*[[Site files]]<br />
*[[Moodle database|Database]]<br />
*[[Environment]]<br />
*[[Moodle Network]] and Moodle [[Community hub]]<br />
*[[Streaming Media]]<br />
*[[Case studies (administrator)]]<br />
*[[Anti-virus]]<br />
*[[System Monitoring and Server Statistic Software]]<br />
<br />
==See also==<br />
<br />
*[[:Category:Administrator | Index of all Administrator-related pages]]<br />
*[[Integrations]]<br />
*[[CVS for Administrators]]<br />
*[[Email processing]]<br />
*[[Search engine optimization]]<br />
*[[Messaging]]<br />
*[[Migration]]<br />
*[[Metacourses]]<br />
*[[Block layout]]<br />
*[[Customizing Moodle]]<br />
*[[Administrator do's and don'ts]]<br />
*[[Using Moodle book]] Chapter 16: Moodle Administration<br />
*[[Administration hacks]]<br />
<br />
[[Category: Administrator]]<br />
[[cs:Rukověť správce]]<br />
[[es:Documentación para Administradores]]<br />
[[eu:Kudeatzaileentzako dokumentazioa]]<br />
[[fr:Documentation administrateur]]<br />
[[ja:管理者ドキュメント]]<br />
[[ko:관리자 문서]]<br />
[[nl:Documentatie voor beheerders]]<br />
[[pt:Documentação para administradores]]<br />
[[ru:Администраторам]]<br />
[[sk:Dokumentácia pre správcov]]<br />
[[zh:管理员文档]]<br />
[[pl:Administrator documentation]]<br />
[[fi:Ylläpitäjän opas]]</div>Kawhttps://docs.moodle.org/20/en/index.php?title=Administrator_documentation&diff=43489Administrator documentation2008-09-13T17:59:54Z<p>Kaw: /* System-specific Instructions & Packages */ Divided instructions for clarity</p>
<hr />
<div>The purpose of this page is to list useful links by general topics for administrators.<br />
<br />
== Installation & Upgrading ==<br />
<br />
*[[Installation Quickstart]] for an overview of the installation steps<br />
*[[Installing Moodle]] for detailed installation instructions<br />
*[[Installation FAQ]]<br />
*[[Installing AMP|Options for installing Apache, MySQL and PHP]]<br />
*[[Upgrading|Upgrading Moodle]]<br />
<br />
== System-specific Instructions & Packages ==<br />
<br />
'''Linux-based'''<br />
* [[SUSE Linux Server 10|Automated Installation Guide for SUSE Linux Enterprise Server 10]] operating system<br />
* [[RedHat Linux installation|Step by Step Installation Guide for RedHat]] operating system<br />
* [[Debian GNU/Linux installation|Step by Step Installation Guide for Debian GNU/Linux]] operating system<br />
* [[Step-by-step Install Guide for Ubuntu]]<br />
* [[Step-by-step Install Guide for Ubuntu using apt-get]]<br />
* [[Step-by-step Install Guide for Zenwalk-5.0]]<br />
* [[OLPC XS installation|Step by Step Installation Guide for the One Laptop per Child XS Server (Beta)]]<br />
<br />
'''Windows'''<br />
* [[Windows installation|Windows installations with instructions for Windows NT/2000/2003 servers]]<br />
* [[Windows installation using XAMPP|Windows installation using XAMPP: Apache, MySQL and PHP]]<br />
* [[Development:Windows_Installer_anywhere|MoodleAnywhere]] another Windows installation package<br />
* [[Installing Moodle on Windows Vista]]- how to<br />
<br />
'''Solaris'''<br />
* [[Step-by-step Install Guide for Solaris 10 with Oracle 10]]<br />
<br />
'''Mac'''<br />
* [[Complete Install Packages for Mac OS X | Complete Install Packages for Mac OS X 10.3/10.4/10.5]]<br />
* [[Step-by-step Guide for Installing Moodle on Mac OS X 10.4 Client|Step by Step Installation on a Mac OS X 10.4 Client using the internal web server]]<br />
* [[Step by Step Installation on a Mac OS X 10.5 Server]]<br />
<br />
'''Specific Hosts'''<br />
* [[1and1_MySQL_installation | Installation on 1and1 web hosting]]<br />
<br />
'''Others'''<br />
* [[Installing Oracle for PHP]]<br />
<br />
==Security, Performance and Roles==<br />
<br />
*[[Security]] contains important security procedures for a production site<br />
*[[Performance | Performance and optimization]] for ideas on improving the speed of your installation<br />
*[[Manage roles | Managing roles]] For Moodle 1.7 and later.<br />
*[[suhosin]] is an advanced protection system for PHP installation. It was designed to protect servers and users from known and unknown flaws in PHP applications and the PHP core.<br />
<br />
== FAQs ==<br />
<br />
*[[Installation FAQ]]<br />
*[[Administration FAQ]]<br />
*[[Backup FAQ]]<br />
<br />
== Configuration Settings ==<br />
*[[Site administration block]] contains configuration setting links<br />
*[[Notification page]] used to update versions<br />
*[[Variables]]<br />
*[[Site settings]]<br />
*[[Themes]]<br />
*[[Language]]<br />
*[[Activity modules administration]]<br />
*[[Blocks administration]]<br />
*[[Filters]]<br />
*[[Backup settings]]<br />
*[[HTML editor settings]]<br />
*[[Calendar settings]]<br />
*[[Maintenance mode]]<br />
<br />
* See also: <br />
**[[Location of admin settings in 1.7|Comparison between configuration settings in Moodle 1.6 & 1.7]]<br />
<br />
==User Management==<br />
<br />
*[[Authentication]]<br />
*[[Add new user|Add a new user]] - on a site<br />
*[[Upload users]] - from a file to a site, and into existing course and group, some existing user global updates<br />
*[[Enrolment plugins]]<br />
**[[Flat file]] - enrol existing users in a course<br />
*[[Roles and capabilities|Assigning user a role]] - typical assignments include:<br />
**[[Students|Enrol students in a course]]<br />
**[[Courses (administrator)|Assign teachers]] - to a course<br />
**[[Assign creators|Assign course creators]] - in a site<br />
**[[Assign administrators]] - in a site<br />
<br />
==Other==<br />
<br />
*[[Courses (administrator)|Courses]] and [[Course formats|course formats]]<br />
*[[Reports (administrator)]] and [[Logs]]<br />
*[[Site files]]<br />
*[[Moodle database|Database]]<br />
*[[Environment]]<br />
*[[Moodle Network]] and Moodle [[Community hub]]<br />
*[[Streaming Media]]<br />
*[[Case studies (administrator)]]<br />
*[[Anti-virus]]<br />
*[[System Monitoring and Server Statistic Software]]<br />
<br />
==See also==<br />
<br />
*[[:Category:Administrator | Index of all Administrator-related pages]]<br />
*[[Integrations]]<br />
*[[CVS for Administrators]]<br />
*[[Email processing]]<br />
*[[Search engine optimization]]<br />
*[[Messaging]]<br />
*[[Migration]]<br />
*[[Metacourses]]<br />
*[[Block layout]]<br />
*[[Customizing Moodle]]<br />
*[[Administrator do's and don'ts]]<br />
*[[Using Moodle book]] Chapter 16: Moodle Administration<br />
*[[Administration hacks]]<br />
<br />
[[Category: Administrator]]<br />
[[cs:Rukověť správce]]<br />
[[es:Documentación para Administradores]]<br />
[[eu:Kudeatzaileentzako dokumentazioa]]<br />
[[fr:Documentation administrateur]]<br />
[[ja:管理者ドキュメント]]<br />
[[ko:관리자 문서]]<br />
[[nl:Documentatie voor beheerders]]<br />
[[pt:Documentação para administradores]]<br />
[[ru:Администраторам]]<br />
[[sk:Dokumentácia pre správcov]]<br />
[[zh:管理员文档]]<br />
[[pl:Administrator documentation]]<br />
[[fi:Ylläpitäjän opas]]</div>Kawhttps://docs.moodle.org/20/en/index.php?title=Installing_Moodle&diff=43023Installing Moodle2008-09-02T05:54:34Z<p>Kaw: /* Using a .htaccess file for webserver and PHP settings */ Reformatting</p>
<hr />
<div>'''Firstly don't panic! :-)'''<br />
<br />
This guide explains how to install Moodle for the first time. For some of these steps it goes into a lot of detail to try and cover the majority of possible web server setups, so this page may look long and complicated. Don't panic, once you know how to do it you can install Moodle in minutes!<br />
<br />
If you have problems please read this page carefully - most common issues are answered in here. If you still have trouble, you can seek help from the Moodle community via [http://moodle.org/course/view.php?id=5 moodle.org Using Moodle].<br />
<br />
Another option is to contact a [http://moodle.com/hosting/ Moodle Partner providing Moodle hosting] who can completely maintain Moodle for you, so that you can ignore all this and get straight into educating! A Moodle partner is the preferred option but if you decide to choose a hosting company that has cpanel then [http://otaru-jc.ac.jp/hagley/settingupmoodleonhostingwithcpanel.swf this tutorial will guide you] through the process of choosing a host and setting up moodle via cpanel (had not been available the last few weeks; now tentatively seems to be available again; see [http://englishforum.sgu.ac.jp/moodle/ this portal page]). <br />
<br />
'''Warning:''' some hosting companies offer one-click moodle install options, which whilst sometimes effective, usually use old (sometimes years old) versions of moodle and sometimes simply don't work. If one of these goes wrong, your best bet is often to start from scratch following the instructions here yourself. Its almost certainly quicker.<br />
<br />
If you want to run Moodle on your own computer and this page looks a bit daunting, then please see our guides on how to install one of Moodle's complete [[Complete install packages for Windows|Windows packages]], [[Complete Install Packages for Mac OS X|Mac OS packages]] or [[Installing AMP |Installing Apache, MySQL and PHP(AMP)]]. They provide alternative instructions to install all this on most popular platforms.<br />
<br />
==Table of Contents==<br />
__TOC__<br />
<br />
==Requirements==<br />
<br />
Moodle is primarily developed in Linux using [[Apache]], [[MySQL]] and [[PHP]] (also sometimes known as the LAMP platform), but is also regularly tested with Windows XP/2000/2003 (WAMP), Solaris 10 (Sparc and x64), Mac OS X and Netware 6 operating systems. Support for PostgreSQL, Oracle and Microsoft SQL Server is also available.<br />
<br />
The procedure for installing Moodle on the Windows platform (e.g. Windows Server, IIS and MSSQL) varies slightly to the procedure for the LAMP platform. See [[Installation for Windows 2003 with IIS]] for more details.<br />
<br />
[[Installing Moodle on Windows Vista]] might help with '''Blank page problem while installing Moodle on Windows Vista''' .<br />
<br />
The requirements for Moodle are as follows:<br />
<br />
===Hardware === <br />
* Disk space: 160MB free (min). You will require more free space to store your teaching materials.<br />
* Memory: 256MB (min), 1GB (recommended). The general rule of thumb is that Moodle can support 50 ''concurrent'' users for every 1GB of RAM, but this will vary depending on your specific hardware and software combination. <br />
** '''Note if you are using a hosted account:''' Most hosted accounts on commercial sites will meet Disk and Memory requirements. However, you should contact your web host's support desk to check that this is the case before signing-up with them. It is especially important to '''ask about any PHP memory limits or MySQL question limits'''. If your prospective host does not provide a service which meets these requirements, or you are already signed up with them, ask them why and consider taking your business elsewhere if they do not change.<br />
<br />
===Software===<br />
* Web server software. Most people use [[Apache]], but Moodle should work fine under any web server that supports [[PHP]], such as [[IIS]] on Windows platforms. PHP does impose requirements on versions of web servers, however these are complex and the general advice is to use the newest version possible of your chosen web server. <br />
* PHP scripting language. (Please note that there have been issues installing Moodle with [http://www.php-accelerator.co.uk PHP-Accelerator]). There are currently two versions (or branches) of PHP available: PHP4 and PHP5 and the version requirements are listed below.<br />
** For Moodle version 1.4 or later: PHP4 (version 4.1.0 or later) or PHP5 (version 5.1.0 or later) are supported.<br />
** For Moodle version 1.6 or later: the PHP4 (version 4.3.0 or later) or PHP5 (version 5.1.0 or later) are supported. <br />
** Future Moodle versions 2.0 or later will not support PHP4 and will require PHP5 (version 5.2.4 or later).<br />
** PHP Settings. Check these settings in your php.ini or .htaccess file (if you're using Apache). For settings which use ON/OFF as their values, you can substitute 1 for ON and 0 for OFF if you prefer. <br />
*** ''safe_mode'' needs to be OFF.<br />
*** ''memory_limit'' should be at least 16M (32M is recommended for Moodle 1.7 and 40M for Moodle 1.8 or later). Large sites may need more than 128M. PHP 5.2.x requires higher memory_limit values than previous versions of PHP. 64bit operating systems require even more memory.<br />
*** ''session.save_handler'' needs to be set to FILES.<br />
*** ''magic_quotes_gpc'' should be ON. (It will be recommended to turn it off in 2.0.)<br />
*** ''magic_quotes_runtime'' needs to be OFF.<br />
*** ''file_uploads'' needs to be ON.<br />
*** ''session.auto_start'' needs to be OFF.<br />
*** ''session.bug_compat_warn'' needs to be OFF.<br />
** PHP Extensions and libraries<br />
*** The mbstring extension is recommended for Moodle 1.6 or later.<br />
*** The iconv extension is recommended for Moodle 1.6 or later.<br />
*** [http://www.libgd.org/ GD library] and the [http://www.freetype.org/ FreeType 2] library and extensions are needed to be able to look at the dynamic graphs that the logs pages make.<br />
*** The mysql extension is required if you are using the MySQL database. Note that in some Linux distributions (notably Red Hat) this is an optional installation.<br />
*** The pgsql extension is required if you are using the PostgreSQL database.<br />
*** The pdo and pdo_sqlite extensions are required for the (experimental) SQLite 3 database support.<br />
*** The curl extension is recommended for Moodle 1.8 or later.<br />
*** The tokenizer extension is recommended for Moodle 1.8 or later.<br />
*** The curl and openssl extensions are required for the Moodle network functionality (Moodle 1.8 or later).<br />
*** Other PHP extensions may be required to support optional Moodle functionality, especially external authentication and/or enrolment (e.g. LDAP extension for LDAP authentication and the sockets extension for Chat server).<br />
* A working database server: [[MySQL]] or [[PostgreSQL]] are completely supported and recommended for use with any version of Moodle. Support for Microsoft SQL Server and Oracle has been added in Moodle 1.7. MySQL is ''the'' choice for many people because it is very popular, but there are some [[Arguments in favour of PostgreSQL|arguments in favour of PostgreSQL]], especially if you are planning a large deployment.<br />
** For Moodle 1.5, MySQL (version 3.23 or later) or PostgreSQL (7.4 or later). <br />
** For Moodle 1.6, MySQL (version 4.1.12 or later) or PostgreSQL (7.4 or later).<br />
** For Moodle 1.7, MySQL (version 4.1.12 or later), PostgreSQL (7.4 or later) or Microsoft SQL Server 2005 (version 9 or [http://moodle.org/mod/forum/discuss.php?d=59284 SQL Server Express 2005])<br />
** For Moodle 1.8 or later, MySQL (version 4.1.12 or later), PostgreSQL (8.0 or later) or Microsoft SQL Server 2005 (version 9 or [http://moodle.org/mod/forum/discuss.php?d=59284 SQL Server Express 2005])<br />
: MySQL Notes: For Moodle 1.6 or later, If you use latin languages only you can use MySQL 4.1.12. If you are using non-latin languages you require MySQL 4.1.16 or later. Currently the MySQL setting "strict mode" must be OFF (set to "" or "MYSQL40") in the MySQL configuration file. <br />
: PostgreSQL Notes: PostgreSQL 7.4 is recommended for earlier Moodle versions, since Moodle 1.8 only PostgreSQL 8.0 and above are supported.<br />
* For showcases or low to medium-sized installations, Moodle 2.0 also includes (experimental) support for SQLite 3 database. This setup requires no database server, as the database file is stored in a local directory on the server.<br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<br />
== How many users? ==<br />
<br />
In addition to the hardware and software requirements, you will also need to think about the capacity of your Moodle installation in terms of the number of users it can handle. There are two numbers to plan for:<br />
<br />
:'''Browsing users''': the maximum number of users able to browse your Moodle site. This is the number of computers in your organization or on your course (whichever is greater).<br />
:'''Concurrent database users''': the maximum number of concurrent database users (needed for Moodle activities such as quizzes). This is the number of users who will be using Moodle at the same time. In an educational institution, use your timetable/roster to obtain this figure.<br />
<br />
Once you know these figures for your users, you can start work out if your Moodle installation can support this capacity. The exact number of users depends on your hardware/software/network combination. Usually the amount of memory installed (RAM) is the deciding factor but a faster overall processor speed will also help in reducing waiting times for pages to load. <br />
<br />
The general rule of thumb for a single server is that the approx max concurrent users = RAM (GB) * 50 and the approx max browsing users = Approx max concurrent users * 5. As an example, a university with 500 total computers on campus and 100 concurrent users at any time will need approx 2GB of RAM on the one server to support the number of concurrent users.<br />
<br />
*'''Note if you are using a hosted account''': Ask your provider what limits are placed on the number of concurrent database connections and the processor load. This will give a good estimate of the number of users your Moodle install can manage.<br />
<br />
*'''Note:''' As of August 31, 2007, Moodle 1.8.2+ is not recommended for large installations, especially if you have large number (e.g. 20,000+) of courses. The main reason is the codes related to ROLES are still not fully optimized with database queries and still need some work. If you are planning to use 1.8.x codes for a larger institution, please make sure that you have sufficient time to do your own testing and performance profiling. Upgrade to Moodle 1.9!!<br />
<br />
[Update|Updating from a previous version] of Moodle has been improved quite a bit from 1.8.3+ version (see this thread discussion: http://moodle.org/mod/forum/discuss.php?d=83281). Moodle 1.9 has even more improvements in all areas and is the recommended version.<br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<br />
== Download and copy files into place ==<br />
<br />
There are two ways to get Moodle, either as a compressed package or via [[CVS]]. <br />
<br />
=== Download from compressed packages===<br />
There are two types of compressed packages at the [http://download.moodle.org/ download.moodle.org page:] which offer a variety of version, operating systems and compression types.<br />
#The "Standard Distribution" (with Moodle only files) and <br />
#Several operating system "Complete Install Packages" (which contains programs to create a Moodle in a web environment). Please see [[Complete install packages]] for more information. <br />
<br />
Most of these instructions are for the standard distribution, <br />
Download a compressed package and then unpack the archive into your file structure using either of these two commands:<br />
tar -zxvf [filename]<br />
unzip [filename]<br />
<br />
===Download from CVS===<br />
To use CVS, helpful instructions are available at the [[CVS_for_Administrators | CVS for Administrators]] page. The full [http://cvs.moodle.org/moodle/ Moodle CVS repository] is also available for browsing. <br />
<br />
If you are using CVS, run the CVS Checkout command.<br />
<br />
===Directory created placement===<br />
After either of the above processes, you will now have with a directory called "moodle", containing a number of files and folders.<br />
<br />
For the standard package, you can either place the whole folder in your web server documents directory, in which case the site will be located at '''<nowiki>http://yourwebserver.com/moodle</nowiki>''', or you can copy all the contents straight into the main web server documents directory, in which case the site will be simply '''<nowiki>http://yourwebserver.com</nowiki>'''.<br />
<br />
'''Tip''': If you are downloading Moodle to your local computer and then uploading it to your web site, it is usually better to upload the whole archive as one file, and then do the unpacking on the server. Even web hosting interfaces like cPanel allow you to uncompress archives in the "File Manager".<br />
<br />
=== Structure of moodle directory ===<br />
<br />
You can safely skip this section, but here is a quick summary of the contents of the Moodle folder, to help get you oriented:<br />
<br />
:''config.php'' - contains basic settings. This file does not come with Moodle - you will create it by executing install.php or manually.<br />
:''install.php'' - the script you will run to create config.php<br />
:''version.php'' - defines the current version of Moodle code<br />
:''index.php'' - the front page of the site<br />
:''admin/'' - code to administrate the whole server<br />
:''auth/'' - plugin modules to authenticate users<br />
:''blocks/'' - plugin modules for the little side blocks on many pages<br />
:''calendar/'' - all the code for managing and displaying calendars<br />
:''course/'' - code to display and manage courses<br />
:''doc/'' - help documentation for Moodle (eg this page)<br />
:''files/'' - code to display and manage uploaded files<br />
:''lang/'' - texts in different languages, one directory per language<br />
:''lib/'' - libraries of core Moodle code<br />
:''login/'' - code to handle login and account creation<br />
:''mod/'' - all the main Moodle course modules are in here<br />
:''pix/'' - generic site graphics<br />
:''theme/'' - theme packs/skins to change the look of the site.<br />
:''user/'' - code to display and manage users<br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<br />
== Setting-up your system==<br />
To ensure that Moodle will install successfully, you need to check that the web server settings are correct, then create a blank database for Moodle to use and finally create a directory on your hard disk for Moodle to save your materials and other files you upload into your courses.<br />
<br />
=== Check web server settings ===<br />
<br />
*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. Mine usually looks like this:<br />
<br />
'''DirectoryIndex''' index.php index.html index.htm<br />
<br />
:Just make sure index.php is in the list (and preferably towards the start of the list, for efficiency).<br />
<br />
*Secondly, '''if you are using Apache 2''', then you should turn on the ''AcceptPathInfo'' variable, which allows scripts to be passed arguments like <nowiki>http://server/file.php/arg1/arg2</nowiki>. 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. (NB: This setting, or any equivalent, is not required in Apache 1)<br />
<br />
'''AcceptPathInfo''' on<br />
<br />
=== Recheck PHP settings ===<br />
Moodle requires a number of PHP settings to be active for it to work. These were given in the Requirements section and '''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, so it is useful to double-check that the settings are correct. These are defined in PHP's configuration file (usually called '''php.ini''') or in the Apache '''.htaccess''' file:<br />
<br />
safe_mode = 0 (necessary)<br />
memory_limit = 40M (varies: minimum 16M, 32M Moodle v1.7, 40M Moodle v1.8, 128M large sites)<br />
session.save_handler = files (unless you are using another handler, e.g. mm) <br />
magic_quotes_gpc = 1 (preferred but not necessary, 0 will be recommended in 2.0)<br />
magic_quotes_runtime = 0 (necessary)<br />
file_uploads = 1<br />
session.auto_start = 0<br />
session.bug_compat_warn = 0<br />
<br />
You may also want to set other, optional php.ini file settings while you are already editing it. For instance, you may want to reset the maximum upload size of file attachments, which usually defaults to 2M(egabytes). For instance, to set these to 16 Megabytes:<br />
<br />
post_max_size = 16M<br />
upload_max_filesize = 16M<br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<br />
=== Using a .htaccess file for webserver and PHP settings ===<br />
<br />
Use the above if you can directly edit your server's files, but if you are setting-up Moodle on a webhost, or 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. This only works on Apache servers and only when Overrides have been allowed in the main Apache configuration. Moodle is supplied with a htaccess file which you can use, or you can create your own file manually.<br />
<br />
* '''Use the default htaccess file'''. The easiest thing to do is just copy the sample file from moodle/lib/htaccess and edit it to suit your needs. It contains further instructions. For example, in a Unix shell:<br />
<br />
cd moodle<br />
cp moodle/lib/htaccess .htaccess<br />
<br />
* '''Create your own file'''. Alternatively you can create your own file called '''.htaccess''' in Moodle's main directory that contains lines like the following. <br />
<br />
DirectoryIndex index.php index.html index.htm<br />
php_value memory_limit 40M (adjust to your version of Moodle)<br />
php_flag magic_quotes_gpc 1<br />
php_flag magic_quotes_runtime 0<br />
php_flag file_uploads 1<br />
php_flag session.auto_start 0<br />
php_flag session.bug_compat_warn 0<br />
<br />
:If you have Apache version 2 installed, add these lines:<br />
<br />
<IfDefine APACHE2><br />
AcceptPathInfo on<br />
</IfDefine><br />
<br />
:Otherwise add this single line:<br />
<br />
AcceptPathInfo on<br />
<br />
:Optionally, you can also do things like define the maximum size for uploaded files, etc by adding these lines:<br />
<br />
LimitRequestBody 0<br />
php_value upload_max_filesize 2M<br />
php_value post_max_size 2M<br />
<br />
:The value given in these lines is 2M. You may want to change this at a later date to allow uploading of larger files.<br />
<br />
* '''Some shared hosts do not allow .htaccess files'''. In this case, it may be necessary to place a php.ini file within each sub-directory of the site. To do this, you use your editor to create a php.ini file in the main moodle directory and later copy it to all sub-directories. The syntax for the php.ini file is different than the one used in .htaccess - you do not use the php_value and php_flag prefixes. See the example below:<br />
upload_max_filesize = 2M<br />
post_max_size = 2M<br />
:After creating the php.ini file with all of the statements you need, run the script http://tips-scripts.com/php_ini_copy or copy php.ini manually to all sub-directories.<br />
<br />
*'''Some shared hosts use suPHP, which requires a slightly different configuration'''. If everything else fails, try creating the following two files and uploading to your moodle root directory<br />
:php.ini (sample):<br />
register_globals = 0<br />
display_errors = 0<br />
<br />
:.htaccess (sample):<br />
suPHP_ConfigPath /home/cPanelName/public_html/moodle<br />
<br />
Change the above path to the actual path to your moodle install.<br />
<br />
*'''Note''': Use a .htaccess file only [http://httpd.apache.org/docs/1.3/howto/htaccess.html#when as a last resort] as it can have an impact on the performance of your Moodle site and cause pages to load slowly on your browser.<br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<br />
=== Creating an empty database ===<br />
<br />
You need to create an empty database (eg "''moodle''") in your database system along with a special user (eg "moodleuser") that has access to that database (and that database only). You could use the "root" user if you wanted to for a test server, but this is not recommended for a production system: if hackers manage to discover the password then your whole database system would be at risk, rather than just one database.<br />
<br />
::'''Warning''': Bear in mind that, as of Moodle version 1.5.x, Moodle doesn't work with MySQL 5.x's strict mode setting (STRICT_TRANS_TABLES and/or STRICT_ALL_TABLES) -- see [http://moodle.org/mod/forum/discuss.php?d=58552 forum discussion]. So if you are using MySQL 5.x, edit MySQL's configuration file (called "my.ini" in Windows and "my.cnf" on Unix/Linux) and comment out that option or set it to <code>sql-mode=''</code>. You have to restart MySQL after changing this setting. <br><br> If you do not have access to your server, use PHPMyAdmin (or another MySQL client) and enter the command <code>SET @@global.sql_mode='';</code> (be sure to use single quotes, and don't forget the semicolon).<br />
<br />
<table style=background-color:lightCyan border=1 cellpadding=5 cellspacing=0 ><tr><td><br />
====Using a hosted server====<br />
If you are using a webhost, they will probably have a control panel web interface for you to create your database.<br />
<br />
The '''[http://www.cpanel.com/ cPanel]''' system is one of the most popular of these. <br />
To create a database using cPanel:<br />
<br />
# Click on the '''MySQL Databases''' icon.<br />
# Type '''moodle''' in the New Database field and click '''Create Database'''.<br />
# Type a ''username'' and ''password'' (not one you use elsewhere) in the respective fields and click '''Create User'''.<br>Note that the ''username'' and ''database'' names may be prefixed by your cPanel account name and an underscore, and truncated to 16 characters. When entering this information into the Moodle installer - use the full names.<br />
# Now use the '''Add Users to Databases''' button and give this new user account '''ALL''' rights to the new database.<br />
<br />
Continue with [[Installing_Moodle#CreatDataDir |Creating the data directory]]<br />
<br />
</td></tr></table><br />
<br />
<table style=background-color:lightCyan border=1 cellpadding=5 cellspacing=0 ><tr><td><br />
====Using a SQLite database====<br />
SQLite is a software library that implements a self-contained, serverless, zero-configuration, transactional SQL database engine.<br />
<br />
Moodle 2.0 offers support for SQLite3 database installations. In this case, no database setup is required. The database file will be created by the installation script. By default, the database file will be store in Moodle's data directory (see [[Installing_Moodle#CreatDataDir |Creating the data directory]]). During install, the web server must have write access on the directory where the database file will be stored. After installation, the web server must have read-write access to the database file.<br />
<br />
Continue with [[Installing_Moodle#CreatDataDir |Creating the data directory]]<br />
<br />
</td></tr></table><br />
<br />
<br />
====Using the command line====<br />
<br />
If you have access to Unix or Windows command lines then you can do the same sort of thing by typing commands. You should do this using the MySQL Client program as follows (commands which you type-in are shown in bold):<br />
<br />
- Start the MySQL Client program:<br />
#'''mysql -u root -p'''<br />
Enter password:<br />
Welcome to the MySQL monitor. Commands end with ; or \g.<br />
Your MySQL connection id is 2 to server version: 5.0.22-log<br />
<br />
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.<br />
<br />
mysql><br />
<br />
- The prompt changes to "mysql>" to indicate that you are now working in the MySQL Client program. When working in MySQL, all commands which you type-in must end in a semi-colon. (If you hit the Enter key without the final semi-colon, you'll get the line continuation symbol '->'; this is your second chance to type the semi-colon and hit Enter.) <br />
<br />
- Begin by checking for any existing databases called "moodle" - if there are any you should change the name in all the commands which follow:<br />
mysql> '''SHOW DATABASES;'''<br />
+-------------------------+<br />
| Database |<br />
+-------------------------+<br />
| information_schema |<br />
| mysql |<br />
| test |<br />
+-------------------------+<br />
3 rows in set (0.03 sec)<br />
<br />
- Create a database to store the Moodle tables. We'll call this "moodle", as there are none with that name already in the above list, but change it if you need to.<br />
mysql> '''CREATE DATABASE moodle;'''<br />
Query OK, 1 row affected (0.00 sec)<br />
<br />
- Change the default character set and collation of the "moodle" database to UTF8. Leave this out if you are installing Moodle 1.5 or earlier):<br />
mysql> '''ALTER DATABASE moodle DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;'''<br />
Query OK, 1 row affected (0.00 sec)<br />
<br />
- Create a username and password to access the database "moodle" and grant database access permissions. We'll call the user "moodleuser" and set the password as "yourpassword". It's a good idea to change these for your installation however most people keep the username as "moodleuser". Remember the username and password you have set, as you'll need it in the configuration screens later. This is a long command so has been split over several lines by pressing the Return key.<br />
mysql> '''GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,'''<br />
-> '''DROP,INDEX,ALTER ON moodle.*'''<br />
-> '''TO moodleuser@localhost IDENTIFIED BY 'yourpassword';'''<br />
Query OK, 0 rows affected (0.01 sec)<br />
<br />
:'''Security Warnings''': Never leave the password as the one shown here. Make sure you have a strong password (a mixture of letters and numbers, upper and lower case). Avoid granting "ALL" permissions on the database.<br />
: '''Note''': For MySQL 4.0.1 or earlier, you don't need the CREATE TEMPORARY TABLES permission. <br />
<br />
- Exit the MySQL Client program:<br />
mysql> '''QUIT'''<br />
Bye<br />
#<br />
<br />
- Reload the grant tables using the mysqladmin program:<br />
#'''mysqladmin -u root -p reload'''<br />
Enter password:<br />
#<br />
<br />
And some example command lines for PostgreSQL:<br />
<br />
# su - postgres<br />
> psql -c "create user moodleuser createdb;" template1<br />
> psql -c "create database moodle <font color="red">with encoding 'unicode'</font>;" -U moodleuser template1<br />
> psql -c "alter user moodleuser nocreatedb;" template1<br />
> psql -c "alter user moodleuser with encrypted password 'yourpassword';" template1<br />
> su - root<br />
# /etc/init.d/postgresql reload<br />
<br />
If the Postgres create database command above (>psql -c "create database moodle...") gives an error message you may want to try:<br />
psql -c "create database moodle with template=template1 encoding = 'unicode' owner = moodleuser <br> location = '/var/mydata';"<br />
<br />
If the create database command asks you for a password, run the line containing 'encrypted password' first before proceeding.<br />
<br />
'''See also''':<br />
* Step-by-step instructions on [https://docs.moodle.org/en/Step-by-step_Install_Guide_for_Ubuntu installation for Ubuntu(Debian)]<br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<br />
=== Creating the data directory ===<br />
<br />
Moodle will also need some space on your server's hard disk to store uploaded files, such as course documents and user pictures. The Moodle installer tries hard to create the '''moodledata''' directory for you but if it fails then you will have to create a directory for this purpose manually.<br />
<br />
'''Security warning''': For security purposes, it is '''CRITICAL''' that this directory is '''NOT''' accessible directly via the web. The easiest way to do this is to simply locate it OUTSIDE the web site root directory (it is the folder that the main part of your URL -that is, the part up to the first single / - points to; for example, in <nowiki>http://your.domain.com/moodle/admin/cron.php</nowiki>, it is <nowiki>http://your.domain.com/</nowiki>).<br />
<br />
But if you must have it in the web directory (and you are using Apache AND the web server configuration allows .htaccess files to restrict access to directories) then protect it by creating a file in the data directory called '''.htaccess''', containing these lines:<br />
<br />
order deny,allow<br />
deny from all<br />
<br />
If you are using IIS, you need to edit the properties of the data directory (from the Internet Information Services Manager console) and deny access to that folder to everybody from the web.<br />
<br />
<table style=background-color:lightCyan border=1 cellpadding=5 cellspacing=0 ><tr><td><br />
'''If you don't protect the data directory from direct web access, anybody will be able to impersonate any user of your Moodle site (including the admin user!!!), and all of your course materials will be available to the web at large.'''<br />
</table><br />
<br />
'''Ownership & Permissions''': To make sure that Moodle can save uploaded files in this directory, check that the web server software has permission to read, write and execute in this directory. On Unix machines, this means setting the owner of the directory to be something like "nobody" or "apache", and then giving that user read, write and execute permissions. As an example, to change the owner to "nobody" you could use:<br />
<br />
chown -R nobody:apache moodledata<br />
<br />
To change the permissions so that the owner has read,write and execute permissions, use something like this:<br />
<br />
chmod -R 0770 moodledata<br />
<br />
'''Note''': If you are receiving permission denied messages, try ''chmod -R 0770 moodledata'' and then adjust the settings so that they are more secure. A more secure setting is ''chmod -R 0750 moodledata''. According to the comments in config-dist.php, "On hosting systems you might need to make sure that your group has no permissions at all while others have full permissions." To do this you could use ''chmod -R 707 moodledata''. See also the [[Security | security page]].<br />
<br />
Remember that by default moodle will issue a warning about moodle data directories created inside the web directory, but otherwise this directory can be located where you wish. You can later move or change the location of this directory, but if you do, be sure to edit the setting in the '''config.php''' file that sets this; e.g. if moodledata is under a directory called data, then it would look like this:<br />
<br />
$CFG->dataroot = '/data/moodledata';<br />
<br />
<table style=background-color:lightCyan border=1 cellpadding=5 cellspacing=0 ><tr><td><br />
<br />
'''CPanel and webhosts'''<br />
<br />
On cPanel systems you can use the "File Manager" to find the folder, click on it, then choose "Change Permissions". On many shared hosting servers, you will probably need to restrict all file access to your "group" (to prevent other webhost customers from looking at or changing your files), but provide full read/write access to everyone else (which will allow the web server to access your files). Speak to your server administrator if you are having trouble setting this up securely. In particular it will not be possible to create a usable data directory on sites that use a PHP feature known as "'''Safe Mode'''".<br />
</table><br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<br />
== Run the installer script to create config.php ==<br />
<br />
To run the installer script (install.php), just try to access your Moodle main URL using a web browser, or access '''<nowiki>http://yourserver/install.php</nowiki>''' directly.<br />
<br />
(The Installer will try to set a session cookie. If you get a popup warning in your browser make sure you accept that cookie!)<br />
<br />
Moodle will detect that configuration is necessary and will lead you through some screens to help you create a new configuration file called '''config.php'''. At the end of the process Moodle will try and write the file into the right location, otherwise you can press a button to download it from the installer and then upload '''config.php''' into the main Moodle directory on the server.<br />
<br />
Along the way the installer will test your server environment and give you suggestions about how to fix any problems. For most common issues these suggestions should be sufficient, but if you get stuck, check in the Installation Forum for more help.<br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<br />
== Go to the admin page to continue configuration ==<br />
<br />
Once the basic config.php has been correctly created in the previous step, trying to access the front page of your site will take you to the "admin" page for the rest of the configuration.<br />
<br />
The first time you access this admin page, you will be presented with a GPL "shrink wrap" agreement with which you must agree before you can continue with the setup.<br />
<br />
Now Moodle will start setting up your database and creating tables to store data. Firstly, the main database tables are created. You should see a number of SQL statements followed by status messages that look like this:<br />
<br />
CREATE TABLE course (<br />
id int(10) unsigned NOT NULL auto_increment,<br />
category int(10) unsigned NOT NULL default '0',<br />
password varchar(50) NOT NULL default <nowiki>''</nowiki>,<br />
fullname varchar(254) NOT NULL default <nowiki>''</nowiki>,<br />
shortname varchar(15) NOT NULL default <nowiki>''</nowiki>,<br />
summary text NOT NULL,<br />
format tinyint(4) NOT NULL default '1',<br />
teacher varchar(100) NOT NULL default 'Teacher',<br />
startdate int(10) unsigned NOT NULL default '0',<br />
enddate int(10) unsigned NOT NULL default '0',<br />
timemodified int(10) unsigned NOT NULL default '0',<br />
PRIMARY KEY (id)<br />
) TYPE=MyISAM;<br />
<br />
<font color="green">SUCCESS</font><br />
<br />
...and so on, followed by: <font color="green">Main databases set up successfully.</font><br />
<br />
If you don't see these, then there must have been some problem with the database or the configuration settings you defined in config.php. Check that PHP isn't in a restricted "Safe Mode" (commercial web hosts sometimes have safe mode turned on). You can check PHP variables by creating a little file containing '''<?php phpinfo() ?>''' and looking at it through a browser. Check all these and try this page again.<br />
<br />
Scroll down the very bottom of the page and press the "Continue" link.<br />
<br />
You should now see a form where you can define more configuration variables for your installation, such as the default language, SMTP hosts and so on. Don't worry too much about getting everything right just now - you can always come back and edit these later on using the admin interface. The defaults are designed to be useful and secure for most sites. Scroll down to the bottom and click "Save changes".<br />
<br />
If (and only if) you find yourself getting stuck on this page, unable to continue, then your server probably has what I call the "buggy referrer" problem. This is easy to fix: just turn off the "secureforms" setting, then try to continue again.<br />
<br />
Next you will see more pages that print lots of status messages as they set up all the tables required by the various Moodle module. As before, they should all be <font color="green">green</font>.<br />
<br />
Scroll down the very bottom of the page and press the "Continue" link.<br />
<br />
The next page is a form where you can define parameters for your Moodle site and the front page, such as the name, format, description and so on. Fill this out (you can always come back and change these later) and then press "Save changes".<br />
<br />
Finally, you will then be asked to create a top-level administration user for future access to the admin pages. Fill out the details with your own name, email etc and then click "Save changes". Not all the fields are required, but if you miss any important fields you'll be re-prompted for them.<br />
<br />
'''Make sure you remember the username and password you chose for the administration user account, as they will be necessary to access the administration page in future.'''<br />
<br />
(If for any reason your install is interrupted, or there is a system error of some kind that prevents you from logging in using the admin account, you can usually log in using the default username of "'''admin'''", with password "'''admin'''".)<br />
<br />
Once successful, you will be returned to the home page of your new site! Note the administration links that appear down the left hand side of the page (these items also appear on a separate Admin page) - these items are only visible to you because you are logged in as the admin user. All your further administration of Moodle can now be done using this menu, such as:<br />
<br />
* creating and deleting courses<br />
* creating and editing user accounts<br />
* administering teacher accounts<br />
* changing site-wide settings like themes etc<br />
<br />
But you are not done installing yet! There is one very important thing still to do (see the next section on cron).<br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<br />
== Installing Moodle Using Command Line ==<br />
{{Moodle 2.0}}<br />
<br />
Installing Moodle Using command line is just as easy as installing Moodle using web browser. <br />
* First Go to the moodle root directory and then to admin directory inside the moodle root. <br />
<br />
$cd /var/www/html/moodle/admin<br />
<br />
* Then simply use the following syntax to run the moodle command line installer (this is a long command which has been split over 3 lines, so type as one line)<br />
$php cliupgrade.php --lang=en --webaddr=<nowiki>http://www.example.com</nowiki> --moodledir=/var/www/html/moodle <br />
--datadir=/var/moodledata --dbtype=mysql --dbhost=localhost --dbname=moodle <br />
--dbuser=root --prefix=mdl --verbose=1 --interactivelevel=2 <br />
<br />
More information about the options can be found using <br />
$php cliupgrad.php --help<br />
<br />
Then you will see the following list of available options<br />
<br />
--lang Valid installed language for installation. Default is English(en)<br />
--webaddr Web address for the Moodle site<br />
--moodledir Location of the moodle web folder<br />
--datadir Location of the moodle data folder (should not be web visible)<br />
--dbtype Database type. Default it mysql<br />
--dbhost Database host. Default localhost<br />
--dbname Database name. Default is moodle<br />
--dbuser Database user. Default is blank<br />
--dbpass Database password. Default is blank<br />
--prefix Table prefix for above database tables. Default is mdl<br />
--verbose 0 No output, 1 Summarized output(Default), 2 Detailed output<br />
--interactivelevel 0 Non interactive, 1 Semi interactive(Default), 2 Interactive<br />
--help print out this help<br />
<br />
When you choose non interactive mode without any options all the default values are assumed.<br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<br />
== Set up cron ==<br />
<br />
Moodle's background tasks (e.g. sending out forum emails and performing course backups) are performed by a script which you can set to execute at specific times of the day. This is known as a cron script. Please refer to the [[Cron|Cron instructions]].<br />
<br />
== Set up backups ==<br />
<br />
Please refer to the [[Backup settings| backup instructions]].<br />
<br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<br />
== Create a new course ==<br />
<br />
Now that Moodle is running properly, you can try creating a new course to play with.<br />
<br />
Select "Create a new course" from the Admin page (or the admin links on the home page).<br />
<br />
Fill out the form, paying special attention to the course format. You don't have to worry about the details too much at this stage, as everything can be changed later by the teacher. Note that the yellow help icons are everywhere to provide contextual help on any aspect.<br />
<br />
Press "Save changes", and you will be taken to a new form where you can assign teachers to the course. You can only add existing user accounts from this form - if you want to create a new teacher account then either ask the teacher to create one for themselves (see the login page), or create one for them using the "Add a new user" on the Admin page.<br />
<br />
Once done, the course is ready to customize, and is accessible via the "Courses" link on the home page.<br />
<br />
==See also==<br />
<br />
* [[Installation FAQ]]<br />
* [[Complete install packages]] might be an easier first time installs on some systems<br />
* Help forum: [http://moodle.org/mod/forum/view.php?id=28 Installation problems]<br />
* [[Installing Apache, MySQL and PHP]] - Open source programs that can run Moodle on the web or on a desktop<br />
* [[Upgrading Moodle]]<br />
* Using Moodle [http://moodle.org/mod/forum/discuss.php?d=42688 Selecting a web host for Moodle] forum discussion<br />
* [[masquerading|Masquerading]] - Running Moodle behind a masquerading/NAT firewall<br />
<br />
[[Category:Installation]]<br />
<br />
[[cs:Instalace]]<br />
[[de:Installieren von Moodle]]<br />
[[es:Instalación de moodle]]<br />
[[fr:Installation de Moodle]]<br />
[[ja:Moodleのインストール]]<br />
[[nl:Installatiegids]]<br />
[[pl:Instalacja Moodle]]<br />
[[pt:Instalação do Moodle]]<br />
[[ru:Установка Moodle]]<br />
[[sk:Inštalácia]]<br />
[[zh:安装Moodlezh:]]</div>Kawhttps://docs.moodle.org/20/en/index.php?title=Installing_Moodle&diff=43022Installing Moodle2008-09-02T05:41:19Z<p>Kaw: /* Download and copy files into place */ Heading typo and bullet points</p>
<hr />
<div>'''Firstly don't panic! :-)'''<br />
<br />
This guide explains how to install Moodle for the first time. For some of these steps it goes into a lot of detail to try and cover the majority of possible web server setups, so this page may look long and complicated. Don't panic, once you know how to do it you can install Moodle in minutes!<br />
<br />
If you have problems please read this page carefully - most common issues are answered in here. If you still have trouble, you can seek help from the Moodle community via [http://moodle.org/course/view.php?id=5 moodle.org Using Moodle].<br />
<br />
Another option is to contact a [http://moodle.com/hosting/ Moodle Partner providing Moodle hosting] who can completely maintain Moodle for you, so that you can ignore all this and get straight into educating! A Moodle partner is the preferred option but if you decide to choose a hosting company that has cpanel then [http://otaru-jc.ac.jp/hagley/settingupmoodleonhostingwithcpanel.swf this tutorial will guide you] through the process of choosing a host and setting up moodle via cpanel (had not been available the last few weeks; now tentatively seems to be available again; see [http://englishforum.sgu.ac.jp/moodle/ this portal page]). <br />
<br />
'''Warning:''' some hosting companies offer one-click moodle install options, which whilst sometimes effective, usually use old (sometimes years old) versions of moodle and sometimes simply don't work. If one of these goes wrong, your best bet is often to start from scratch following the instructions here yourself. Its almost certainly quicker.<br />
<br />
If you want to run Moodle on your own computer and this page looks a bit daunting, then please see our guides on how to install one of Moodle's complete [[Complete install packages for Windows|Windows packages]], [[Complete Install Packages for Mac OS X|Mac OS packages]] or [[Installing AMP |Installing Apache, MySQL and PHP(AMP)]]. They provide alternative instructions to install all this on most popular platforms.<br />
<br />
==Table of Contents==<br />
__TOC__<br />
<br />
==Requirements==<br />
<br />
Moodle is primarily developed in Linux using [[Apache]], [[MySQL]] and [[PHP]] (also sometimes known as the LAMP platform), but is also regularly tested with Windows XP/2000/2003 (WAMP), Solaris 10 (Sparc and x64), Mac OS X and Netware 6 operating systems. Support for PostgreSQL, Oracle and Microsoft SQL Server is also available.<br />
<br />
The procedure for installing Moodle on the Windows platform (e.g. Windows Server, IIS and MSSQL) varies slightly to the procedure for the LAMP platform. See [[Installation for Windows 2003 with IIS]] for more details.<br />
<br />
[[Installing Moodle on Windows Vista]] might help with '''Blank page problem while installing Moodle on Windows Vista''' .<br />
<br />
The requirements for Moodle are as follows:<br />
<br />
===Hardware === <br />
* Disk space: 160MB free (min). You will require more free space to store your teaching materials.<br />
* Memory: 256MB (min), 1GB (recommended). The general rule of thumb is that Moodle can support 50 ''concurrent'' users for every 1GB of RAM, but this will vary depending on your specific hardware and software combination. <br />
** '''Note if you are using a hosted account:''' Most hosted accounts on commercial sites will meet Disk and Memory requirements. However, you should contact your web host's support desk to check that this is the case before signing-up with them. It is especially important to '''ask about any PHP memory limits or MySQL question limits'''. If your prospective host does not provide a service which meets these requirements, or you are already signed up with them, ask them why and consider taking your business elsewhere if they do not change.<br />
<br />
===Software===<br />
* Web server software. Most people use [[Apache]], but Moodle should work fine under any web server that supports [[PHP]], such as [[IIS]] on Windows platforms. PHP does impose requirements on versions of web servers, however these are complex and the general advice is to use the newest version possible of your chosen web server. <br />
* PHP scripting language. (Please note that there have been issues installing Moodle with [http://www.php-accelerator.co.uk PHP-Accelerator]). There are currently two versions (or branches) of PHP available: PHP4 and PHP5 and the version requirements are listed below.<br />
** For Moodle version 1.4 or later: PHP4 (version 4.1.0 or later) or PHP5 (version 5.1.0 or later) are supported.<br />
** For Moodle version 1.6 or later: the PHP4 (version 4.3.0 or later) or PHP5 (version 5.1.0 or later) are supported. <br />
** Future Moodle versions 2.0 or later will not support PHP4 and will require PHP5 (version 5.2.4 or later).<br />
** PHP Settings. Check these settings in your php.ini or .htaccess file (if you're using Apache). For settings which use ON/OFF as their values, you can substitute 1 for ON and 0 for OFF if you prefer. <br />
*** ''safe_mode'' needs to be OFF.<br />
*** ''memory_limit'' should be at least 16M (32M is recommended for Moodle 1.7 and 40M for Moodle 1.8 or later). Large sites may need more than 128M. PHP 5.2.x requires higher memory_limit values than previous versions of PHP. 64bit operating systems require even more memory.<br />
*** ''session.save_handler'' needs to be set to FILES.<br />
*** ''magic_quotes_gpc'' should be ON. (It will be recommended to turn it off in 2.0.)<br />
*** ''magic_quotes_runtime'' needs to be OFF.<br />
*** ''file_uploads'' needs to be ON.<br />
*** ''session.auto_start'' needs to be OFF.<br />
*** ''session.bug_compat_warn'' needs to be OFF.<br />
** PHP Extensions and libraries<br />
*** The mbstring extension is recommended for Moodle 1.6 or later.<br />
*** The iconv extension is recommended for Moodle 1.6 or later.<br />
*** [http://www.libgd.org/ GD library] and the [http://www.freetype.org/ FreeType 2] library and extensions are needed to be able to look at the dynamic graphs that the logs pages make.<br />
*** The mysql extension is required if you are using the MySQL database. Note that in some Linux distributions (notably Red Hat) this is an optional installation.<br />
*** The pgsql extension is required if you are using the PostgreSQL database.<br />
*** The pdo and pdo_sqlite extensions are required for the (experimental) SQLite 3 database support.<br />
*** The curl extension is recommended for Moodle 1.8 or later.<br />
*** The tokenizer extension is recommended for Moodle 1.8 or later.<br />
*** The curl and openssl extensions are required for the Moodle network functionality (Moodle 1.8 or later).<br />
*** Other PHP extensions may be required to support optional Moodle functionality, especially external authentication and/or enrolment (e.g. LDAP extension for LDAP authentication and the sockets extension for Chat server).<br />
* A working database server: [[MySQL]] or [[PostgreSQL]] are completely supported and recommended for use with any version of Moodle. Support for Microsoft SQL Server and Oracle has been added in Moodle 1.7. MySQL is ''the'' choice for many people because it is very popular, but there are some [[Arguments in favour of PostgreSQL|arguments in favour of PostgreSQL]], especially if you are planning a large deployment.<br />
** For Moodle 1.5, MySQL (version 3.23 or later) or PostgreSQL (7.4 or later). <br />
** For Moodle 1.6, MySQL (version 4.1.12 or later) or PostgreSQL (7.4 or later).<br />
** For Moodle 1.7, MySQL (version 4.1.12 or later), PostgreSQL (7.4 or later) or Microsoft SQL Server 2005 (version 9 or [http://moodle.org/mod/forum/discuss.php?d=59284 SQL Server Express 2005])<br />
** For Moodle 1.8 or later, MySQL (version 4.1.12 or later), PostgreSQL (8.0 or later) or Microsoft SQL Server 2005 (version 9 or [http://moodle.org/mod/forum/discuss.php?d=59284 SQL Server Express 2005])<br />
: MySQL Notes: For Moodle 1.6 or later, If you use latin languages only you can use MySQL 4.1.12. If you are using non-latin languages you require MySQL 4.1.16 or later. Currently the MySQL setting "strict mode" must be OFF (set to "" or "MYSQL40") in the MySQL configuration file. <br />
: PostgreSQL Notes: PostgreSQL 7.4 is recommended for earlier Moodle versions, since Moodle 1.8 only PostgreSQL 8.0 and above are supported.<br />
* For showcases or low to medium-sized installations, Moodle 2.0 also includes (experimental) support for SQLite 3 database. This setup requires no database server, as the database file is stored in a local directory on the server.<br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<br />
== How many users? ==<br />
<br />
In addition to the hardware and software requirements, you will also need to think about the capacity of your Moodle installation in terms of the number of users it can handle. There are two numbers to plan for:<br />
<br />
:'''Browsing users''': the maximum number of users able to browse your Moodle site. This is the number of computers in your organization or on your course (whichever is greater).<br />
:'''Concurrent database users''': the maximum number of concurrent database users (needed for Moodle activities such as quizzes). This is the number of users who will be using Moodle at the same time. In an educational institution, use your timetable/roster to obtain this figure.<br />
<br />
Once you know these figures for your users, you can start work out if your Moodle installation can support this capacity. The exact number of users depends on your hardware/software/network combination. Usually the amount of memory installed (RAM) is the deciding factor but a faster overall processor speed will also help in reducing waiting times for pages to load. <br />
<br />
The general rule of thumb for a single server is that the approx max concurrent users = RAM (GB) * 50 and the approx max browsing users = Approx max concurrent users * 5. As an example, a university with 500 total computers on campus and 100 concurrent users at any time will need approx 2GB of RAM on the one server to support the number of concurrent users.<br />
<br />
*'''Note if you are using a hosted account''': Ask your provider what limits are placed on the number of concurrent database connections and the processor load. This will give a good estimate of the number of users your Moodle install can manage.<br />
<br />
*'''Note:''' As of August 31, 2007, Moodle 1.8.2+ is not recommended for large installations, especially if you have large number (e.g. 20,000+) of courses. The main reason is the codes related to ROLES are still not fully optimized with database queries and still need some work. If you are planning to use 1.8.x codes for a larger institution, please make sure that you have sufficient time to do your own testing and performance profiling. Upgrade to Moodle 1.9!!<br />
<br />
[Update|Updating from a previous version] of Moodle has been improved quite a bit from 1.8.3+ version (see this thread discussion: http://moodle.org/mod/forum/discuss.php?d=83281). Moodle 1.9 has even more improvements in all areas and is the recommended version.<br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<br />
== Download and copy files into place ==<br />
<br />
There are two ways to get Moodle, either as a compressed package or via [[CVS]]. <br />
<br />
=== Download from compressed packages===<br />
There are two types of compressed packages at the [http://download.moodle.org/ download.moodle.org page:] which offer a variety of version, operating systems and compression types.<br />
#The "Standard Distribution" (with Moodle only files) and <br />
#Several operating system "Complete Install Packages" (which contains programs to create a Moodle in a web environment). Please see [[Complete install packages]] for more information. <br />
<br />
Most of these instructions are for the standard distribution, <br />
Download a compressed package and then unpack the archive into your file structure using either of these two commands:<br />
tar -zxvf [filename]<br />
unzip [filename]<br />
<br />
===Download from CVS===<br />
To use CVS, helpful instructions are available at the [[CVS_for_Administrators | CVS for Administrators]] page. The full [http://cvs.moodle.org/moodle/ Moodle CVS repository] is also available for browsing. <br />
<br />
If you are using CVS, run the CVS Checkout command.<br />
<br />
===Directory created placement===<br />
After either of the above processes, you will now have with a directory called "moodle", containing a number of files and folders.<br />
<br />
For the standard package, you can either place the whole folder in your web server documents directory, in which case the site will be located at '''<nowiki>http://yourwebserver.com/moodle</nowiki>''', or you can copy all the contents straight into the main web server documents directory, in which case the site will be simply '''<nowiki>http://yourwebserver.com</nowiki>'''.<br />
<br />
'''Tip''': If you are downloading Moodle to your local computer and then uploading it to your web site, it is usually better to upload the whole archive as one file, and then do the unpacking on the server. Even web hosting interfaces like cPanel allow you to uncompress archives in the "File Manager".<br />
<br />
=== Structure of moodle directory ===<br />
<br />
You can safely skip this section, but here is a quick summary of the contents of the Moodle folder, to help get you oriented:<br />
<br />
:''config.php'' - contains basic settings. This file does not come with Moodle - you will create it by executing install.php or manually.<br />
:''install.php'' - the script you will run to create config.php<br />
:''version.php'' - defines the current version of Moodle code<br />
:''index.php'' - the front page of the site<br />
:''admin/'' - code to administrate the whole server<br />
:''auth/'' - plugin modules to authenticate users<br />
:''blocks/'' - plugin modules for the little side blocks on many pages<br />
:''calendar/'' - all the code for managing and displaying calendars<br />
:''course/'' - code to display and manage courses<br />
:''doc/'' - help documentation for Moodle (eg this page)<br />
:''files/'' - code to display and manage uploaded files<br />
:''lang/'' - texts in different languages, one directory per language<br />
:''lib/'' - libraries of core Moodle code<br />
:''login/'' - code to handle login and account creation<br />
:''mod/'' - all the main Moodle course modules are in here<br />
:''pix/'' - generic site graphics<br />
:''theme/'' - theme packs/skins to change the look of the site.<br />
:''user/'' - code to display and manage users<br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<br />
== Setting-up your system==<br />
To ensure that Moodle will install successfully, you need to check that the web server settings are correct, then create a blank database for Moodle to use and finally create a directory on your hard disk for Moodle to save your materials and other files you upload into your courses.<br />
<br />
=== Check web server settings ===<br />
<br />
*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. Mine usually looks like this:<br />
<br />
'''DirectoryIndex''' index.php index.html index.htm<br />
<br />
:Just make sure index.php is in the list (and preferably towards the start of the list, for efficiency).<br />
<br />
*Secondly, '''if you are using Apache 2''', then you should turn on the ''AcceptPathInfo'' variable, which allows scripts to be passed arguments like <nowiki>http://server/file.php/arg1/arg2</nowiki>. 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. (NB: This setting, or any equivalent, is not required in Apache 1)<br />
<br />
'''AcceptPathInfo''' on<br />
<br />
=== Recheck PHP settings ===<br />
Moodle requires a number of PHP settings to be active for it to work. These were given in the Requirements section and '''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, so it is useful to double-check that the settings are correct. These are defined in PHP's configuration file (usually called '''php.ini''') or in the Apache '''.htaccess''' file:<br />
<br />
safe_mode = 0 (necessary)<br />
memory_limit = 40M (varies: minimum 16M, 32M Moodle v1.7, 40M Moodle v1.8, 128M large sites)<br />
session.save_handler = files (unless you are using another handler, e.g. mm) <br />
magic_quotes_gpc = 1 (preferred but not necessary, 0 will be recommended in 2.0)<br />
magic_quotes_runtime = 0 (necessary)<br />
file_uploads = 1<br />
session.auto_start = 0<br />
session.bug_compat_warn = 0<br />
<br />
You may also want to set other, optional php.ini file settings while you are already editing it. For instance, you may want to reset the maximum upload size of file attachments, which usually defaults to 2M(egabytes). For instance, to set these to 16 Megabytes:<br />
<br />
post_max_size = 16M<br />
upload_max_filesize = 16M<br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<br />
=== Using a .htaccess file for webserver and PHP settings ===<br />
<br />
Use the above if you can directly edit your server's files, but if you are setting-up Moodle on a webhost, or 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. This only works on Apache servers and only when Overrides have been allowed in the main Apache configuration. Moodle is supplied with a htaccess file which you can use, or you can create your own file manually.<br />
<br />
* '''Use the default htaccess file'''. The easiest thing to do is just copy the sample file from moodle/lib/htaccess and edit it to suit your needs. It contains further instructions. For example, in a Unix shell:<br />
<br />
cd moodle<br />
cp moodle/lib/htaccess .htaccess<br />
<br />
* '''Create your own file'''. Alternatively you can create your own file called '''.htaccess''' in Moodle's main directory that contains lines like the following. <br />
<br />
DirectoryIndex index.php index.html index.htm<br />
php_value memory_limit 40M (adjust to your version of Moodle)<br />
php_flag magic_quotes_gpc 1<br />
php_flag magic_quotes_runtime 0<br />
php_flag file_uploads 1<br />
php_flag session.auto_start 0<br />
php_flag session.bug_compat_warn 0<br />
<br />
:If you have Apache version 2 installed, add these lines:<br />
<br />
<IfDefine APACHE2><br />
AcceptPathInfo on<br />
</IfDefine><br />
<br />
:Otherwise add this single line:<br />
<br />
AcceptPathInfo on<br />
<br />
:Optionally, you can also do things like define the maximum size for uploaded files, etc by adding these lines:<br />
<br />
LimitRequestBody 0<br />
php_value upload_max_filesize 2M<br />
php_value post_max_size 2M<br />
<br />
:The value given in these lines is 2M. You may want to change this at a later date to allow uploading of larger files.<br />
<br />
<br />
<table style=background-color:lightCyan border=1 cellpadding=5 cellspacing=0 ><tr><td><br />
Several hosting services that uses Apache 2 and php 5.x does not allow php flags and values to be set from within .htaccess file. It may be necessary to place a php.ini file within each sub-directory of the site :-( .<br />
</td></tr></table><br />
<br />
# Make one php.ini file in the main moodle directory tree and later copy it to all sub-directories. the syntax is a little bit different than the one used in .htaccess. (see sample after section 2)<br />
# Run the script http://tips-scripts.com/php_ini_copy or copy php.ini manually to all sub-directories.<br />
:php.ini (sample):<br />
upload_max_filesize = 2M<br />
post_max_size = 2M<br />
<br />
<br />
<br />
*'''Some shared hosts use suPHP, which requires a slightly different configuration'''. If everything else fails, try creating the following two files and uploading to your moodle root directory<br />
:php.ini (sample):<br />
register_globals = 0<br />
display_errors = 0<br />
<br />
:.htaccess (sample):<br />
suPHP_ConfigPath /home/cPanelName/public_html/moodle<br />
<br />
'''Change the above path to the actual path to your moodle install'''<br />
<br />
<br />
<br />
*'''Before you go into this adventure make sure you really need those php instructions in your site.'''<br />
<br />
*'''Note''': Use a .htaccess file only [http://httpd.apache.org/docs/1.3/howto/htaccess.html#when as a last resort] as it can have an impact on the performance of your Moodle site and cause pages to load slowly on your browser.<br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<br />
=== Creating an empty database ===<br />
<br />
You need to create an empty database (eg "''moodle''") in your database system along with a special user (eg "moodleuser") that has access to that database (and that database only). You could use the "root" user if you wanted to for a test server, but this is not recommended for a production system: if hackers manage to discover the password then your whole database system would be at risk, rather than just one database.<br />
<br />
::'''Warning''': Bear in mind that, as of Moodle version 1.5.x, Moodle doesn't work with MySQL 5.x's strict mode setting (STRICT_TRANS_TABLES and/or STRICT_ALL_TABLES) -- see [http://moodle.org/mod/forum/discuss.php?d=58552 forum discussion]. So if you are using MySQL 5.x, edit MySQL's configuration file (called "my.ini" in Windows and "my.cnf" on Unix/Linux) and comment out that option or set it to <code>sql-mode=''</code>. You have to restart MySQL after changing this setting. <br><br> If you do not have access to your server, use PHPMyAdmin (or another MySQL client) and enter the command <code>SET @@global.sql_mode='';</code> (be sure to use single quotes, and don't forget the semicolon).<br />
<br />
<table style=background-color:lightCyan border=1 cellpadding=5 cellspacing=0 ><tr><td><br />
====Using a hosted server====<br />
If you are using a webhost, they will probably have a control panel web interface for you to create your database.<br />
<br />
The '''[http://www.cpanel.com/ cPanel]''' system is one of the most popular of these. <br />
To create a database using cPanel:<br />
<br />
# Click on the '''MySQL Databases''' icon.<br />
# Type '''moodle''' in the New Database field and click '''Create Database'''.<br />
# Type a ''username'' and ''password'' (not one you use elsewhere) in the respective fields and click '''Create User'''.<br>Note that the ''username'' and ''database'' names may be prefixed by your cPanel account name and an underscore, and truncated to 16 characters. When entering this information into the Moodle installer - use the full names.<br />
# Now use the '''Add Users to Databases''' button and give this new user account '''ALL''' rights to the new database.<br />
<br />
Continue with [[Installing_Moodle#CreatDataDir |Creating the data directory]]<br />
<br />
</td></tr></table><br />
<br />
<table style=background-color:lightCyan border=1 cellpadding=5 cellspacing=0 ><tr><td><br />
====Using a SQLite database====<br />
SQLite is a software library that implements a self-contained, serverless, zero-configuration, transactional SQL database engine.<br />
<br />
Moodle 2.0 offers support for SQLite3 database installations. In this case, no database setup is required. The database file will be created by the installation script. By default, the database file will be store in Moodle's data directory (see [[Installing_Moodle#CreatDataDir |Creating the data directory]]). During install, the web server must have write access on the directory where the database file will be stored. After installation, the web server must have read-write access to the database file.<br />
<br />
Continue with [[Installing_Moodle#CreatDataDir |Creating the data directory]]<br />
<br />
</td></tr></table><br />
<br />
<br />
====Using the command line====<br />
<br />
If you have access to Unix or Windows command lines then you can do the same sort of thing by typing commands. You should do this using the MySQL Client program as follows (commands which you type-in are shown in bold):<br />
<br />
- Start the MySQL Client program:<br />
#'''mysql -u root -p'''<br />
Enter password:<br />
Welcome to the MySQL monitor. Commands end with ; or \g.<br />
Your MySQL connection id is 2 to server version: 5.0.22-log<br />
<br />
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.<br />
<br />
mysql><br />
<br />
- The prompt changes to "mysql>" to indicate that you are now working in the MySQL Client program. When working in MySQL, all commands which you type-in must end in a semi-colon. (If you hit the Enter key without the final semi-colon, you'll get the line continuation symbol '->'; this is your second chance to type the semi-colon and hit Enter.) <br />
<br />
- Begin by checking for any existing databases called "moodle" - if there are any you should change the name in all the commands which follow:<br />
mysql> '''SHOW DATABASES;'''<br />
+-------------------------+<br />
| Database |<br />
+-------------------------+<br />
| information_schema |<br />
| mysql |<br />
| test |<br />
+-------------------------+<br />
3 rows in set (0.03 sec)<br />
<br />
- Create a database to store the Moodle tables. We'll call this "moodle", as there are none with that name already in the above list, but change it if you need to.<br />
mysql> '''CREATE DATABASE moodle;'''<br />
Query OK, 1 row affected (0.00 sec)<br />
<br />
- Change the default character set and collation of the "moodle" database to UTF8. Leave this out if you are installing Moodle 1.5 or earlier):<br />
mysql> '''ALTER DATABASE moodle DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;'''<br />
Query OK, 1 row affected (0.00 sec)<br />
<br />
- Create a username and password to access the database "moodle" and grant database access permissions. We'll call the user "moodleuser" and set the password as "yourpassword". It's a good idea to change these for your installation however most people keep the username as "moodleuser". Remember the username and password you have set, as you'll need it in the configuration screens later. This is a long command so has been split over several lines by pressing the Return key.<br />
mysql> '''GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,'''<br />
-> '''DROP,INDEX,ALTER ON moodle.*'''<br />
-> '''TO moodleuser@localhost IDENTIFIED BY 'yourpassword';'''<br />
Query OK, 0 rows affected (0.01 sec)<br />
<br />
:'''Security Warnings''': Never leave the password as the one shown here. Make sure you have a strong password (a mixture of letters and numbers, upper and lower case). Avoid granting "ALL" permissions on the database.<br />
: '''Note''': For MySQL 4.0.1 or earlier, you don't need the CREATE TEMPORARY TABLES permission. <br />
<br />
- Exit the MySQL Client program:<br />
mysql> '''QUIT'''<br />
Bye<br />
#<br />
<br />
- Reload the grant tables using the mysqladmin program:<br />
#'''mysqladmin -u root -p reload'''<br />
Enter password:<br />
#<br />
<br />
And some example command lines for PostgreSQL:<br />
<br />
# su - postgres<br />
> psql -c "create user moodleuser createdb;" template1<br />
> psql -c "create database moodle <font color="red">with encoding 'unicode'</font>;" -U moodleuser template1<br />
> psql -c "alter user moodleuser nocreatedb;" template1<br />
> psql -c "alter user moodleuser with encrypted password 'yourpassword';" template1<br />
> su - root<br />
# /etc/init.d/postgresql reload<br />
<br />
If the Postgres create database command above (>psql -c "create database moodle...") gives an error message you may want to try:<br />
psql -c "create database moodle with template=template1 encoding = 'unicode' owner = moodleuser <br> location = '/var/mydata';"<br />
<br />
If the create database command asks you for a password, run the line containing 'encrypted password' first before proceeding.<br />
<br />
'''See also''':<br />
* Step-by-step instructions on [https://docs.moodle.org/en/Step-by-step_Install_Guide_for_Ubuntu installation for Ubuntu(Debian)]<br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<br />
=== Creating the data directory ===<br />
<br />
Moodle will also need some space on your server's hard disk to store uploaded files, such as course documents and user pictures. The Moodle installer tries hard to create the '''moodledata''' directory for you but if it fails then you will have to create a directory for this purpose manually.<br />
<br />
'''Security warning''': For security purposes, it is '''CRITICAL''' that this directory is '''NOT''' accessible directly via the web. The easiest way to do this is to simply locate it OUTSIDE the web site root directory (it is the folder that the main part of your URL -that is, the part up to the first single / - points to; for example, in <nowiki>http://your.domain.com/moodle/admin/cron.php</nowiki>, it is <nowiki>http://your.domain.com/</nowiki>).<br />
<br />
But if you must have it in the web directory (and you are using Apache AND the web server configuration allows .htaccess files to restrict access to directories) then protect it by creating a file in the data directory called '''.htaccess''', containing these lines:<br />
<br />
order deny,allow<br />
deny from all<br />
<br />
If you are using IIS, you need to edit the properties of the data directory (from the Internet Information Services Manager console) and deny access to that folder to everybody from the web.<br />
<br />
<table style=background-color:lightCyan border=1 cellpadding=5 cellspacing=0 ><tr><td><br />
'''If you don't protect the data directory from direct web access, anybody will be able to impersonate any user of your Moodle site (including the admin user!!!), and all of your course materials will be available to the web at large.'''<br />
</table><br />
<br />
'''Ownership & Permissions''': To make sure that Moodle can save uploaded files in this directory, check that the web server software has permission to read, write and execute in this directory. On Unix machines, this means setting the owner of the directory to be something like "nobody" or "apache", and then giving that user read, write and execute permissions. As an example, to change the owner to "nobody" you could use:<br />
<br />
chown -R nobody:apache moodledata<br />
<br />
To change the permissions so that the owner has read,write and execute permissions, use something like this:<br />
<br />
chmod -R 0770 moodledata<br />
<br />
'''Note''': If you are receiving permission denied messages, try ''chmod -R 0770 moodledata'' and then adjust the settings so that they are more secure. A more secure setting is ''chmod -R 0750 moodledata''. According to the comments in config-dist.php, "On hosting systems you might need to make sure that your group has no permissions at all while others have full permissions." To do this you could use ''chmod -R 707 moodledata''. See also the [[Security | security page]].<br />
<br />
Remember that by default moodle will issue a warning about moodle data directories created inside the web directory, but otherwise this directory can be located where you wish. You can later move or change the location of this directory, but if you do, be sure to edit the setting in the '''config.php''' file that sets this; e.g. if moodledata is under a directory called data, then it would look like this:<br />
<br />
$CFG->dataroot = '/data/moodledata';<br />
<br />
<table style=background-color:lightCyan border=1 cellpadding=5 cellspacing=0 ><tr><td><br />
<br />
'''CPanel and webhosts'''<br />
<br />
On cPanel systems you can use the "File Manager" to find the folder, click on it, then choose "Change Permissions". On many shared hosting servers, you will probably need to restrict all file access to your "group" (to prevent other webhost customers from looking at or changing your files), but provide full read/write access to everyone else (which will allow the web server to access your files). Speak to your server administrator if you are having trouble setting this up securely. In particular it will not be possible to create a usable data directory on sites that use a PHP feature known as "'''Safe Mode'''".<br />
</table><br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<br />
== Run the installer script to create config.php ==<br />
<br />
To run the installer script (install.php), just try to access your Moodle main URL using a web browser, or access '''<nowiki>http://yourserver/install.php</nowiki>''' directly.<br />
<br />
(The Installer will try to set a session cookie. If you get a popup warning in your browser make sure you accept that cookie!)<br />
<br />
Moodle will detect that configuration is necessary and will lead you through some screens to help you create a new configuration file called '''config.php'''. At the end of the process Moodle will try and write the file into the right location, otherwise you can press a button to download it from the installer and then upload '''config.php''' into the main Moodle directory on the server.<br />
<br />
Along the way the installer will test your server environment and give you suggestions about how to fix any problems. For most common issues these suggestions should be sufficient, but if you get stuck, check in the Installation Forum for more help.<br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<br />
== Go to the admin page to continue configuration ==<br />
<br />
Once the basic config.php has been correctly created in the previous step, trying to access the front page of your site will take you to the "admin" page for the rest of the configuration.<br />
<br />
The first time you access this admin page, you will be presented with a GPL "shrink wrap" agreement with which you must agree before you can continue with the setup.<br />
<br />
Now Moodle will start setting up your database and creating tables to store data. Firstly, the main database tables are created. You should see a number of SQL statements followed by status messages that look like this:<br />
<br />
CREATE TABLE course (<br />
id int(10) unsigned NOT NULL auto_increment,<br />
category int(10) unsigned NOT NULL default '0',<br />
password varchar(50) NOT NULL default <nowiki>''</nowiki>,<br />
fullname varchar(254) NOT NULL default <nowiki>''</nowiki>,<br />
shortname varchar(15) NOT NULL default <nowiki>''</nowiki>,<br />
summary text NOT NULL,<br />
format tinyint(4) NOT NULL default '1',<br />
teacher varchar(100) NOT NULL default 'Teacher',<br />
startdate int(10) unsigned NOT NULL default '0',<br />
enddate int(10) unsigned NOT NULL default '0',<br />
timemodified int(10) unsigned NOT NULL default '0',<br />
PRIMARY KEY (id)<br />
) TYPE=MyISAM;<br />
<br />
<font color="green">SUCCESS</font><br />
<br />
...and so on, followed by: <font color="green">Main databases set up successfully.</font><br />
<br />
If you don't see these, then there must have been some problem with the database or the configuration settings you defined in config.php. Check that PHP isn't in a restricted "Safe Mode" (commercial web hosts sometimes have safe mode turned on). You can check PHP variables by creating a little file containing '''<?php phpinfo() ?>''' and looking at it through a browser. Check all these and try this page again.<br />
<br />
Scroll down the very bottom of the page and press the "Continue" link.<br />
<br />
You should now see a form where you can define more configuration variables for your installation, such as the default language, SMTP hosts and so on. Don't worry too much about getting everything right just now - you can always come back and edit these later on using the admin interface. The defaults are designed to be useful and secure for most sites. Scroll down to the bottom and click "Save changes".<br />
<br />
If (and only if) you find yourself getting stuck on this page, unable to continue, then your server probably has what I call the "buggy referrer" problem. This is easy to fix: just turn off the "secureforms" setting, then try to continue again.<br />
<br />
Next you will see more pages that print lots of status messages as they set up all the tables required by the various Moodle module. As before, they should all be <font color="green">green</font>.<br />
<br />
Scroll down the very bottom of the page and press the "Continue" link.<br />
<br />
The next page is a form where you can define parameters for your Moodle site and the front page, such as the name, format, description and so on. Fill this out (you can always come back and change these later) and then press "Save changes".<br />
<br />
Finally, you will then be asked to create a top-level administration user for future access to the admin pages. Fill out the details with your own name, email etc and then click "Save changes". Not all the fields are required, but if you miss any important fields you'll be re-prompted for them.<br />
<br />
'''Make sure you remember the username and password you chose for the administration user account, as they will be necessary to access the administration page in future.'''<br />
<br />
(If for any reason your install is interrupted, or there is a system error of some kind that prevents you from logging in using the admin account, you can usually log in using the default username of "'''admin'''", with password "'''admin'''".)<br />
<br />
Once successful, you will be returned to the home page of your new site! Note the administration links that appear down the left hand side of the page (these items also appear on a separate Admin page) - these items are only visible to you because you are logged in as the admin user. All your further administration of Moodle can now be done using this menu, such as:<br />
<br />
* creating and deleting courses<br />
* creating and editing user accounts<br />
* administering teacher accounts<br />
* changing site-wide settings like themes etc<br />
<br />
But you are not done installing yet! There is one very important thing still to do (see the next section on cron).<br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<br />
== Installing Moodle Using Command Line ==<br />
{{Moodle 2.0}}<br />
<br />
Installing Moodle Using command line is just as easy as installing Moodle using web browser. <br />
* First Go to the moodle root directory and then to admin directory inside the moodle root. <br />
<br />
$cd /var/www/html/moodle/admin<br />
<br />
* Then simply use the following syntax to run the moodle command line installer (this is a long command which has been split over 3 lines, so type as one line)<br />
$php cliupgrade.php --lang=en --webaddr=<nowiki>http://www.example.com</nowiki> --moodledir=/var/www/html/moodle <br />
--datadir=/var/moodledata --dbtype=mysql --dbhost=localhost --dbname=moodle <br />
--dbuser=root --prefix=mdl --verbose=1 --interactivelevel=2 <br />
<br />
More information about the options can be found using <br />
$php cliupgrad.php --help<br />
<br />
Then you will see the following list of available options<br />
<br />
--lang Valid installed language for installation. Default is English(en)<br />
--webaddr Web address for the Moodle site<br />
--moodledir Location of the moodle web folder<br />
--datadir Location of the moodle data folder (should not be web visible)<br />
--dbtype Database type. Default it mysql<br />
--dbhost Database host. Default localhost<br />
--dbname Database name. Default is moodle<br />
--dbuser Database user. Default is blank<br />
--dbpass Database password. Default is blank<br />
--prefix Table prefix for above database tables. Default is mdl<br />
--verbose 0 No output, 1 Summarized output(Default), 2 Detailed output<br />
--interactivelevel 0 Non interactive, 1 Semi interactive(Default), 2 Interactive<br />
--help print out this help<br />
<br />
When you choose non interactive mode without any options all the default values are assumed.<br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<br />
== Set up cron ==<br />
<br />
Moodle's background tasks (e.g. sending out forum emails and performing course backups) are performed by a script which you can set to execute at specific times of the day. This is known as a cron script. Please refer to the [[Cron|Cron instructions]].<br />
<br />
== Set up backups ==<br />
<br />
Please refer to the [[Backup settings| backup instructions]].<br />
<br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<br />
== Create a new course ==<br />
<br />
Now that Moodle is running properly, you can try creating a new course to play with.<br />
<br />
Select "Create a new course" from the Admin page (or the admin links on the home page).<br />
<br />
Fill out the form, paying special attention to the course format. You don't have to worry about the details too much at this stage, as everything can be changed later by the teacher. Note that the yellow help icons are everywhere to provide contextual help on any aspect.<br />
<br />
Press "Save changes", and you will be taken to a new form where you can assign teachers to the course. You can only add existing user accounts from this form - if you want to create a new teacher account then either ask the teacher to create one for themselves (see the login page), or create one for them using the "Add a new user" on the Admin page.<br />
<br />
Once done, the course is ready to customize, and is accessible via the "Courses" link on the home page.<br />
<br />
==See also==<br />
<br />
* [[Installation FAQ]]<br />
* [[Complete install packages]] might be an easier first time installs on some systems<br />
* Help forum: [http://moodle.org/mod/forum/view.php?id=28 Installation problems]<br />
* [[Installing Apache, MySQL and PHP]] - Open source programs that can run Moodle on the web or on a desktop<br />
* [[Upgrading Moodle]]<br />
* Using Moodle [http://moodle.org/mod/forum/discuss.php?d=42688 Selecting a web host for Moodle] forum discussion<br />
* [[masquerading|Masquerading]] - Running Moodle behind a masquerading/NAT firewall<br />
<br />
[[Category:Installation]]<br />
<br />
[[cs:Instalace]]<br />
[[de:Installieren von Moodle]]<br />
[[es:Instalación de moodle]]<br />
[[fr:Installation de Moodle]]<br />
[[ja:Moodleのインストール]]<br />
[[nl:Installatiegids]]<br />
[[pl:Instalacja Moodle]]<br />
[[pt:Instalação do Moodle]]<br />
[[ru:Установка Moodle]]<br />
[[sk:Inštalácia]]<br />
[[zh:安装Moodlezh:]]</div>Kawhttps://docs.moodle.org/20/en/index.php?title=Administration_hacks&diff=42663Administration hacks2008-08-25T16:00:19Z<p>Kaw: /* Display Performance Info to admins only */ Typos</p>
<hr />
<div>Here are some hacks or tweaks to Moodle code that administrators have found useful on their sites to fill specific needs. <br />
<br />
== Approve account creation by self-registration before the new user gains access ==<br />
<br />
In /lib/moodlelib.php, search for the function send_confirmation_email. Change this line of the function (around line 4339 in 1.9.1+):<br />
return email_to_user($user, $supportuser, $subject, $message, $messagehtml);<br />
<br />
to:<br />
return email_to_user($supportuser, $supportuser, $subject, $message, $messagehtml);<br />
<br />
The confirmation e-mail is sent to the administrator (and not to the new user). Checking the list of user accounts (as Admin on the site), there is link to confirm the account (edit/delete/confirm). Once this is done the administrator can forward the e-mail to the new user (but the account is already approved). (1)<br />
<br />
== Send a duplicate of the registration email to the administrator ==<br />
<br />
In /lib/moodlelib.php, search for the function send_confirmation_email (around line 3629 in 1.8.4+). At the end of the function there is a line that reads (2):<br />
return email_to_user($user, $from, $subject, $message, $messagehtml);<br />
<br />
Just before that line, add a line like this:<br />
email_to_user($from, $from, $subject, $message, $messagehtml);<br />
<br />
== Set default course blocks rather than using sticky blocks ==<br />
<br />
In moodle/config.php, change lines 20-25:<br />
<br />
Find the defaultblocks_topics line and replace with this. Also change the string for defaultblocks_weeks. Don’t change social though (3).<br />
$CFG->defaultblocks_topics = ‘course_menu,myCourses:activity_modules,calendar_upcoming,quickmail’;<br />
$CFG->defaultblocks_weeks = ‘course_menu,myCourses:activity_modules,calendar_upcoming,quickmail’;<br />
<br />
== Turn quickgrade on as default, increase default number of assignments shown to 20, and remove instructor from the list ==<br />
<br />
In moodle/mod/assignment/lib.php, change line 682 (3):<br />
$perpage = get_user_preferences(’assignment_perpage’, 20);<br />
<br />
In line 684:<br />
$quickgrade = get_user_preferences(’assignment_quickgrade’, 1);<br />
<br />
In line 982:<br />
$teacherattempts = false; /// Temporary measure<br />
<br />
== Increase the number of course summaries displayed before going to collapsed mode in category view ==<br />
<br />
The following change was made in course/lib.php. Line 13 should read (3):<br />
define(’COURSE_MAX_SUMMARIES_PER_PAGE?‘, 25); // courses<br />
<br />
== Allow admins to edit posts after closing ==<br />
<br />
In moodle/config.php file, add the following two lines (3):<br />
<br />
// Setting this to true will enable admins to edit any post at any time<br />
// $CFG->admineditalways = true;<br />
<br />
except uncomment the second line (remove the two slashes):<br />
<br />
// Setting this to true will enable admins to edit any post at any time<br />
$CFG->admineditalways = true;<br />
<br />
== Change the default course settings to create topic courses instead of weekly courses ==<br />
<br />
In course/edit.php, change line 98 (3):<br />
$mform->setDefault(’format’, ‘weeks’);<br />
<br />
to:<br />
$mform->setDefault(’format’, ‘topics’);<br />
<br />
If you wanted to, you could change the default number of topics/weeks in a course. Change line 104 in this same file according to your needs:<br />
$mform->setDefault(’numsections’, 10);<br />
<br />
== Increase shortname field length in the course request form and the course creation form ==<br />
<br />
In moodle/course/edit_form.php, change line 72 (3):<br />
$mform->addElement(’text’,’shortname’, get_string(’shortname’),’maxlength=”25″ size=”25″‘);<br />
<br />
In moodle/course/request_form.php, change line 13:<br />
$mform->addElement(’text’, ’shortname’, get_string(’shortname’), ‘maxlength=”25″ size=”25″‘);<br />
<br />
== Access courses with a permanent user friendly URL ==<br />
<br />
The idea is to access a course with a user friendly URL instead of the usual cryptic way.<br />
In this example we will propose URLs for courses based on their short names, in the form:<br />
<br />
http://moodle.some.where.org/pages/SHORTNAME<br />
<br />
where SHORTNAME is the exact name defined on the course settings (case sensitive).<br />
<br />
There are, however, some limitations on the characters that can be used to achieve this due to URL special characters.<br />
In this example the allowed set of characters is [ A-Z a-z 0-9 - _ . @ ].<br />
<br />
So you have to change apache configuration in the global or VirtualHost section:<br />
RewriteEngine on<br />
#uncomment the following two lines if you want to debug<br />
#RewriteLog "/var/log/httpd/rewrite.log"<br />
#RewriteLogLevel 9<br />
<br />
#pages@moodle<br />
RewriteRule ^/pages/([A-Za-z0-9\-\_\.\@]+)/?$ /course/view.php?name=$1 [R,L]<br />
RewriteRule ^/pages/ / [R,L]<br />
<br />
== Prevent "Welcome to course" emails ==<br />
<br />
You can stop moodle sending enrolment emails by changing two lines in the file ''/enrol/enrol.class.php''(4).<br />
<br />
The line (occuring twice in the file!) reads:<br />
email_to_user($USER, $teacher, $subject, $message);<br />
<br />
It must be changed to:<br />
// email_to_user($USER, $teacher, $subject, $message);<br />
<br />
That way, moodle ignores the e-mail-command until you change back to the original line. The setting works for all courses at the same time. It does not affect other e-mails being sent (e.g. the login confirmation).<br />
<br />
== Display Performance Info to admins only ==<br />
<br />
Moodle can be set to display some useful performance information in the footer (Site Administration -> Server -> Debugging -> Performance info), but sometimes you may not want users to see this information on a production site. Follow these steps to only display this information to administrators:<br />
<br />
* Using your editor, open the file /lib/weblib.php and search for the first occurrence of the text $performanceinfo = ''; (around line 2957).<br />
* Add this text as the next line<br />
<br />
if ($CFG->adminonlyperfinfo and isadmin()) {<br />
<br />
* Look further down the code a few lines for the last brace character (}) and add an extra one on its own. Your text should now look like this (the added lines are shown '''in bold'''):<br />
<br />
/// Provide some performance info if required<br />
$performanceinfo = '';<br />
'''if ($CFG->adminonlyperfinfo and isadmin()) {'''<br />
if (defined('MDL_PERF') || (!empty($CFG->perfdebug) and $CFG->perfdebug > 7)) {<br />
$perf = get_performance_info();<br />
if (defined('MDL_PERFTOLOG') && !function_exists('register_shutdown_function')) {<br />
error_log("PERF: " . $perf['txt']);<br />
}<br />
if (defined('MDL_PERFTOFOOT') || debugging() || $CFG->perfdebug > 7) {<br />
$performanceinfo = $perf['html'];<br />
}<br />
}<br />
'''}'''<br />
<br />
* Save the file /lib/weblib.php<br />
* Edit your moodle/config.php file and add the line<br />
<br />
$CFG->adminonlyperfinfo = true;<br />
<br />
This sets the flag to make the code display the performance info only for admins.<br />
<br />
== References ==<br />
<br />
#[http://moodle.org/mod/forum/discuss.php?d=97938 Discussion forum in moodle.org: Admin approving self registrations?]<br />
#[http://moodle.org/mod/forum/discuss.php?d=92958 Discussion forum in moodle.org: Self registration with validation]<br />
#[http://awyatt.edublogs.org/2008/04/30/republishing-favorite-moodle-hacks/ Blog post: Republishing favorite Moodle hacks by A. Wyatt]<br />
#[http://moodle.org/mod/forum/discuss.php?d=18583 Discussion forum in moodle.org: Stopping "Welcome to the course" emails]<br />
<br />
[[Category:Administrator]]</div>Kawhttps://docs.moodle.org/20/en/index.php?title=Installing_Moodle&diff=42662Installing Moodle2008-08-25T15:40:17Z<p>Kaw: /* Installing Moodle Using Command Line */ Reformat</p>
<hr />
<div>'''Firstly don't panic! :-)'''<br />
<br />
This guide explains how to install Moodle for the first time. For some of these steps it goes into a lot of detail to try and cover the majority of possible web server setups, so this page may look long and complicated. Don't panic, once you know how to do it you can install Moodle in minutes!<br />
<br />
If you have problems please read this page carefully - most common issues are answered in here. If you still have trouble, you can seek help from the Moodle community via [http://moodle.org/course/view.php?id=5 moodle.org Using Moodle].<br />
<br />
Another option is to contact a [http://moodle.com/hosting/ Moodle Partner providing Moodle hosting] who can completely maintain Moodle for you, so that you can ignore all this and get straight into educating! A Moodle partner is the preferred option but if you decide to choose a hosting company that has cpanel then [http://otaru-jc.ac.jp/hagley/settingupmoodleonhostingwithcpanel.swf this tutorial will guide you] through the process of choosing a host and setting up moodle via cpanel (had not been available the last few weeks; now tentatively seems to be available again; see [http://englishforum.sgu.ac.jp/moodle/ this portal page]). <br />
<br />
'''Warning:''' some hosting companies offer one-click moodle install options, which whilst sometimes effective, usually use old (sometimes years old) versions of moodle and sometimes simply don't work. If one of these goes wrong, your best bet is often to start from scratch following the instructions here yourself. Its almost certainly quicker.<br />
<br />
If you want to run Moodle on your own computer and this page looks a bit daunting, then please see our guides on how to install one of Moodle's complete [[Complete install packages for Windows|Windows packages]], [[Complete Install Packages for Mac OS X|Mac OS packages]] or [[Installing AMP |Installing Apache, MySQL and PHP(AMP)]]. They provide alternative instructions to install all this on most popular platforms.<br />
<br />
==Table of Contents==<br />
__TOC__<br />
<br />
==Requirements==<br />
<br />
Moodle is primarily developed in Linux using [[Apache]], [[MySQL]] and [[PHP]] (also sometimes known as the LAMP platform), but is also regularly tested with Windows XP/2000/2003 (WAMP), Solaris 10 (Sparc and x64), Mac OS X and Netware 6 operating systems. Support for PostgreSQL, Oracle and Microsoft SQL Server is also available.<br />
<br />
The procedure for installing Moodle on the Windows platform (e.g. Windows Server, IIS and MSSQL) varies slightly to the procedure for the LAMP platform. See [[Installation for Windows 2003 with IIS]] for more details.<br />
<br />
'''Blank page problem while installing Moodle on Windows Vista may occur; following these steps: [[Installing Moodle on Windows Vista]] might help.<br />
<br />
'''Note if you are using a hosted account''': Most web hosts support all of these requirements by default. You should contact your web host's support desk to check that this is the case '''before''' signing-up with them. It is especially important to ask about any PHP memory limits or MySQL question limits. If your prospective host does not provide a service which meets these requirements, or you are already signed up with them, ask them why and consider taking your business elsewhere if they do not change.<br />
<br />
The requirements for Moodle are as follows:<br />
<br />
'''Hardware''' (unless you are using a hosted server). <br />
* Disk space: 160MB free (min). You will require more free space to store your teaching materials.<br />
* Memory: 256MB (min), 1GB (recommended). The general rule of thumb is that Moodle can support 50 ''concurrent'' users for every 1GB of RAM, but this will vary depending on your specific hardware and software combination. <br />
'''Software'''<br />
* Web server software. Most people use [[Apache]], but Moodle should work fine under any web server that supports [[PHP]], such as [[IIS]] on Windows platforms. PHP does impose requirements on versions of web servers, however these are complex and the general advice is to use the newest version possible of your chosen web server. <br />
* PHP scripting language. (Please note that there have been issues installing Moodle with [http://www.php-accelerator.co.uk PHP-Accelerator]). There are currently two versions (or branches) of PHP available: PHP4 and PHP5 and the version requirements are listed below.<br />
** For Moodle version 1.4 or later: PHP4 (version 4.1.0 or later) or PHP5 (version 5.1.0 or later) are supported.<br />
** For Moodle version 1.6 or later: the PHP4 (version 4.3.0 or later) or PHP5 (version 5.1.0 or later) are supported. <br />
** Future Moodle versions 2.0 or later will not support PHP4 and will require PHP5 (version 5.2.0 or later).<br />
** PHP Settings. Check these settings in your php.ini or .htaccess file (if you're using Apache). For settings which use ON/OFF as their values, you can substitute 1 for ON and 0 for OFF if you prefer. <br />
*** ''safe_mode'' needs to be OFF.<br />
*** ''memory_limit'' should be at least 16M (32M is recommended for Moodle 1.7 and 40M for Moodle 1.8 or later). Large sites may need more than 128M. PHP 5.2.x requires higher memory_limit values than previous versions of PHP. 64bit operating systems require even more memory.<br />
*** ''session.save_handler'' needs to be set to FILES.<br />
*** ''magic_quotes_gpc'' should be ON. (It will be recommended to turn it off in 2.0.)<br />
*** ''magic_quotes_runtime'' needs to be OFF.<br />
*** ''file_uploads'' needs to be ON.<br />
*** ''session.auto_start'' needs to be OFF.<br />
*** ''session.bug_compat_warn'' needs to be OFF.<br />
** PHP Extensions and libraries<br />
*** The mbstring extension is recommended for Moodle 1.6 or later.<br />
*** The iconv extension is recommended for Moodle 1.6 or later.<br />
*** [http://www.libgd.org/ GD library] and the [http://www.freetype.org/ FreeType 2] library and extensions are needed to be able to look at the dynamic graphs that the logs pages make.<br />
*** The mysql extension is required if you are using the MySQL database. Note that in some Linux distributions (notably Red Hat) this is an optional installation.<br />
*** The pgsql extension is required if you are using the PostgreSQL database.<br />
*** The pdo and pdo_sqlite extensions are required for the (experimental) SQLite 3 database support.<br />
*** The curl extension is recommended for Moodle 1.8 or later.<br />
*** The tokenizer extension is recommended for Moodle 1.8 or later.<br />
*** The curl and openssl extensions are required for the Moodle network functionality (Moodle 1.8 or later).<br />
*** Other PHP extensions may be required to support optional Moodle functionality, especially external authentication and/or enrolment (e.g. LDAP extension for LDAP authentication and the sockets extension for Chat server).<br />
* A working database server: [[MySQL]] or [[PostgreSQL]] are completely supported and recommended for use with any version of Moodle. Support for Microsoft SQL Server and Oracle has been added in Moodle 1.7. MySQL is ''the'' choice for many people because it is very popular, but there are some [[Arguments in favour of PostgreSQL|arguments in favour of PostgreSQL]], especially if you are planning a large deployment.<br />
** For Moodle 1.5, MySQL (version 3.23 or later) or PostgreSQL (7.4 or later). <br />
** For Moodle 1.6, MySQL (version 4.1.12 or later) or PostgreSQL (7.4 or later).<br />
** For Moodle 1.7, MySQL (version 4.1.12 or later), PostgreSQL (7.4 or later) or Microsoft SQL Server 2005 (version 9 or [http://moodle.org/mod/forum/discuss.php?d=59284 SQL Server Express 2005])<br />
** For Moodle 1.8 or later, MySQL (version 4.1.12 or later), PostgreSQL (8.0 or later) or Microsoft SQL Server 2005 (version 9 or [http://moodle.org/mod/forum/discuss.php?d=59284 SQL Server Express 2005])<br />
: MySQL Notes: For Moodle 1.6 or later, If you use latin languages only you can use MySQL 4.1.12. If you are using non-latin languages you require MySQL 4.1.16 or later. Currently the MySQL setting "strict mode" must be OFF (set to "" or "MYSQL40") in the MySQL configuration file. <br />
: PostgreSQL Notes: PostgreSQL 7.4 is recommended for earlier Moodle versions, since Moodle 1.8 only PostgreSQL 8.0 and above are supported.<br />
* For showcases or low to medium-sized installations, Moodle 2.0 also includes (experimental) support for SQLite 3 database. This setup requires no database server, as the database file is stored in a local directory on the server.<br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<br />
== How many users? ==<br />
<br />
In addition to the hardware and software requirements, you will also need to think about the capacity of your Moodle installation in terms of the number of users it can handle. There are two numbers to plan for:<br />
<br />
* '''Browsing users''': the maximum number of users able to browse your Moodle site. This is the number of computers in your organization or on your course (whichever is greater).<br />
* '''Concurrent database users''': the maximum number of concurrent database users (needed for Moodle activities such as quizzes). This is the number of users who will be using Moodle at the same time. In an educational institution, use your timetable/roster to obtain this figure.<br />
<br />
Once you know these figures for your users, you can start work out if your Moodle installation can support this capacity. The exact number of users depends on your hardware/software/network combination. Usually the amount of memory installed (RAM) is the deciding factor but a faster overall processor speed will also help in reducing waiting times for pages to load. <br />
<br />
The general rule of thumb for a single server is that the approx max concurrent users = RAM (GB) * 50 and the approx max browsing users = Approx max concurrent users * 5. As an example, a university with 500 total computers on campus and 100 concurrent users at any time will need approx 2GB of RAM on the one server to support the number of concurrent users.<br />
<br />
'''Note if you are using a hosted account''': Ask your provider what limits are placed on the number of concurrent database connections and the processor load. This will give a good estimate of the number of users your Moodle install can manage.<br />
<br />
'''Note:''' As of August 31, 2007, Moodle 1.8.2+ is not recommended for large installations, especially if you have large number (e.g. 20,000+) of courses. The main reason is the codes related to ROLES are still not fully optimized with database queries and still need some work. If you are planning to use 1.8.x codes for a larger institution, please make sure that you have sufficient time to do your own testing and performance profiling. Upgrade to Moodle 1.9!!<br />
<br />
[Update] This performance issue has been improved quite a bit in the most recent 1.8.3+ version (see this thread discussion: http://moodle.org/mod/forum/discuss.php?d=83281). Moodle 1.9 has even more improvements in all areas and is the recommended version.<br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<br />
== Download and copy files into place ==<br />
<br />
There are two ways to get Moodle, either as a compressed package or via CVS. <br />
* There are two types of compressed packages on the [http://download.moodle.org/ download page: http://download.moodle.org/], the standard distribution with Moodle only files and the [[Complete install packages|complete install]], which contains programs to operate Moodle in a web environment. <br />
* To use CVS, helpful instructions are available at the [[CVS_for_Administrators | CVS for Administrators]] page. The full [http://cvs.moodle.org/moodle/ Moodle CVS repository] is also available for browsing. <br />
<br />
After downloading, unpack the archive using either <br />
tar -zxvf [filename]<br />
or<br />
unzip [filename]<br />
as appropriate. <br />
<br />
If using CVS, run the CVS Checkout command.<br />
<br />
You will now be left with a directory called "moodle", containing a number of files and folders.<br />
<br />
You can either place the whole folder in your web server documents directory, in which case the site will be located at '''<nowiki>http://yourwebserver.com/moodle</nowiki>''', or you can copy all the contents straight into the main web server documents directory, in which case the site will be simply '''<nowiki>http://yourwebserver.com</nowiki>'''.<br />
<br />
If you are downloading Moodle to your local computer and then uploading it to your web site, it is usually better to upload the whole archive as one file, and then do the unpacking on the server. Even web hosting interfaces like cPanel allow you to uncompress archives in the "File Manager".<br />
<br />
=== Structure of moodle directory ===<br />
<br />
You can safely skip this section, but here is a quick summary of the contents of the Moodle folder, to help get you oriented:<br />
<br />
:''config.php'' - contains basic settings. This file does not come with Moodle - you will create it.<br />
:''install.php'' - the script you will run to create config.php<br />
:''version.php'' - defines the current version of Moodle code<br />
:''index.php'' - the front page of the site<br />
:''admin/'' - code to administrate the whole server<br />
:''auth/'' - plugin modules to authenticate users<br />
:''blocks/'' - plugin modules for the little side blocks on many pages<br />
:''calendar/'' - all the code for managing and displaying calendars<br />
:''course/'' - code to display and manage courses<br />
:''doc/'' - help documentation for Moodle (eg this page)<br />
:''files/'' - code to display and manage uploaded files<br />
:''lang/'' - texts in different languages, one directory per language<br />
:''lib/'' - libraries of core Moodle code<br />
:''login/'' - code to handle login and account creation<br />
:''mod/'' - all the main Moodle course modules are in here<br />
:''pix/'' - generic site graphics<br />
:''theme/'' - theme packs/skins to change the look of the site.<br />
:''user/'' - code to display and manage users<br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<br />
== Setting-up your system==<br />
To ensure that Moodle will install successfully, you need to check that the web server settings are correct, then create a blank database for Moodle to use and finally create a directory on your hard disk for Moodle to save your materials and other files you upload into your courses.<br />
<br />
=== Check web server settings ===<br />
<br />
*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. Mine usually looks like this:<br />
<br />
'''DirectoryIndex''' index.php index.html index.htm<br />
<br />
:Just make sure index.php is in the list (and preferably towards the start of the list, for efficiency).<br />
<br />
*Secondly, '''if you are using Apache 2''', then you should turn on the ''AcceptPathInfo'' variable, which allows scripts to be passed arguments like <nowiki>http://server/file.php/arg1/arg2</nowiki>. 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. (NB: This setting, or any equivalent, is not required in Apache 1)<br />
<br />
'''AcceptPathInfo''' on<br />
<br />
=== Recheck PHP settings ===<br />
Moodle requires a number of PHP settings to be active for it to work. These were given in the Requirements section and '''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, so it is useful to double-check that the settings are correct. These are defined in PHP's configuration file (usually called '''php.ini''') or in the Apache '''.htaccess''' file:<br />
<br />
safe_mode = 0 (necessary)<br />
memory_limit = 40M (varies: minimum 16M, 32M Moodle v1.7, 40M Moodle v1.8, 128M large sites)<br />
session.save_handler = files (unless you are using another handler, e.g. mm) <br />
magic_quotes_gpc = 1 (preferred but not necessary, 0 will be recommended in 2.0)<br />
magic_quotes_runtime = 0 (necessary)<br />
file_uploads = 1<br />
session.auto_start = 0<br />
session.bug_compat_warn = 0<br />
<br />
You may also want to set other, optional php.ini file settings while you are already editing it. For instance, you may want to reset the maximum upload size of file attachments, which usually defaults to 2M(egabytes). For instance, to set these to 16 Megabytes:<br />
<br />
post_max_size = 16M<br />
upload_max_filesize = 16M<br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<br />
=== Using a .htaccess file for webserver and PHP settings ===<br />
<br />
Use the above if you can directly edit your server's files, but if you are setting-up Moodle on a webhost, or 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. This only works on Apache servers and only when Overrides have been allowed in the main Apache configuration. Moodle is supplied with a htaccess file which you can use, or you can create your own file manually.<br />
<br />
* '''Use the default htaccess file'''. The easiest thing to do is just copy the sample file from moodle/lib/htaccess and edit it to suit your needs. It contains further instructions. For example, in a Unix shell:<br />
<br />
cd moodle<br />
cp moodle/lib/htaccess .htaccess<br />
<br />
* '''Create your own file'''. Alternatively you can create your own file called '''.htaccess''' in Moodle's main directory that contains lines like the following. <br />
<br />
DirectoryIndex index.php index.html index.htm<br />
php_value memory_limit 40M (adjust to your version of Moodle)<br />
php_flag magic_quotes_gpc 1<br />
php_flag magic_quotes_runtime 0<br />
php_flag file_uploads 1<br />
php_flag session.auto_start 0<br />
php_flag session.bug_compat_warn 0<br />
<br />
:If you have Apache version 2 installed, add these lines:<br />
<br />
<IfDefine APACHE2><br />
AcceptPathInfo on<br />
</IfDefine><br />
<br />
:Otherwise add this single line:<br />
<br />
AcceptPathInfo on<br />
<br />
:Optionally, you can also do things like define the maximum size for uploaded files, etc by adding these lines:<br />
<br />
LimitRequestBody 0<br />
php_value upload_max_filesize 2M<br />
php_value post_max_size 2M<br />
<br />
:The value given in these lines is 2M. You may want to change this at a later date to allow uploading of larger files.<br />
<br />
<br />
<table style=background-color:lightCyan border=1 cellpadding=5 cellspacing=0 ><tr><td><br />
Several hosting services that uses Apache 2 and php 5.x does not allow php flags and values to be set from within .htaccess file. It may be necessary to place a php.ini file within each sub-directory of the site :-( .<br />
</td></tr></table><br />
<br />
# Make one php.ini file in the main moodle directory tree and later copy it to all sub-directories. the syntax is a little bit different than the one used in .htaccess. (see sample after section 2)<br />
# Run the script http://tips-scripts.com/php_ini_copy or copy php.ini manually to all sub-directories.<br />
:php.ini (sample):<br />
upload_max_filesize = 2M<br />
post_max_size = 2M<br />
<br />
<br />
<br />
*'''Some shared hosts use suPHP, which requires a slightly different configuration'''. If everything else fails, try creating the following two files and uploading to your moodle root directory<br />
:php.ini (sample):<br />
register_globals = 0<br />
display_errors = 0<br />
<br />
:.htaccess (sample):<br />
suPHP_ConfigPath /home/cPanelName/public_html/moodle<br />
<br />
'''Change the above path to the actual path to your moodle install'''<br />
<br />
<br />
<br />
*'''Before you go into this adventure make sure you really need those php instructions in your site.'''<br />
<br />
*'''Note''': Use a .htaccess file only [http://httpd.apache.org/docs/1.3/howto/htaccess.html#when as a last resort] as it can have an impact on the performance of your Moodle site and cause pages to load slowly on your browser.<br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<br />
=== Creating an empty database ===<br />
<br />
You need to create an empty database (eg "''moodle''") in your database system along with a special user (eg "moodleuser") that has access to that database (and that database only). You could use the "root" user if you wanted to for a test server, but this is not recommended for a production system: if hackers manage to discover the password then your whole database system would be at risk, rather than just one database.<br />
<br />
::'''Warning''': Bear in mind that, as of Moodle version 1.5.x, Moodle doesn't work with MySQL 5.x's strict mode setting (STRICT_TRANS_TABLES and/or STRICT_ALL_TABLES) -- see [http://moodle.org/mod/forum/discuss.php?d=58552 forum discussion]. So if you are using MySQL 5.x, edit MySQL's configuration file (called "my.ini" in Windows and "my.cnf" on Unix/Linux) and comment out that option or set it to <code>sql-mode=''</code>. You have to restart MySQL after changing this setting. <br><br> If you do not have access to your server, use PHPMyAdmin (or another MySQL client) and enter the command <code>SET @@global.sql_mode='';</code> (be sure to use single quotes, and don't forget the semicolon).<br />
<br />
<table style=background-color:lightCyan border=1 cellpadding=5 cellspacing=0 ><tr><td><br />
====Using a hosted server====<br />
If you are using a webhost, they will probably have a control panel web interface for you to create your database.<br />
<br />
The '''[http://www.cpanel.com/ cPanel]''' system is one of the most popular of these. <br />
To create a database using cPanel:<br />
<br />
# Click on the '''MySQL Databases''' icon.<br />
# Type '''moodle''' in the New Database field and click '''Create Database'''.<br />
# Type a ''username'' and ''password'' (not one you use elsewhere) in the respective fields and click '''Create User'''.<br>Note that the ''username'' and ''database'' names may be prefixed by your cPanel account name and an underscore, and truncated to 16 characters. When entering this information into the Moodle installer - use the full names.<br />
# Now use the '''Add Users to Databases''' button and give this new user account '''ALL''' rights to the new database.<br />
<br />
Continue with [[Installing_Moodle#CreatDataDir |Creating the data directory]]<br />
<br />
</td></tr></table><br />
<br />
<table style=background-color:lightCyan border=1 cellpadding=5 cellspacing=0 ><tr><td><br />
====Using a SQLite database====<br />
SQLite is a software library that implements a self-contained, serverless, zero-configuration, transactional SQL database engine.<br />
<br />
Moodle 2.0 offers support for SQLite3 database installations. In this case, no database setup is required. The database file will be created by the installation script. By default, the database file will be store in Moodle's data directory (see [[Installing_Moodle#CreatDataDir |Creating the data directory]]). During install, the web server must have write access on the directory where the database file will be stored. After installation, the web server must have read-write access to the database file.<br />
<br />
Continue with [[Installing_Moodle#CreatDataDir |Creating the data directory]]<br />
<br />
</td></tr></table><br />
<br />
<br />
====Using the command line====<br />
<br />
If you have access to Unix or Windows command lines then you can do the same sort of thing by typing commands. You should do this using the MySQL Client program as follows (commands which you type-in are shown in bold):<br />
<br />
- Start the MySQL Client program:<br />
#'''mysql -u root -p'''<br />
Enter password:<br />
Welcome to the MySQL monitor. Commands end with ; or \g.<br />
Your MySQL connection id is 2 to server version: 5.0.22-log<br />
<br />
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.<br />
<br />
mysql><br />
<br />
- The prompt changes to "mysql>" to indicate that you are now working in the MySQL Client program. When working in MySQL, all commands which you type-in must end in a semi-colon. (If you hit the Enter key without the final semi-colon, you'll get the line continuation symbol '->'; this is your second chance to type the semi-colon and hit Enter.) <br />
<br />
- Begin by checking for any existing databases called "moodle" - if there are any you should change the name in all the commands which follow:<br />
mysql> '''SHOW DATABASES;'''<br />
+-------------------------+<br />
| Database |<br />
+-------------------------+<br />
| information_schema |<br />
| mysql |<br />
| test |<br />
+-------------------------+<br />
3 rows in set (0.03 sec)<br />
<br />
- Create a database to store the Moodle tables. We'll call this "moodle", as there are none with that name already in the above list, but change it if you need to.<br />
mysql> '''CREATE DATABASE moodle;'''<br />
Query OK, 1 row affected (0.00 sec)<br />
<br />
- Change the default character set and collation of the "moodle" database to UTF8. Leave this out if you are installing Moodle 1.5 or earlier):<br />
mysql> '''ALTER DATABASE moodle DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;'''<br />
Query OK, 1 row affected (0.00 sec)<br />
<br />
- Create a username and password to access the database "moodle" and grant database access permissions. We'll call the user "moodleuser" and set the password as "yourpassword". It's a good idea to change these for your installation however most people keep the username as "moodleuser". Remember the username and password you have set, as you'll need it in the configuration screens later. This is a long command so has been split over several lines by pressing the Return key.<br />
mysql> '''GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,'''<br />
-> '''DROP,INDEX,ALTER ON moodle.*'''<br />
-> '''TO moodleuser@localhost IDENTIFIED BY 'yourpassword';'''<br />
Query OK, 0 rows affected (0.01 sec)<br />
<br />
:'''Security Warnings''': Never leave the password as the one shown here. Make sure you have a strong password (a mixture of letters and numbers, upper and lower case). Avoid granting "ALL" permissions on the database.<br />
: '''Note''': For MySQL 4.0.1 or earlier, you don't need the CREATE TEMPORARY TABLES permission. <br />
<br />
- Exit the MySQL Client program:<br />
mysql> '''QUIT'''<br />
Bye<br />
#<br />
<br />
- Reload the grant tables using the mysqladmin program:<br />
#'''mysqladmin -u root -p reload'''<br />
Enter password:<br />
#<br />
<br />
And some example command lines for PostgreSQL:<br />
<br />
# su - postgres<br />
> psql -c "create user moodleuser createdb;" template1<br />
> psql -c "create database moodle <font color="red">with encoding 'unicode'</font>;" -U moodleuser template1<br />
> psql -c "alter user moodleuser nocreatedb;" template1<br />
> psql -c "alter user moodleuser with encrypted password 'yourpassword';" template1<br />
> su - root<br />
# /etc/init.d/postgresql reload<br />
<br />
If the Postgres create database command above (>psql -c "create database moodle...") gives an error message you may want to try:<br />
psql -c "create database moodle with template=template1 encoding = 'unicode' owner = moodleuser <br> location = '/var/mydata';"<br />
<br />
If the create database command asks you for a password, run the line containing 'encrypted password' first before proceeding.<br />
<br />
'''See also''':<br />
* Step-by-step instructions on [https://docs.moodle.org/en/Step-by-step_Install_Guide_for_Ubuntu installation for Ubuntu(Debian)]<br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<br />
=== Creating the data directory ===<br />
<br />
Moodle will also need some space on your server's hard disk to store uploaded files, such as course documents and user pictures. The Moodle installer tries hard to create the '''moodledata''' directory for you but if it fails then you will have to create a directory for this purpose manually.<br />
<br />
'''Security warning''': For security purposes, it is '''CRITICAL''' that this directory is '''NOT''' accessible directly via the web. The easiest way to do this is to simply locate it OUTSIDE the web site root directory (it is the folder that the main part of your URL -that is, the part up to the first single / - points to; for example, in <nowiki>http://your.domain.com/moodle/admin/cron.php</nowiki>, it is <nowiki>http://your.domain.com/</nowiki>).<br />
<br />
But if you must have it in the web directory (and you are using Apache AND the web server configuration allows .htaccess files to restrict access to directories) then protect it by creating a file in the data directory called '''.htaccess''', containing these lines:<br />
<br />
order deny,allow<br />
deny from all<br />
<br />
If you are using IIS, you need to edit the properties of the data directory (from the Internet Information Services Manager console) and deny access to that folder to everybody from the web.<br />
<br />
<table style=background-color:lightCyan border=1 cellpadding=5 cellspacing=0 ><tr><td><br />
'''If you don't protect the data directory from direct web access, anybody will be able to impersonate any user of your Moodle site (including the admin user!!!), and all of your course materials will be available to the web at large.'''<br />
</table><br />
<br />
'''Ownership & Permissions''': To make sure that Moodle can save uploaded files in this directory, check that the web server software has permission to read, write and execute in this directory. On Unix machines, this means setting the owner of the directory to be something like "nobody" or "apache", and then giving that user read, write and execute permissions. As an example, to change the owner to "nobody" you could use:<br />
<br />
chown -R nobody:apache moodledata<br />
<br />
To change the permissions so that the owner has read,write and execute permissions, use something like this:<br />
<br />
chmod -R 0770 moodledata<br />
<br />
'''Note''': If you are receiving permission denied messages, try ''chmod -R 0770 moodledata'' and then adjust the settings so that they are more secure. A more secure setting is ''chmod -R 0750 moodledata''. According to the comments in config-dist.php, "On hosting systems you might need to make sure that your group has no permissions at all while others have full permissions." To do this you could use ''chmod -R 707 moodledata''. See also the [[Security | security page]].<br />
<br />
Remember that by default moodle will issue a warning about moodle data directories created inside the web directory, but otherwise this directory can be located where you wish. You can later move or change the location of this directory, but if you do, be sure to edit the setting in the '''config.php''' file that sets this; e.g. if moodledata is under a directory called data, then it would look like this:<br />
<br />
$CFG->dataroot = '/data/moodledata';<br />
<br />
<table style=background-color:lightCyan border=1 cellpadding=5 cellspacing=0 ><tr><td><br />
<br />
'''CPanel and webhosts'''<br />
<br />
On cPanel systems you can use the "File Manager" to find the folder, click on it, then choose "Change Permissions". On many shared hosting servers, you will probably need to restrict all file access to your "group" (to prevent other webhost customers from looking at or changing your files), but provide full read/write access to everyone else (which will allow the web server to access your files). Speak to your server administrator if you are having trouble setting this up securely. In particular it will not be possible to create a usable data directory on sites that use a PHP feature known as "'''Safe Mode'''".<br />
</table><br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<br />
== Run the installer script to create config.php ==<br />
<br />
To run the installer script (install.php), just try to access your Moodle main URL using a web browser, or access '''<nowiki>http://yourserver/install.php</nowiki>''' directly.<br />
<br />
(The Installer will try to set a session cookie. If you get a popup warning in your browser make sure you accept that cookie!)<br />
<br />
Moodle will detect that configuration is necessary and will lead you through some screens to help you create a new configuration file called '''config.php'''. At the end of the process Moodle will try and write the file into the right location, otherwise you can press a button to download it from the installer and then upload '''config.php''' into the main Moodle directory on the server.<br />
<br />
Along the way the installer will test your server environment and give you suggestions about how to fix any problems. For most common issues these suggestions should be sufficient, but if you get stuck, check in the Installation Forum for more help.<br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<br />
== Go to the admin page to continue configuration ==<br />
<br />
Once the basic config.php has been correctly created in the previous step, trying to access the front page of your site will take you to the "admin" page for the rest of the configuration.<br />
<br />
The first time you access this admin page, you will be presented with a GPL "shrink wrap" agreement with which you must agree before you can continue with the setup.<br />
<br />
Now Moodle will start setting up your database and creating tables to store data. Firstly, the main database tables are created. You should see a number of SQL statements followed by status messages that look like this:<br />
<br />
CREATE TABLE course (<br />
id int(10) unsigned NOT NULL auto_increment,<br />
category int(10) unsigned NOT NULL default '0',<br />
password varchar(50) NOT NULL default <nowiki>''</nowiki>,<br />
fullname varchar(254) NOT NULL default <nowiki>''</nowiki>,<br />
shortname varchar(15) NOT NULL default <nowiki>''</nowiki>,<br />
summary text NOT NULL,<br />
format tinyint(4) NOT NULL default '1',<br />
teacher varchar(100) NOT NULL default 'Teacher',<br />
startdate int(10) unsigned NOT NULL default '0',<br />
enddate int(10) unsigned NOT NULL default '0',<br />
timemodified int(10) unsigned NOT NULL default '0',<br />
PRIMARY KEY (id)<br />
) TYPE=MyISAM;<br />
<br />
<font color="green">SUCCESS</font><br />
<br />
...and so on, followed by: <font color="green">Main databases set up successfully.</font><br />
<br />
If you don't see these, then there must have been some problem with the database or the configuration settings you defined in config.php. Check that PHP isn't in a restricted "Safe Mode" (commercial web hosts sometimes have safe mode turned on). You can check PHP variables by creating a little file containing '''<?php phpinfo() ?>''' and looking at it through a browser. Check all these and try this page again.<br />
<br />
Scroll down the very bottom of the page and press the "Continue" link.<br />
<br />
You should now see a form where you can define more configuration variables for your installation, such as the default language, SMTP hosts and so on. Don't worry too much about getting everything right just now - you can always come back and edit these later on using the admin interface. The defaults are designed to be useful and secure for most sites. Scroll down to the bottom and click "Save changes".<br />
<br />
If (and only if) you find yourself getting stuck on this page, unable to continue, then your server probably has what I call the "buggy referrer" problem. This is easy to fix: just turn off the "secureforms" setting, then try to continue again.<br />
<br />
Next you will see more pages that print lots of status messages as they set up all the tables required by the various Moodle module. As before, they should all be <font color="green">green</font>.<br />
<br />
Scroll down the very bottom of the page and press the "Continue" link.<br />
<br />
The next page is a form where you can define parameters for your Moodle site and the front page, such as the name, format, description and so on. Fill this out (you can always come back and change these later) and then press "Save changes".<br />
<br />
Finally, you will then be asked to create a top-level administration user for future access to the admin pages. Fill out the details with your own name, email etc and then click "Save changes". Not all the fields are required, but if you miss any important fields you'll be re-prompted for them.<br />
<br />
'''Make sure you remember the username and password you chose for the administration user account, as they will be necessary to access the administration page in future.'''<br />
<br />
(If for any reason your install is interrupted, or there is a system error of some kind that prevents you from logging in using the admin account, you can usually log in using the default username of "'''admin'''", with password "'''admin'''".)<br />
<br />
Once successful, you will be returned to the home page of your new site! Note the administration links that appear down the left hand side of the page (these items also appear on a separate Admin page) - these items are only visible to you because you are logged in as the admin user. All your further administration of Moodle can now be done using this menu, such as:<br />
<br />
* creating and deleting courses<br />
* creating and editing user accounts<br />
* administering teacher accounts<br />
* changing site-wide settings like themes etc<br />
<br />
But you are not done installing yet! There is one very important thing still to do (see the next section on cron).<br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<br />
== Installing Moodle Using Command Line ==<br />
{{Moodle 2.0}}<br />
<br />
Installing Moodle Using command line is just as easy as installing Moodle using web browser. <br />
* First Go to the moodle root directory and then to admin directory inside the moodle root. <br />
<br />
$cd /var/www/html/moodle/admin<br />
<br />
* Then simply use the following syntax to run the moodle command line installer (this is a long command which has been split over 3 lines, so type as one line)<br />
$php cliupgrade.php --lang=en --webaddr=<nowiki>http://www.example.com</nowiki> --moodledir=/var/www/html/moodle <br />
--datadir=/var/moodledata --dbtype=mysql --dbhost=localhost --dbname=moodle <br />
--dbuser=root --prefix=mdl --verbose=1 --interactivelevel=2 <br />
<br />
More information about the options can be found using <br />
$php cliupgrad.php --help<br />
<br />
Then you will see the following list of available options<br />
<br />
--lang Valid installed language for installation. Default is English(en)<br />
--webaddr Web address for the Moodle site<br />
--moodledir Location of the moodle web folder<br />
--datadir Location of the moodle data folder (should not be web visible)<br />
--dbtype Database type. Default it mysql<br />
--dbhost Database host. Default localhost<br />
--dbname Database name. Default is moodle<br />
--dbuser Database user. Default is blank<br />
--dbpass Database password. Default is blank<br />
--prefix Table prefix for above database tables. Default is mdl<br />
--verbose 0 No output, 1 Summarized output(Default), 2 Detailed output<br />
--interactivelevel 0 Non interactive, 1 Semi interactive(Default), 2 Interactive<br />
--help print out this help<br />
<br />
When you choose non interactive mode without any options all the default values are assumed.<br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<br />
== Set up cron ==<br />
<br />
Moodle's background tasks (e.g. sending out forum emails and performing course backups) are performed by a script which you can set to execute at specific times of the day. This is known as a cron script. Please refer to the [[Cron|Cron instructions]].<br />
<br />
== Set up backups ==<br />
<br />
Please refer to the [[Backup settings| backup instructions]].<br />
<br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<br />
== Create a new course ==<br />
<br />
Now that Moodle is running properly, you can try creating a new course to play with.<br />
<br />
Select "Create a new course" from the Admin page (or the admin links on the home page).<br />
<br />
Fill out the form, paying special attention to the course format. You don't have to worry about the details too much at this stage, as everything can be changed later by the teacher. Note that the yellow help icons are everywhere to provide contextual help on any aspect.<br />
<br />
Press "Save changes", and you will be taken to a new form where you can assign teachers to the course. You can only add existing user accounts from this form - if you want to create a new teacher account then either ask the teacher to create one for themselves (see the login page), or create one for them using the "Add a new user" on the Admin page.<br />
<br />
Once done, the course is ready to customize, and is accessible via the "Courses" link on the home page.<br />
<br />
==See also==<br />
<br />
* [[Installation FAQ]]<br />
* [[Complete install packages]] might be an easier first time installs on some systems<br />
* Help forum: [http://moodle.org/mod/forum/view.php?id=28 Installation problems]<br />
* [[Installing Apache, MySQL and PHP]] - Open source programs that can run Moodle on the web or on a desktop<br />
* [[Upgrading Moodle]]<br />
* Using Moodle [http://moodle.org/mod/forum/discuss.php?d=42688 Selecting a web host for Moodle] forum discussion<br />
* [[masquerading|Masquerading]] - Running Moodle behind a masquerading/NAT firewall<br />
<br />
[[Category:Installation]]<br />
<br />
[[cs:Instalace]]<br />
[[de:Installieren von Moodle]]<br />
[[es:Instalación de moodle]]<br />
[[fr:Installation de Moodle]]<br />
[[ja:Moodleのインストール]]<br />
[[nl:Installatiegids]]<br />
[[pl:Instalacja Moodle]]<br />
[[pt:Instalação do Moodle]]<br />
[[ru:Установка Moodle]]<br />
[[sk:Inštalácia]]<br />
[[zh:安装Moodlezh:]]</div>Kawhttps://docs.moodle.org/20/en/index.php?title=Block_layout&diff=42661Block layout2008-08-25T15:36:41Z<p>Kaw: /* Resetting the block layout for existing courses */ Added script warning</p>
<hr />
<div>==Default block layout for new courses==<br />
<br />
[[Sticky blocks]] may be used in Moodle 1.6.<br />
<br />
Alternatively, to amend the default block layout for new courses (in all versions of Moodle), add one or more of the following lines (omitting the forward slashes) to ''config.php'' and amend the block names as required.<br />
<br />
Note how the colon is used to separate those blocks appearing on the left, from those appearing on the right.<br />
<br />
// These variables define DEFAULT block variables for new courses<br />
// If this one is set it overrides all others and is the only one used.<br />
// $CFG->defaultblocks_override = 'participants,activity_modules,search_forums,admin,course_list:news_items,calendar_upcoming,recent_activity';<br />
//<br />
// These variables define the specific settings for defined course formats.<br />
// They override any settings defined in the formats own config file.<br />
// $CFG->defaultblocks_site = 'site_main_menu,admin,course_list:course_summary,calendar_month';<br />
// $CFG->defaultblocks_social = 'participants,search_forums,calendar_month,calendar_upcoming,social_activities,recent_activity,admin,course_list';<br />
// $CFG->defaultblocks_topics = 'participants,activity_modules,search_forums,admin,course_list:news_items,calendar_upcoming,recent_activity';<br />
// $CFG->defaultblocks_weeks = 'participants,activity_modules,search_forums,admin,course_list:news_items,calendar_upcoming,recent_activity';<br />
// These blocks are used when no other default setting is found.<br />
// $CFG->defaultblocks = 'participants,activity_modules,search_forums,admin,course_list:news_items,calendar_upcoming,recent_activity';</pre><br />
(code copied from ''config-dist.php'')<br />
<br />
==Resetting the block layout for existing courses==<br />
<br />
The block layout for existing courses may be reset by copying the following script into a text file, saving it as ''resetblocks.php'', copying it into the Moodle root directory, then visiting <code><nowiki>http://yourmoodlesite.org/resetblocks.php</nowiki></code>. <br />
<br />
'''Warning''': This script may change the layout of your course pages and also remove blocks from those pages if they have not been specified in the config.php line. Check which of your courses has blocks which are not in the config.pho line and be prepared to spend time adding blocks to your course pages again. ''Please note that a database backup is recommended before using the script''.<br />
<br />
<?php<br />
require_once('config.php');<br />
require_once($CFG->libdir.'/blocklib.php');<br />
$courses = get_records('course');<br />
foreach($courses as $course) {<br />
$page = page_create_object(PAGE_COURSE_VIEW, $course->id);<br />
blocks_repopulate_page($page);<br />
}<br />
print_heading('Done!');<br />
?><br />
<br />
==See also==<br />
<br />
Using Moodle [http://moodle.org/mod/forum/discuss.php?d=98808 Default Block Layout for moodle 1.9] forum discussion<br />
<br />
[[Category:Block]]<br />
[[ja:ブロックレイアウト]]</div>Kawhttps://docs.moodle.org/20/en/index.php?title=Administration_hacks&diff=42471Administration hacks2008-08-22T17:41:20Z<p>Kaw: Added perf info hack</p>
<hr />
<div>Here are some hacks or tweaks to Moodle code that administrators have found useful on their sites to fill specific needs. <br />
<br />
== Approve account creation by self-registration before the new user gains access ==<br />
<br />
In /lib/moodlelib.php, search for the function send_confirmation_email. Change this line of the function (around line 4339 in 1.9.1+):<br />
return email_to_user($user, $supportuser, $subject, $message, $messagehtml);<br />
<br />
to:<br />
return email_to_user($supportuser, $supportuser, $subject, $message, $messagehtml);<br />
<br />
The confirmation e-mail is sent to the administrator (and not to the new user). Checking the list of user accounts (as Admin on the site), there is link to confirm the account (edit/delete/confirm). Once this is done the administrator can forward the e-mail to the new user (but the account is already approved). (1)<br />
<br />
== Send a duplicate of the registration email to the administrator ==<br />
<br />
In /lib/moodlelib.php, search for the function send_confirmation_email (around line 3629 in 1.8.4+). At the end of the function there is a line that reads (2):<br />
return email_to_user($user, $from, $subject, $message, $messagehtml);<br />
<br />
Just before that line, add a line like this:<br />
email_to_user($from, $from, $subject, $message, $messagehtml);<br />
<br />
== Set default course blocks rather than using sticky blocks ==<br />
<br />
In moodle/config.php, change lines 20-25:<br />
<br />
Find the defaultblocks_topics line and replace with this. Also change the string for defaultblocks_weeks. Don’t change social though (3).<br />
$CFG->defaultblocks_topics = ‘course_menu,myCourses:activity_modules,calendar_upcoming,quickmail’;<br />
$CFG->defaultblocks_weeks = ‘course_menu,myCourses:activity_modules,calendar_upcoming,quickmail’;<br />
<br />
== Turn quickgrade on as default, increase default number of assignments shown to 20, and remove instructor from the list ==<br />
<br />
In moodle/mod/assignment/lib.php, change line 682 (3):<br />
$perpage = get_user_preferences(’assignment_perpage’, 20);<br />
<br />
In line 684:<br />
$quickgrade = get_user_preferences(’assignment_quickgrade’, 1);<br />
<br />
In line 982:<br />
$teacherattempts = false; /// Temporary measure<br />
<br />
== Increase the number of course summaries displayed before going to collapsed mode in category view ==<br />
<br />
The following change was made in course/lib.php. Line 13 should read (3):<br />
define(’COURSE_MAX_SUMMARIES_PER_PAGE?‘, 25); // courses<br />
<br />
== Allow admins to edit posts after closing ==<br />
<br />
In moodle/config.php file, add the following two lines (3):<br />
<br />
// Setting this to true will enable admins to edit any post at any time<br />
// $CFG->admineditalways = true;<br />
<br />
except uncomment the second line (remove the two slashes):<br />
<br />
// Setting this to true will enable admins to edit any post at any time<br />
$CFG->admineditalways = true;<br />
<br />
== Change the default course settings to create topic courses instead of weekly courses ==<br />
<br />
In course/edit.php, change line 98 (3):<br />
$mform->setDefault(’format’, ‘weeks’);<br />
<br />
to:<br />
$mform->setDefault(’format’, ‘topics’);<br />
<br />
If you wanted to, you could change the default number of topics/weeks in a course. Change line 104 in this same file according to your needs:<br />
$mform->setDefault(’numsections’, 10);<br />
<br />
== Increase shortname field length in the course request form and the course creation form ==<br />
<br />
In moodle/course/edit_form.php, change line 72 (3):<br />
$mform->addElement(’text’,’shortname’, get_string(’shortname’),’maxlength=”25″ size=”25″‘);<br />
<br />
In moodle/course/request_form.php, change line 13:<br />
$mform->addElement(’text’, ’shortname’, get_string(’shortname’), ‘maxlength=”25″ size=”25″‘);<br />
<br />
== Access courses with a permanent user friendly URL ==<br />
<br />
The idea is to access a course with a user friendly URL instead of the usual cryptic way.<br />
In this example we will propose URLs for courses based on their short names, in the form:<br />
<br />
http://moodle.some.where.org/pages/SHORTNAME<br />
<br />
where SHORTNAME is the exact name defined on the course settings (case sensitive).<br />
<br />
There are, however, some limitations on the characters that can be used to achieve this due to URL special characters.<br />
In this example the allowed set of characters is [ A-Z a-z 0-9 - _ . @ ].<br />
<br />
So you have to change apache configuration in the global or VirtualHost section:<br />
RewriteEngine on<br />
#uncomment the following two lines if you want to debug<br />
#RewriteLog "/var/log/httpd/rewrite.log"<br />
#RewriteLogLevel 9<br />
<br />
#pages@moodle<br />
RewriteRule ^/pages/([A-Za-z0-9\-\_\.\@]+)/?$ /course/view.php?name=$1 [R,L]<br />
RewriteRule ^/pages/ / [R,L]<br />
<br />
== Prevent "Welcome to course" emails ==<br />
<br />
You can stop moodle sending enrolment emails by changing two lines in the file ''/enrol/enrol.class.php''(4).<br />
<br />
The line (occuring twice in the file!) reads:<br />
email_to_user($USER, $teacher, $subject, $message);<br />
<br />
It must be changed to:<br />
// email_to_user($USER, $teacher, $subject, $message);<br />
<br />
That way, moodle ignores the e-mail-command until you change back to the original line. The setting works for all courses at the same time. It does not affect other e-mails being sent (e.g. the login confirmation).<br />
<br />
== Display Performance Info to admins only ==<br />
<br />
Moodle can be set to display some useful performance information in the footer (Site Administration -> Server -> Debugging -> Performance info), but sometimes you may not want users to see this information on a production site. Follow these steps to only display this information to administrators:<br />
<br />
* Using your editor, open the file /lib/weblib.php and search for the first occurrence of the text $performanceinfo = ''; (around line 2957).<br />
* Add this text as the next line<br />
<br />
if ($CFG->adminonlyperfinfo and isadmin()) {<br />
<br />
* Look further down the code a few lines for the last brace character (}) and add an extra one on its own. <br />
* Your text should now look like this:<br />
<br />
/// Provide some performance info if required<br />
$performanceinfo = '';<br />
if ($CFG->adminonlyperfinfo and isadmin()) { <-- New line added here<br />
if (defined('MDL_PERF') || (!empty($CFG->perfdebug) and $CFG->perfdebug > 7)) {<br />
$perf = get_performance_info();<br />
if (defined('MDL_PERFTOLOG') && !function_exists('register_shutdown_function')) {<br />
error_log("PERF: " . $perf['txt']);<br />
}<br />
if (defined('MDL_PERFTOFOOT') || debugging() || $CFG->perfdebug > 7) {<br />
$performanceinfo = $perf['html'];<br />
}<br />
}<br />
} <-- New line added gere<br />
<br />
* Save the file /lib/weblib.php<br />
* Edit your moodle/config.php file and add the line<br />
<br />
$CFG->adminonlyperfinfo = true;<br />
<br />
This sets the flag to make the code display the performance info only for admins.<br />
<br />
== References ==<br />
<br />
#[http://moodle.org/mod/forum/discuss.php?d=97938 Discussion forum in moodle.org: Admin approving self registrations?]<br />
#[http://moodle.org/mod/forum/discuss.php?d=92958 Discussion forum in moodle.org: Self registration with validation]<br />
#[http://awyatt.edublogs.org/2008/04/30/republishing-favorite-moodle-hacks/ Blog post: Republishing favorite Moodle hacks by A. Wyatt]<br />
#[http://moodle.org/mod/forum/discuss.php?d=18583 Discussion forum in moodle.org: Stopping "Welcome to the course" emails]<br />
<br />
[[Category:Administrator]]</div>Kawhttps://docs.moodle.org/20/en/index.php?title=News_forum&diff=42470News forum2008-08-22T17:15:57Z<p>Kaw: Added reference to imported courses</p>
<hr />
<div>{{Forums}}<br />
The News forum is a special forum for general announcements. A course may only have one News forum unless it has been imported from another system which supports more than one news forum, e.g. BlackBoard.<br />
<br />
This forum is automatically created for each course and for the [[Front Page|front page]] of the Moodle site. By default, it is placed in the top of the center section and only teachers and administrators may add posts or reply to posts. Also the [[Adding/editing a forum|default settings]] forces every enroled person to be subscribed to the News forum.<br />
<br />
The [[Latest News block]] displays a [[Course_settings#News_items_to_show|specific number]] of recent discussions from the News forum. <br />
<br />
As with any forum, emails can be sent to subscribed members of a News forum.<br />
<br />
==Removing the news forum==<br />
<br />
The news forum may be removed from a course as follows:<br />
#Delete the news forum from the course homepage<br />
#In [[Course settings]] set "News items to show" to 0<br />
#Delete the Latest news block<br />
#Alternatively - hide the news forum<br />
<br />
==See also==<br />
<br />
*[[Upgrading to Moodle 1.8]] for steps to enable logged-in users to read the site news<br />
<br />
[[fr:Forum des nouvelles]]</div>Kawhttps://docs.moodle.org/20/en/index.php?title=Administration_FAQ&diff=37112Administration FAQ2008-06-07T10:15:42Z<p>Kaw: Added CVS login aborted</p>
<hr />
<div>{{FAQ}}<br />
<br />
==Changing text in Moodle==<br />
<br />
The language editing interface in ''Administration > Language > Language editing'' enables you to easily change any word or phrase used on the site. You may need to search through several files to find the word or phrase you are looking for. The file moodle.php contains all common site-wide phrases and the admin.php contains many admin phrases.<br />
<br />
== How do the limits on uploaded files work? ==<br />
<br />
File upload sizes are restricted in a number of ways - each one in the list restricts the following ones.<br />
<br />
1. Firstly, there is a setting in Apache 2 which you may need to change. On Redhat this setting is very low by default, you can change the limit by adding or editing a line in Apache's ''/etc/httpd/conf/httpd.conf'' and/or ''/etc/httpd/conf.d/php.conf'' with the upload size in bytes (different operating systems may have these files in different locations):<br />
<br />
LimitRequestBody 10485760<br />
<br />
2. PHP also has two more byte limits, which you can set in ''php.ini'' and sometimes in a ''.htaccess'' file:<br />
<br />
php_value upload_max_filesize 50000000<br />
php_value post_max_size 50000000<br />
<br />
To convert from Bytes to Megabytes use [http://www.onlineconversion.com/computer.htm this convertor ]<br />
<br />
Please note that a server re-start may be required for the above changes to take effect.<br />
<br />
3. Moodle has a site-wide limit called maxbytes that may be set in ''Administration > Configuration > [[admin/config|Variables]]''.<br />
<br />
4. A limit may be set by teachers in the [[course/edit|Course settings]].<br />
<br />
5. Activity modules such as [[Forums]] and [[Assignments]] have their own limits which may be set when adding or editing the activity.<br />
<br />
'''See also'''<br />
<br />
* Using Moodle [http://moodle.org/mod/forum/discuss.php?d=39625 Detailed instructions to increase the maximum allowed size for uploaded files] forum discussion<br />
* Using Moodle [http://moodle.org/mod/forum/discuss.php?d=97907 Instructions to increase maximum allowed size on hosted servers] forum discussion<br />
* Instructions below on How to change the maximum execution time<br />
<br />
== How to change upload file size on a Windows localhost==<br />
In a localhost (using a [[Complete install packages]] on a computer) for 1.6 it is easy to change the uploaded file size to something larger than the default 16M. <br />
<br />
Here is an example of how to change the upload file size to 100M.<br />
*Find ..'''/Apache/bin/php.ini''' and open it with WordPad by right-clicking -> Open With -> then choose WordPad. <br />
*In this file scroll or do a search on the text "_max_" to find <code>upload_max_filesize = 16M</code> <br />
*Change that line to<br />
upload_max_filesize = 100M<br />
*In the same way, find <code>post_max_size = 16M</code> <br />
*Change that line to<br />
post_max_size = 100M<br />
*Save the file. <br />
<br />
After any changes to the php.ini file you need to restart Apache. So restart xampp and browse to localhost. You should find that the Upload file size in Configuration now reads 100M.<br />
<br />
'''See also'''<br />
<br />
* Instructions below on How to change the maximum execution time<br />
<br />
== How to change the maximum execution time ==<br />
<br />
A side-effect of increasing the file upload limit is that the php scripts may execute beyond the limit set by default (300 seconds/5 minutes). To change this, look for max_execution_time in php.ini and change to something like this:<br />
<br />
max_execution_time = 600<br />
<br />
If you are using Apache and have a .htaccess file to change php settings, add this line to your .htaccess file:<br />
<br />
php_value max_execution_time 600<br />
<br />
Restart your webserver for these changes to take effect, and check that the values have been changed by looking at your phpinfo output in the moodle admin -> environment page.<br />
<br />
== I have forgotten the admin password ==<br />
Firstly, try using the button "Send my details via email". Otherwise, you will need to access the database using MySQL admin. Passwords for all users, including admin, are stored encrypted in the table ''mdl_user''. Copy the guest password (guest) into the admin password field then login using it.<br />
<br />
Additional solutions are detailed in the discussions [http://moodle.org/mod/forum/discuss.php?d=18103 change admin's password] and [http://moodle.org/mod/forum/discuss.php?d=4552&parent=38070 login/password].<br />
<br />
== My log table has disappeared - No logs found! ==<br />
The most likely cause is that the mdl_log table has become corrupted. See the [[#How_do_I_repair_a_corrupted_Moodle_database.3F|database repair section]] below.<br />
<br />
==My style sheet changes aren't showing up==<br />
<br />
Browsers usually cache style sheets and so a forced refresh (CTRL + F5) is required before any changes show up.<br />
<br />
==How do I make my Moodle site homepage look like the moodle.org homepage?==<br />
<br />
Please see the theme how-to [[Homepage design|homepage design of moodle.org]] for full details.<br />
<br />
== Site-wide scales ==<br />
To add a site-wide scale, available in all courses, follow the Scales link in any course Administration block. Add a new scale, then use the move down arrow to move the scale from custom scales to standard scales.<br />
<br />
==Why do I see <nowiki>[[missing strings]]</nowiki>?==<br />
<br />
Double square brackets around text indicate that language strings are missing. Try checking for untranslated words or phrases in ''Administration > Language > [[Language editing]]'' and update local language packs in ''Administration > Language > [[Language packs]]'' (or ''Administration > Configuration > Language'' in Moodle 1.6).<br />
<br />
Language strings for non-standard modules and plugins are generally contained in a ''lang'' folder within the module or plugin folder. For sites which have migrated to UTF-8, it may be necessary to re-name the folder e.g. ''en'' should be re-named ''en_utf8''.<br />
<br />
==How do I find the version of Moodle currently installed?==<br />
See the [[Moodle version]] information.<br />
<br />
==How do I repair a corrupted Moodle database?==<br />
Database corruption usually occurs as a result of a hardware (especially disk-based) failure, or when a disk becomes full. Typical symptoms are failure on login, with this message displayed:<br />
<br />
Session Replace: Table './moodle/mdl_sessions2' is marked as crashed and should be repaired<br />
<br />
The problem can be repaired using the mysqlcheck command (the command you type is in bold and we assume the database name is 'moodle' and its type is MySQL):<br />
<br />
#'''mysqlcheck –u moodleuser –p –-auto-repair moodle'''<br />
Enter password:<br />
moodle.adodb_logsql OK<br />
moodle.mdl_assignment OK<br />
moodle.mdl_assignment_submissions OK<br />
...<br />
moodle.mdl_log<br />
error : Table './moodle/mdl_log' is marked as crashed and should be repaired<br />
...<br />
moodle.mdl_sessions2<br />
error : Table './moodle/mdl_sessions2' is marked as crashed and should be repaired<br />
<br />
Repairing tables<br />
moodle_18_latest.mdl_log OK<br />
moodle_18_latest.mdl_sessions2 OK<br />
<br />
Your mysql database server must be running when executing the mysqlcheck command. If there are problems with the tables, the auto-repair option will fix them as shown above. Note that the repair process can take a long time to complete. Re-run the command again to double-check that all is OK. <br />
<br />
Individual Moodle tables may be repaired using MySQL Admin/PHPMyAdmin as follows:<br />
# In the databases section, select the Moodle database.<br />
# Click the SQL tab, then in the "Run SQL query/queries on database moodle" field type <code>REPAIR TABLE mdl_tablename</code><br />
# Click the Go button.<br />
For example, to repair the Moodle log tables, type <code>REPAIR TABLE mdl_log</code><br />
<br />
See also: <br />
*[http://moodle.org/mod/forum/discuss.php?d=58208#279638 Forum discussion] on a moodle database optimization script<br />
*[[Performance#MySQL_performance | Performance Documentation]] on database repair and optimization<br />
*[http://www.databasejournal.com/features/mysql/article.php/10897_3300511_2 Database Journal article on repairing database corruption in MySQL]<br />
<br />
==Re. Site files, what does "files placed here can be accessed by anyone" mean?==<br />
<br />
Unlike course files, which require a user to have appropriate rights in order to access them, files within the site files folder are accessible by anyone provided with the URI. For example visitors to the site may view images stored in the site files folder without being logged in. Please refer to [[Site files]] for more information.<br />
<br />
==My site is stuck in maintenance mode==<br />
<br />
Sometimes Moodle gets stuck in maintenance mode and you'll see the message "This site is undergoing maintenance and is currently unavailable" despite your attempts to turn-off maintenance mode. When you put Moodle into maintenance mode it creates a file called maintenance.html in moodledata/1/maintenance.html (the site files folder). To fix this try the following:<br />
<br />
* Check that the web server user has write permissions to the moodledata folder.<br />
* Manually delete the maintenance.html file.<br />
<br />
==Incomplete page displayed when I click "Turn Editing On"==<br />
This is usually as a result of an incompatible contributed module or block that you have installed. Follow these steps:<br />
#Follow the module removal instructions in [[Installing contributed modules or plugins]].<br />
#Re-visit your course page and try clicking on the "Turn Editing On" button again. <br />
<br />
If you find an incompatible module or block, please report the problem to the person named as the maintainer in the [http://moodle.org/mod/data/view.php?id=6009 Modules and Plugins database].<br />
<br />
=="a request parameter (id) was missing" when uploading a file==<br />
<br />
This message sometimes is generated when attempting to upload a file larger than the upload limit.<br />
<br />
==I cannot delete the News Forum on a course==<br />
The News Forum is deleted by setting the number of items to display to zero. To do this, change the setting in Course Admin menu -> Settings -> News Items to Show.<br />
<br />
==How can I change the URL of the moodle service==<br />
<br />
You should configure your Apache server, at httpd.conf, using Listen, Port and DocumentRoot directives and Directory section. After restarting Apache, you also must open config.php in a text editor, and change the line:<br />
$CFG->wwwroot = 'http://mydomain/testmoodle';<br />
<br />
Your Moodle site will also contain absolute links to resources which point to the previous URL. To change this see the [[Moodle_migration#Migrating_a_complete_Moodle_site | migrating a complete Moodle site]] instructions.<br />
<br />
'''See also''': [http://moodle.org/mod/forum/discuss.php?d=51667 Forum discussion]<br />
<br />
==Why is the Moodle Registration button still displayed after I register my site?==<br />
The registration button is provided so that you can place your moodle site to the http://www.moodle.org/sites list. Before registering, the button is displayed at the top of the Site Administration -> Notifications page. Once you have successfully registered, this is moved to the bottom of the same page. The button remains there so that you can update the details of your registration.<br />
<br />
If the registration process fails for some reason to complete fully, there are two methods of letting your local Moodle install know that you have registered:<br />
<br />
* The preferred method is to use your mysql client program to execute these commands (assuming your Moodle database is called "moodle"):<br />
mysql> USE moodle;<br />
mysql> INSERT INTO mdl_config (name,value) VALUES ('registered',unix_timestamp());<br />
<br />
* Alternatively, edit your <nowiki>moodle/config.php</nowiki> file and add this line:<br />
$CFG->registered = '9999999999';<br />
:Note that this line in your config.php will stop the reminders about re-registering.<br />
<br />
For an explanation of the idea behind the button see [http://tracker.moodle.org/browse/MDL-7359 MDL-7359] in the moodle tracker.<br />
<br />
For an explanation of how sites are checked see [[Verification_of_sites_on_moodle.org | the site verification page]]<br />
<br />
==How do I enable/disable debugging?==<br />
There are a few ways you can enable or disable debugging on your site. If you are able to login as an administrator and access the Site Administration block, then the easiest way is to go to Admin->Server->Debugging and set it there. There are several options - the most often recommended setting for debugging is 'ALL: Show all reasonable PHP debugging messages'. To disable debugging, simply set this to 'NONE: Do not show any errors or warnings.'.<br />
<br />
If you are unable to set your debugging level in this manner, you still have a couple ways to set it - in your config.php or in the database.<br />
<br />
* In <nowiki>moodle/config.php</nowiki> you can add these lines:<br />
<br />
$CFG->debug=2047; <br />
$CFG->debugdisplay=1;<br />
<br />
:Then simply remove them (or comment them out) when you're done.<br />
<br />
* To enable debugging in the database, simply use a database utility such as the MySQL Admin plugin for Moodle, or PHPMyAdmin, etc., and enter the following:<br />
<br />
UPDATE `mdl_config` SET `value` = '2047' WHERE `name` ='debug';<br />
<br />
:To turn it back off, use this command:<br />
<br />
UPDATE `mdl_config` SET `value` = '0' WHERE `name` ='debug';<br />
:<br />
<br />
==How do I install the Moodle Features Demo course?==<br />
<br />
# Download the [http://moodle.org/file.php/1/backup-features-20060925-0911.zip Moodle Features Demo Course backup].<br />
# Log into your Moodle installation as an administrator.<br />
# Access ''Administration > Front Page > Site files'' (or ''Administration > Server > Site files'' in Moodle 1.7).<br />
# Upload the backup file.<br />
# Follow the restore link opposite the backup file.<br />
# Follow the instructions provided, selecting the option to restore to a new course.<br />
<br />
=="Could not create guest user record!" error message==<br />
<br />
Most likely the database table mdl_user needs repairing. This may be done as follows using phpMyAdmin:<br />
<br />
# Click the SQL tab.<br />
# In the "Run SQL query/queries on database moodle" field type <code>REPAIR TABLE mdl_user</code><br />
# Click the Go button.<br />
<br />
=="Your session has timed out. Please login again." error message==<br />
<br />
Please do one/all of the following:<br />
* Try deleting cookies manually from your browser and close it down, then access your site again. Sometimes this clears up the problem.<br />
* Check that your ''moodledata/sessions'' directory has write permissions. When you access Moodle a new file should be created there.<br />
* If you are running two versions of Moodle on the same computer, set a cookie prefix in ''Administration > Server > [[Session handling]]''.<br />
<br />
==I cannot login to the Moodle CVS servers==<br />
<br />
When attempting to login to the Moodle CVS servers, you may receive a "login aborted" error as shown below (this example shows the eu cvs server, with the command in bold):<br />
<br />
C:\gnuwin32>'''cvs -d:pserver:anonymous@eu.cvs.moodle.org:/cvsroot/moodle login'''<br />
Logging in to :pserver:anonymous@eu.cvs.moodle.org:2401/cvsroot/moodle<br />
CVS password: <- (blank password entered)<br />
cvs [login aborted]: connect to uk.cvs.moodle.org(212.219.207.198):2401 failed:<br />
Connection refused<br />
C:\gnuwin32><br />
<br />
To fix this problem, check that you have entered the CVS command correctly and that port 2401 is open on your firewall. <br />
<br />
<br />
==See also==<br />
* [[Administration hacks]]<br />
<br />
[[Category:FAQ]]<br />
<br />
[[es:FAQ Administración]]<br />
[[fr:FAQ d'administration]]<br />
[[pl:Administracja FAQ]]</div>Kawhttps://docs.moodle.org/20/en/index.php?title=File_Server_Integration&diff=37052File Server Integration2008-06-05T08:38:14Z<p>Kaw: </p>
<hr />
<div>Moodle has no direct method of integrating with a file server and accessing user’s home directories which are stored on a file server somewhere on a network. Access to users work from within Moodle is often required so that the role of a file server in the network is not duplicated. In this way users can continue to work using desktop applications on their files and yet be able to download them when they are off-campus.<br />
<br />
==Table of Contents==<br />
__TOC__<br />
<br />
==Solutions available== <br />
Here is a list of the current workarounds available to implement this facility: <br />
* '''WebDAV'''. WebDAV is an extension of the HTTP protocol which allows users to edit and manage files on remote servers. There is currently work going on to [https://docs.moodle.org/en/WebDAV_Setup implement WebDAV] and should be available after Moodle 1.9. <br />
* '''SMB Web client'''. There is also available the [[http://moodle.org/mod/data/view.php?d=13&rid=991 Windows Share Web Client block] which uses the smbwebclient program. The limitation of this block is that the Moodle server cannot be a Windows server.<br />
* '''WebExplorer'''. This is a ASP-based script which provides access to the file server from the Moodle server. <br />
<br />
==Using the WebExplorer script==<br />
The WebExplorer script allows users to access their home directories where the directories are stored on a Windows server (or on a Linux server running Samba). The method uses an ASP script which executes on a Windows server.<br />
<br />
1. '''Identify the script server''' that is going to run the script to access the directories. The script is written in ASP, so the server has to be a Windows server.<br />
<br />
2. Login to the file server and check the '''format of the user’s home directory shares''' on the file server. They should be in the format \\servername\path\username, e.g. \\filesvr\studenthomes$\username, \\filesvr2\staffhomes$\username, or just \\filesvr\username.<br />
<br />
3. '''Install the required server software''' on the script server: IIS, Microsoft Windows Script 5.1+, MDAC.<br />
<br />
4. '''Download WebExplorer Lite''' from this site (http://www.gleamtech.com/products/wexlite.asp). If you want a more sophisticated solution, use the paid-for options which are also available on the same website.<br />
<br />
5. '''Extract the files''' to the Inetpub/wwwroot folder on the script server.<br />
<br />
6. '''Configure WebExplorer Lite''' by editing the file config.asp and changing the following:<br />
<br />
: - Set wexPassword as blank.<br />
: - Change the line starting Const wexRoot=”/” to the following:<br />
<br />
Const wexRoot = \\servername\ & request.servervariables("REMOTE_USER")<br />
<br />
:where servername is the string that is used to access the user’s directories from Step 2.<br />
<br />
7. '''Setup authentication''' on the script server. Use IIS Manager, Websites, Default Website, Right-click Properties, Directory Security, Click Edit button in Authentication and Access Control section. Choose the authenticated access scheme which best matches your installation, e.g. most people choose Basic Authentication or Integrated Authentication. <br />
<br />
8. '''Setup Moodle NTLM authentication''' on your Moodle server. This is optional.<br />
<br />
9. '''Test the installation''' by running the default.asp script from your browser, e.g.<nowiki> http://scriptserver/default.asp</nowiki>. You should see the WebExplorer screen with your files displayed.<br />
<br />
10. '''Allow users to access the script''' by creating an HTML block on your main Moodle front page. Add the text “MyDocuments” (or whatever you prefer to call it) and link to <nowiki>http://scriptserver/default.asp</nowiki>. Save the changes and test.<br />
<br />
==See also==<br />
* Using Moodle [http://moodle.org/mod/forum/discuss.php?d=89123 developer forum discussion] on WebDAV<br />
* List of resources on the [http://www.webdav.org/ WebDAV.org] site<br />
<br />
[[Category: Administrator]]</div>Kawhttps://docs.moodle.org/20/en/index.php?title=File_Server_Integration&diff=37051File Server Integration2008-06-05T08:32:17Z<p>Kaw: Various</p>
<hr />
<div>Moodle has no direct method of integrating with a file server and accessing user’s home directories which are stored on a file server somewhere on a network. Access to users work from within Moodle is often required so that the role of a file server in the network is not duplicated. In this way users can continue to work using desktop applications on their files and yet be able to download them when they are off-campus.<br />
<br />
==Table of Contents==<br />
__TOC__<br />
<br />
==Solutions available== <br />
Here is a list of the current workarounds available to implement this facility: <br />
* '''WebDAV'''. WebDAV is an extension of the HTTP protocol which allows users to edit and manage files on remote servers. There is currently work going on to [https://docs.moodle.org/en/WebDAV_Setup implement WebDAV] and should be available after Moodle 1.9. <br />
* '''SMB Web client'''. There is also available the [[http://moodle.org/mod/data/view.php?d=13&rid=991 Windows Share Web Client block] which uses the smbwebclient program. The limitation of this block is that the Moodle server cannot be a Windows server.<br />
* '''WebExplorer'''. This is a ASP-based script which provides access to the file server from the Moodle server. <br />
<br />
==Using the WebExplorer script==<br />
The WebExplorer script allows users to access their home directories where the directories are stored on a Windows server (or on a Linux server running Samba). The method uses an ASP script which executes on a Windows server.<br />
<br />
1. '''Identify the script server''' that is going to run the script to access the directories. The script is written in ASP, so the server has to be a Windows server.<br />
<br />
2. Login to the file server and check the '''format of the user’s home directory shares''' on the file server. They should be in the format \\servername\path\username, e.g. \\filesvr\studenthomes$\username, \\filesvr2\staffhomes$\username, or just \\filesvr\username.<br />
<br />
3. '''Install the required server software''' on the script server: IIS, Microsoft Windows Script 5.1+, MDAC.<br />
<br />
4. '''Download WebExplorer Lite''' from this site (http://www.gleamtech.com/products/wexlite.asp). If you want a more sophisticated solution, use the paid-for options which are also available on the same website.<br />
<br />
5. '''Extract the files''' to the Inetpub/wwwroot folder on the script server.<br />
<br />
6. '''Configure WebExplorer Lite''' by editing the file config.asp and changing the following:<br />
<br />
: - Set wexPassword as blank.<br />
: - Change the line starting Const wexRoot=”/” to the following:<br />
<br />
Const wexRoot = \\servername\ & request.servervariables("REMOTE_USER")<br />
<br />
:where servername is the string that is used to access the user’s directories from Step 2.<br />
<br />
7. '''Setup authentication''' on the script server. Use IIS Manager, Websites, Default Website, Right-click Properties, Directory Security, Click Edit button in Authentication and Access Control section. Choose the authenticated access scheme which best matches your installation, e.g. most people choose Basic Authentication or Integrated Authentication. <br />
<br />
8. '''Setup Moodle NTLM authentication''' on your Moodle server. This is optional.<br />
<br />
9. '''Test the installation''' by running the default.asp script from your browser, e.g.<nowiki> http://scriptserver/default.asp</nowiki>. You should see the WebExplorer screen with your files displayed.<br />
<br />
10. '''Allow users to access the script''' by creating an HTML block on your main Moodle front page. Add the text “MyDocuments” (or whatever you prefer to call it) and link to <nowiki>http://scriptserver/default.asp</nowiki>. Save the changes and test.<br />
<br />
==See also==<br />
* Using Moodle [http://moodle.org/mod/forum/discuss.php?d=89123 developer forum discussion] on WebDAV<br />
* List of resources on the [http://www.webdav.org/ WebDAV.org] site</div>Kawhttps://docs.moodle.org/20/en/index.php?title=PHP_info&diff=37049PHP info2008-06-05T06:44:14Z<p>Kaw: Added TOC and reference to PHP.INI directives</p>
<hr />
<div>Location: ''Administration > Server > PHP info''<br />
<br />
The phpinfo display contains information about the configuration of your PHP installation. This is useful for checking:<br />
* that your PHP installation meets Moodle's system requirements.<br />
* that you have installed the required modules needed for Moodle to work, e.g. the LDAP module for LDAP authentication.<br />
<br />
==Table of contents==<br />
__TOC__<br />
<br />
==Displaying phpinfo==<br />
To view the phpinfo information:<br />
* In Moodle version 1.7 or greater, choose Site Administration -> Server -> PHP info.<br />
* Create a file called info.php using your text editor, containing this single line:<br />
<br />
<?php phpinfo(); ?><br />
<br />
* Upload this file into your moodle folder on your PC or server.<br />
* Now open this file in your browser. For example <nowiki>http://127.0.0.1/info.php</nowiki>.<br />
<br />
==Sample output==<br />
This is a sample output displayed.<br />
<br />
<br />
<table border="0" cellpadding="3" width="600"><br />
<tr class="h"><td><br />
[http://www.php.net/ http://www.php.net] <br />
<br />
<nowiki>=PHP Version 4.3.3= </nowiki><br />
</td></tr><br />
</table><br/><br />
<table border="0" cellpadding="3" width="600"><br />
<tr><td class="e">System </td><td class="v">Windows NT MYLAPTOP0106 5.1 build 2600 </td></tr><br />
<tr><td class="e">Build Date </td><td class="v">Aug 24 2003 22:01:16 </td></tr><br />
<tr><td class="e">Server API </td><td class="v">Apache </td></tr><br />
<tr><td class="e">Virtual Directory Support </td><td class="v">enabled </td></tr><br />
<tr><td class="e">Configuration File (php.ini) Path </td><td class="v">C:\WINDOWS\php.ini </td></tr><br />
<tr><td class="e">PHP API </td><td>20020918 </td></tr><br />
<tr><td class="e">PHP Extension </td><td>20020429 </td></tr><br />
<tr><td class="e">Zend Extension </td><td>20021010 </td></tr><br />
<tr><td class="e">Debug Build </td><td>no </td></tr><br />
<tr><td class="e">Thread Safety </td><td>enabled </td></tr><br />
<tr><td class="e">Registered PHP Streams </td><td>php, http, ftp, compress.zlib</td></tr><br />
</table><br />
<br />
...<br />
<br />
This output goes on for about 5 pages.<br />
<br />
==See also==<br />
* [http://www.php.net/ini.core PHP reference] describing the core PHP.INI directives<br />
<br />
[[es:phpinfo]]<br />
[[pt:phpinfo]]<br />
[[pl:phpinfo]]<br />
<br />
[[Category:Developer|Phpinfo]]<br />
[[Category:Administrator]]</div>Kawhttps://docs.moodle.org/20/en/index.php?title=PHP_info&diff=37048PHP info2008-06-05T06:42:04Z<p>Kaw: /* Sample output */</p>
<hr />
<div>Location: ''Administration > Server > PHP info''<br />
<br />
The phpinfo display contains information about the configuration of your PHP installation. This is useful for checking:<br />
* that your PHP installation meets Moodle's system requirements.<br />
* that you have installed the required modules needed for Moodle to work, e.g. the LDAP module for LDAP authentication.<br />
<br />
==Displaying phpinfo==<br />
To view the phpinfo information:<br />
* In Moodle version 1.7 or greater, choose Site Administration -> Server -> PHP info.<br />
* Create a file called info.php using your text editor, containing this single line:<br />
<br />
<?php phpinfo(); ?><br />
<br />
* Upload this file into your moodle folder on your PC or server.<br />
* Now open this file in your browser. For example <nowiki>http://127.0.0.1/info.php</nowiki>.<br />
<br />
==Sample output==<br />
This is a sample output displayed.<br />
<br />
<br />
<table border="0" cellpadding="3" width="600"><br />
<tr class="h"><td><br />
[http://www.php.net/ http://www.php.net] <br />
<br />
<nowiki>=PHP Version 4.3.3= </nowiki><br />
</td></tr><br />
</table><br/><br />
<table border="0" cellpadding="3" width="600"><br />
<tr><td class="e">System </td><td class="v">Windows NT MYLAPTOP0106 5.1 build 2600 </td></tr><br />
<tr><td class="e">Build Date </td><td class="v">Aug 24 2003 22:01:16 </td></tr><br />
<tr><td class="e">Server API </td><td class="v">Apache </td></tr><br />
<tr><td class="e">Virtual Directory Support </td><td class="v">enabled </td></tr><br />
<tr><td class="e">Configuration File (php.ini) Path </td><td class="v">C:\WINDOWS\php.ini </td></tr><br />
<tr><td class="e">PHP API </td><td>20020918 </td></tr><br />
<tr><td class="e">PHP Extension </td><td>20020429 </td></tr><br />
<tr><td class="e">Zend Extension </td><td>20021010 </td></tr><br />
<tr><td class="e">Debug Build </td><td>no </td></tr><br />
<tr><td class="e">Thread Safety </td><td>enabled </td></tr><br />
<tr><td class="e">Registered PHP Streams </td><td>php, http, ftp, compress.zlib</td></tr><br />
</table><br />
<br />
...<br />
<br />
This output goes on for about 5 pages.<br />
<br />
[[es:phpinfo]]<br />
[[pt:phpinfo]]<br />
[[pl:phpinfo]]<br />
<br />
[[Category:Developer|Phpinfo]]<br />
[[Category:Administrator]]</div>Kawhttps://docs.moodle.org/20/en/index.php?title=PHP_info&diff=37047PHP info2008-06-05T06:39:49Z<p>Kaw: /* PHP Version 4.3.3 */ Fixed typo</p>
<hr />
<div>Location: ''Administration > Server > PHP info''<br />
<br />
The phpinfo display contains information about the configuration of your PHP installation. This is useful for checking:<br />
* that your PHP installation meets Moodle's system requirements.<br />
* that you have installed the required modules needed for Moodle to work, e.g. the LDAP module for LDAP authentication.<br />
<br />
==Displaying phpinfo==<br />
To view the phpinfo information:<br />
* In Moodle version 1.7 or greater, choose Site Administration -> Server -> PHP info.<br />
* Create a file called info.php using your text editor, containing this single line:<br />
<br />
<?php phpinfo(); ?><br />
<br />
* Upload this file into your moodle folder on your PC or server.<br />
* Now open this file in your browser. For example <nowiki>http://127.0.0.1/info.php</nowiki>.<br />
<br />
==Sample output==<br />
This is a sample output displayed:<br />
<br />
<table border="0" cellpadding="3" width="600"><br />
<tr class="h"><td><br />
[http://www.php.net/ http://www.php.net]</div>Kawhttps://docs.moodle.org/20/en/index.php?title=File_Server_Integration&diff=37042File Server Integration2008-06-04T15:19:44Z<p>Kaw: /* Using the WebExplorer script */ Added optional to setup NTLM auth</p>
<hr />
<div>Moodle has no direct method of integrating with a file server and accessing user’s home directories which are stored on a file server somewhere on a network. Access to users work from within Moodle is often required so that the role of a file server in the network is not duplicated. In this way users can continue to work using desktop applications on their files and yet be able to download them when they are off-campus.<br />
<br />
==Table of Contents==<br />
__TOC__<br />
<br />
==Solutions available== <br />
Here is a list of the current workarounds available to implement this facility: <br />
* '''[https://docs.moodle.org/en/WebDAV_Setup WebDav]'''. There is currently work going on to implement WebDAV, but this has yet to be implemented and should be available after Moodle 1.9. <br />
* '''[http://moodle.org/mod/data/view.php?d=13&rid=991 SMB Web client]'''. There is also available the Windows Share Web Client block which uses the smbwebclient program. The limitation of this block is that the Moodle server cannot be a Windows server.<br />
* '''WebExplorer'''. This is a ASP-based script which provides access to the file server from the Moodle server. <br />
<br />
==Using the WebExplorer script==<br />
The WebExplorer script allows users to access their home directories where the directories are stored on a Windows server (or on a Linux server running Samba). The method uses an ASP script which executes on a Windows server.<br />
<br />
1. '''Identify the script server''' that is going to run the script to access the directories. The script is written in ASP, so the server has to be a Windows server.<br />
<br />
2. Login to the file server and check the '''format of the user’s home directory shares''' on the file server. They should be in the format \\servername\path\username, e.g. \\filesvr\studenthomes$\username, \\filesvr2\staffhomes$\username, or just \\filesvr\username.<br />
<br />
3. '''Install the required server software''' on the script server: IIS, Microsoft Windows Script 5.1+, MDAC.<br />
<br />
4. '''Download WebExplorer Lite''' from this site (http://www.gleamtech.com/products/wexlite.asp). If you want a more sophisticated solution, use the paid-for options which are also available on the same website.<br />
<br />
5. '''Extract the files''' to the Inetpub/wwwroot folder on the script server.<br />
<br />
6. '''Configure WebExplorer Lite''' by editing the file config.asp and changing the following:<br />
<br />
: - Set wexPassword as blank.<br />
: - Change the line starting Const wexRoot=”/” to the following:<br />
<br />
Const wexRoot = \\servername\ & request.servervariables("REMOTE_USER")<br />
<br />
:where servername is the string that is used to access the user’s directories from Step 2.<br />
<br />
7. '''Setup authentication''' on the script server. Use IIS Manager, Websites, Default Website, Right-click Properties, Directory Security, Click Edit button in Authentication and Access Control section. Choose the authenticated access scheme which best matches your installation, e.g. most people choose Basic Authentication or Integrated Authentication. <br />
<br />
8. '''Setup Moodle NTLM authentication''' on your Moodle server. This is optional.<br />
<br />
9. '''Test the installation''' by running the default.asp script from your browser, e.g.<nowiki> http://scriptserver/default.asp</nowiki>. You should see the WebExplorer screen with your files displayed.<br />
<br />
10. '''Allow users to access the script''' by creating an HTML block on your main Moodle front page. Add the text “MyDocuments” (or whatever you prefer to call it) and link to <nowiki>http://scriptserver/default.asp</nowiki>. Save the changes and test.</div>Kawhttps://docs.moodle.org/20/en/index.php?title=File_Server_Integration&diff=37032File Server Integration2008-06-04T12:13:53Z<p>Kaw: </p>
<hr />
<div>Moodle has no direct method of integrating with a file server and accessing user’s home directories which are stored on a file server somewhere on a network. Access to users work from within Moodle is often required so that the role of a file server in the network is not duplicated. In this way users can continue to work using desktop applications on their files and yet be able to download them when they are off-campus.<br />
<br />
==Table of Contents==<br />
__TOC__<br />
<br />
==Solutions available== <br />
Here is a list of the current workarounds available to implement this facility: <br />
* '''[https://docs.moodle.org/en/WebDAV_Setup WebDav]'''. There is currently work going on to implement WebDAV, but this has yet to be implemented and should be available after Moodle 1.9. <br />
* '''[http://moodle.org/mod/data/view.php?d=13&rid=991 SMB Web client]'''. There is also available the Windows Share Web Client block which uses the smbwebclient program. The limitation of this block is that the Moodle server cannot be a Windows server.<br />
* '''WebExplorer'''. This is a ASP-based script which provides access to the file server from the Moodle server. <br />
<br />
==Using the WebExplorer script==<br />
The WebExplorer script allows users to access their home directories where the directories are stored on a Windows server (or on a Linux server running Samba). The method uses an ASP script which executes on a Windows server.<br />
<br />
1. '''Identify the script server''' that is going to run the script to access the directories. The script is written in ASP, so the server has to be a Windows server.<br />
<br />
2. Login to the file server and check the '''format of the user’s home directory shares''' on the file server. They should be in the format \\servername\path\username, e.g. \\filesvr\studenthomes$\username, \\filesvr2\staffhomes$\username, or just \\filesvr\username.<br />
<br />
3. '''Install the required server software''' on the script server: IIS, Microsoft Windows Script 5.1+, MDAC.<br />
<br />
4. '''Download WebExplorer Lite''' from this site (http://www.gleamtech.com/products/wexlite.asp). If you want a more sophisticated solution, use the paid-for options which are also available on the same website.<br />
<br />
5. '''Extract the files''' to the Inetpub/wwwroot folder on the script server.<br />
<br />
6. '''Configure WebExplorer Lite''' by editing the file config.asp and changing the following:<br />
<br />
: - Set wexPassword as blank.<br />
: - Change the line starting Const wexRoot=”/” to the following:<br />
<br />
Const wexRoot = \\servername\ & request.servervariables("REMOTE_USER")<br />
<br />
:where servername is the string that is used to access the user’s directories from Step 2.<br />
<br />
7. '''Setup authentication''' on the script server. Use IIS Manager, Websites, Default Website, Right-click Properties, Directory Security, Click Edit button in Authentication and Access Control section. Choose the authenticated access scheme which best matches your installation, e.g. most people choose Basic Authentication or Integrated Authentication. <br />
<br />
8. '''Setup Moodle NTLM authentication''' on your Moodle server.<br />
<br />
9. '''Test the installation''' by running the default.asp script from your browser, e.g.<nowiki> http://scriptserver/default.asp</nowiki>. You should see the WebExplorer screen with your files displayed.<br />
<br />
10. '''Allow users to access the script''' by creating an HTML block on your main Moodle front page. Add the text “MyDocuments” (or whatever you prefer to call it) and link to <nowiki>http://scriptserver/default.asp</nowiki>. Save the changes and test.</div>Kawhttps://docs.moodle.org/20/en/index.php?title=File_Server_Integration&diff=37031File Server Integration2008-06-04T12:13:18Z<p>Kaw: Added accessing user directories on a file server</p>
<hr />
<div>Moodle has no direct method of integrating with a file server and accessing user’s home directories which are stored on a file server somewhere on a network. Access to users work from within Moodle is often required so that the role of a file server in the network is not duplicated. In this way users can continue to work using desktop applications on their files and yet be able to download them when they are off-campus.<br />
<br />
==Table of Contents==<br />
__TOC__<br />
<br />
==Solutions available== <br />
Here is a list of the current workarounds available to implement this facility: <br />
* '''[https://docs.moodle.org/en/WebDAV_Setup WebDav]'''. There is currently work going on to implement WebDAV, but this has yet to be implemented and should be available after Moodle 1.9. <br />
* '''[http://moodle.org/mod/data/view.php?d=13&rid=991 SMB Web client]'''. There is also available the Windows Share Web Client block which uses the smbwebclient program. The limitation of this block is that the Moodle server cannot be a Windows server.<br />
* '''WebExplorer'''. This is a ASP-based script which provides access to the file server from the Moodle server. <br />
<br />
==Using WebDAV==<br />
(todo)<br />
<br />
==Using Windows Web Share Client==<br />
(todo)<br />
<br />
==Using the WebExplorer script==<br />
The WebExplorer script allows users to access their home directories where the directories are stored on a Windows server (or on a Linux server running Samba). The method uses an ASP script which executes on a Windows server.<br />
<br />
1. '''Identify the script server''' that is going to run the script to access the directories. The script is written in ASP, so the server has to be a Windows server.<br />
<br />
2. Login to the file server and check the '''format of the user’s home directory shares''' on the file server. They should be in the format \\servername\path\username, e.g. \\filesvr\studenthomes$\username, \\filesvr2\staffhomes$\username, or just \\filesvr\username.<br />
<br />
3. '''Install the required server software''' on the script server: IIS, Microsoft Windows Script 5.1+, MDAC.<br />
<br />
4. '''Download WebExplorer Lite''' from this site (http://www.gleamtech.com/products/wexlite.asp). If you want a more sophisticated solution, use the paid-for options which are also available on the same website.<br />
<br />
5. '''Extract the files''' to the Inetpub/wwwroot folder on the script server.<br />
<br />
6. '''Configure WebExplorer Lite''' by editing the file config.asp and changing the following:<br />
<br />
: - Set wexPassword as blank.<br />
: - Change the line starting Const wexRoot=”/” to the following:<br />
<br />
Const wexRoot = \\servername\ & request.servervariables("REMOTE_USER")<br />
<br />
:where servername is the string that is used to access the user’s directories from Step 2.<br />
<br />
7. '''Setup authentication''' on the script server. Use IIS Manager, Websites, Default Website, Right-click Properties, Directory Security, Click Edit button in Authentication and Access Control section. Choose the authenticated access scheme which best matches your installation, e.g. most people choose Basic Authentication or Integrated Authentication. <br />
<br />
8. '''Setup Moodle NTLM authentication''' on your Moodle server.<br />
<br />
9. '''Test the installation''' by running the default.asp script from your browser, e.g.<nowiki> http://scriptserver/default.asp</nowiki>. You should see the WebExplorer screen with your files displayed.<br />
<br />
10. '''Allow users to access the script''' by creating an HTML block on your main Moodle front page. Add the text “MyDocuments” (or whatever you prefer to call it) and link to <nowiki>http://scriptserver/default.asp</nowiki>. Save the changes and test.</div>Kawhttps://docs.moodle.org/20/en/index.php?title=Installation_FAQ&diff=36870Installation FAQ2008-05-29T06:48:11Z<p>Kaw: /* Installation hangs when setting-up database tables */ Typo</p>
<hr />
<div>{{FAQ}}<br />
==Table of Contents==<br />
__TOC__<br />
<br />
==PHP - is it installed and what version do I have?==<br />
<br />
Make a new file on your web site called ''info.php'', containing the following text, and call it from your browser:<br />
<br />
<?PHP phpinfo() ?><br />
<br />
If nothing happens then you don't have PHP installed or your webserver is not configured to handle .php files properly. See the installation docs for some information about where to download it for your computer. See the [[phpinfo]] page for details about the content of this page.<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
<br />
== System information needed for Installation Forum ==<br />
When posting questions to the installation forum, try to provide as much background information as possible about your moodle system. Use this template to copy and paste into your post:<br />
* Server Operating System name (version also if possible): <br />
* Browser name (version also if possible):<br />
* Moodle version:<br />
* Moodle install type? (New/Upgrade):<br />
* Moodle config.php attached?(Y/N):<br />
* Phpinfo attached? (Y/N):<br />
<br />
For the last two items, try to include the following in your post as an attachment:<br />
* A copy of your phpinfo output as shown in your browser (see the instructions above for an explanation of how to obtain this).<br />
* A copy of the Moodle configuration file. This is located in the directory moodle and is named config.php<br />
<br />
Copy and paste both of these into a single text file (using vi, Notepad, etc) and attach this to your post.<br />
<br />
If you cannot provide your phpinfo, try to copy & paste and complete these in your post:<br />
* Webserver (e.g. Apache/IIS) version:<br />
* Database server (e.g. MySQL, PostgreSQL) version:<br />
* PHP version:<br />
<br />
For installation on web hosting accounts: contact your support desk who should be able to tell you this information.<br />
<br />
: '''Security Warning''': Make sure you edit any files and delete any passwords before posting onto the forum.<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
<br />
==What & where are Moodle's configuration settings stored?==<br />
Configuration settings are stored in the config.php file stored in your moodle folder. This file is created during the installation process. If there is a problem and the installation cannot create the file, you can try creating it manually from the [[Configuration file]] docs. Please remember that manually editing the file is not recommended and may lead to blank pages, especially if there are additional spaces and/or lines after the final php closing tag "?>".<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==Running a health check==<br />
Moodle contains a script that will help identify common php and webserver configuration problems as well as configuration problems. It is a good idea to run this script to check if you are having post-installation problems. Use your browser to run this file:<br />
<br />
http://www.mymoodle.com/moodle/admin/health.php<br />
<br />
Change the above line if you have installed moodle in the webroot instead of a folder inside the webroot.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==Downloading previous releases of Moodle==<br />
* '''Generic Packages''': If your server does not meet the [[Installing_Moodle#Requirements | requirements]] for the current version of Moodle, you can download previous releases by using wget, lynx or curl with this URL:<br />
<nowiki>http://download.moodle.org/stable[version_number]</nowiki> <br />
:For example: to download Moodle version 1.5, use http://download.moodle.org/stable15. You'll see a directory tree with the files displayed. Click on the one you want and download as normal - if you require the latest update of the version, scroll to the end of the list and download the "moodle-latest" file, or alternatively use these URLs for zip or tgz downloads:<br />
<nowiki>http://download.moodle.org/stable[version_number]/moodle-latest-[version_number].zip</nowiki><br />
<nowiki>http://download.moodle.org/stable[version_number]/moodle-latest-[version_number].tgz</nowiki><br />
<br />
:Changes made in the version in the last month are listed in the "CHANGES" file in the directory listing. The files you download contain Moodle code and are not the Windows or Mac packages - so you need to have a webserver, a database server and PHP already installed. The earliest version available is Moodle 1.3.<br />
* '''Windows Packages''': To download previous releases of the Moodle packages for Windows, use this URL:<br />
<nowiki>http://download.moodle.org/windows/MoodleWindowsInstaller-latest-[version_number].zip</nowiki><br />
* '''Mac Packages''': To download previous releases of the Mac pacakges, use either of these URLs (depending on whether you need the Intel or PPC package):<br />
<nowiki>http://download.moodle.org/macosx/Moodle4Mac-Intel-[version_number].dmg</nowiki><br />
<nowiki>http://download.moodle.org/macosx/Moodle4Mac-PPC-[version_number}.dmg</nowiki><br />
* '''Using CVS''': You can also use CVS to download older releases and incremental releases of the Moodle generic packages, e.g. Moodle 1.5.4 - see the [[CVS_for_Administrators | CVS documentation]].<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
== How to enable and check PHP error logs==<br />
PHP can be set up to log errors in a variety of different ways: two of these involve the use of the php.ini file and the ini_set command. <br />
* '''Using the php.ini file''': The log settings are contained in the php.ini file stored on the server. If you don't know where that is, edit your Moodle ''config.php'' and add the following as the second line<br />
<br />
phpinfo();<br />
<br />
:then reload the web page. Look for the entry '''Configuration File (php.ini) Path'''.<br />
<br />
:When you have located php.ini open it in your favorite text editor. Find the '''Error handling and logging''' section of the php.ini file. Make sure that both '''display_errors = On''', '''display_startup_errors = On''' and '''log_errors = On''' are present and uncommented. Check the value of '''error_log''' - this tells you the location of the file errors are logged to. If it is commented out then errors will be sent to the web server error log file. Remember, if you make any changes to this file you will need to restart the web server (or just reboot the server).<br />
<br />
* '''Using ini_set commands''': If you are using Moodle 1.7 or higher, the previous steps are not enough. In those versions error logging parameters are dependant on certain administrative settings that you specify in the debugging section. The problem is that if you can't access the administrative pages, you can't set the debugging options. So the only way to modify them is by adding the following lines to your config.php file, just before the last line (the one containing a single'?>' only):<br />
<br />
ini_set ('display_errors', 'on');<br />
ini_set ('log_errors', 'on');<br />
ini_set ('display_startup_errors', 'on');<br />
ini_set ('error_reporting', E_ALL);<br />
<br />
:This will enable the same settings specified above even if Moodle sets them otherwise. <br />
:'''Important''': Remember to put them just before the last line of config.php.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==Any text I add with an apostrophe (') or a quote (") causes errors or comes up with a slash added==<br />
<br />
Problems caused by apostrophes are caused by incorrect "magic quotes" settings. Moodle requires the following settings in the php.ini file (which are usually the default):<br />
<br />
magic_quotes_gpc = On<br />
magic_quotes_runtime = Off<br />
<br />
Please see [[Installing Moodle]] for more details.<br />
<br />
If you are using [[Debian_GNU/Linux_installation|Debian]] then the problem might be in the version of PHP that you have installed. Have a look at this [http://tracker.moodle.org/browse/MDL-9691 bug report ] to see if it matches your situation.<br />
<br />
==Email copies are not being sent from my forums==<br />
<br />
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.<br />
<br />
Basically, you need to set up a process to regularly call the script <code><nowiki>http://yoursite/admin/cron.php</nowiki></code>. Please refer to the [[Cron|cron instructions]].<br />
<br />
Tips:<br />
* Try the default settings in ''Administration > Server > Email''. This generally works.<br />
*Make sure that ''allowuseremailcharset'' in ''Administration > Server > Email'' is set to No. Setting this to Yes can cause a problem in some versions of Moodle.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
<br />
==Error: database connection failed==<br />
<br />
If you get errors like "database connection failed" or "could not connect to the database you specified", here are some possible reasons and some possible solutions.<br />
<br />
* Your '''database server''' isn't installed or running. To check this for MySQL try typing the following command line<br />
$telnet database_host_name 3306<br />
:You should get a cryptic response which includes the version number of the MySQL server. <br />
* If you are attempting to run '''two instances of Moodle on different ports''', use the ip address of the host (not localhost) in the $CFG->dbhost setting, e.g. $CFG->dbhost = 127.0.0.1:3308.<br />
* You don't have the '''PHP mysql or postgresql extensions''' installed (please refer to FAQ re. whether PHP is installed).<br />
* You haven't created a '''Moodle database and assigned a user''' with the correct privileges to access it. <br />
* The '''Moodle database settings''' are incorrect. The database name, database user or database user password in your Moodle configuration file ''config.php'' are incorrect. Use phpMyAdmin to set up and check your MySQL installation.<br />
* Check that there are '''no apostrophes or non-alphabetic letters''' in your MySQL username or password.<br />
* You are using MySQL version 4.1 or higher but the PHP MySQL extension is pre-4.1 (check in your phpinfo output). In this case the '''default password hashing algorithm''' is incompatible with that available in the PHP mysql extension versions 4.x.x. Use these MySQL commands to change the passwords to the old format:<br />
<br />
mysql>SET PASSWORD FOR 'root'@'localhost' = OLD_PASSWORD('password');<br />
mysql>SET PASSWORD FOR 'moodleuser'@'localhost' = OLD_PASSWORD('password');<br />
<br />
:Also, consider upgrading your PHP MySQL extension. See [http://dev.mysql.com/doc/mysql/en/old-client.html this MySQL document] for further information on how to deal with this problem.<br />
* You are using Fedora core 3 or some other Linux system with '''SELinux installed''' and enabled. See the following URL for information on how to disable SELinux: http://fedora.redhat.com/projects/selinux/ If you don't want to disable SELinux, you have to allow httpd process to create network connections:<br />
<br />
setsebool httpd_can_network_connect true<br />
<br />
* Mac OSX users -- if you are running MySQL on a Mac OSX, try changing '''$CFG->dbhost''' from 'localhost' to '127.0.0.1'<br />
'''See also''': MySQL page on [http://dev.mysql.com/doc/refman/5.0/en/common-errors.html common errors] which lists several possible scenarios for connection failure, with advice on how to fix the problems.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==I can't log in - I just stay stuck on the login screen==<br />
<br />
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].<br />
<br />
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]].<br />
<br />
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>.<br />
<br />
If you are still having problems, read the [[Can_not_log_in | Cannot log in]] page.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==I can't log in with message "Please verify that the current setting of session.save_path is correct" ==<br />
<br />
This error occurs when PHP is having problems saving its session files. You may also see these other error messages displayed on the screen or in your log files:<br />
<br />
Warning: Unknown: open(some-path/sessions/sess_acbf942a7399db3489ffa910e35d5242, O_RDWR)<br />
failed: Permission denied (13) in Unknown on line 0<br />
<br />
Warning: Unknown(): open(some-path/sessions/sess_acbf942a7399db3489ffa910e35d5242, O_RDWR) <br />
failed: No space left on device (28) in Unknown on line 0<br />
<br />
Warning: Unknown: Failed to write session data (files). Please verify that the current <br />
setting of session.save_path is correct (some-path/sessions) in Unknown on line 0 <br />
<br />
To temporarily bypass these errors, '''use database sessions''' by editing your [[Configuration_file | moodle configuration file]] and adding this line:<br />
<br />
$CFG->dbsessions = true;<br />
<br />
Database sessions may overload your mysql database and are not ideal in a shared hosting environment, so if this solves the problem, you can start fixing the problem as follows:<br />
* Check '''access rights'''. The session.save_path should be accessible by the apache user. Try this command:<br />
<br />
chown -R apache:apache some-path/sessions<br />
<br />
:This assumes that 'apache' is the name of the user your webserver runs under - it could also be 'nobody'.<br />
* Check the '''permissions''' to the directory that PHP is trying to save to (session.save_path = some-path/sessions). Set the permissions initially to 0777 (everyone read, write, execute) with this command:<br />
<br />
chmod -R 0777 some-path/sessions<br />
<br />
:If this fixes the problem, reduce the permissions (700 is recommended).<br />
<br />
'''See also''': Session problems can be specific to your server environment. As an example, see [http://moodle.org/mod/forum/discuss.php?d=55925#254596 this forum discussion] about session problems with Lycos hosting.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==I log in but the login link doesn't change. I am logged in and can navigate freely.==<br />
<br />
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.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==I keep getting this error: A server error that affects your login session was detected.==<br />
<br />
Please refer to the Using Moodle forum discussion [http://moodle.org/mod/forum/discuss.php?d=73716 A server error that affects your login session was detected. Please login again or restart your browser.].<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==I keep getting this error: Failed opening required '/web/moodle/lib/setup.php'==<br />
<br />
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.<br />
<br />
Sometimes people only use the path from their home directory, or relative to the root of the web server directory.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==My pages show fatal errors such as : Parse error, call to undefined function: get_string()==<br />
<br />
If you see errors like:<br />
<br />
Parse error: parse error, unexpected T_VARIABLE in /path/to/moodle/config.php on line 94 <br />
Fatal error: Call to undefined function: get_string() in /path/to/moodle/mod/resource/lib.php<br />
on line 11<br />
<br />
then you have probably left out a semi-colon or closing quote from a line in ''config.php'' (previous to line 94).<br />
<br />
Another possibility is that you edited ''config.php'' in a program like Word and saved it as a HTML web page, instead of using a plain text editor like Notepad.<br />
<br />
Another thing to check, particularly if you are using 3rd party modules or plugins, is whether any of the php scripts use short open tags (<? ?>) instead of proper ones (<?php ?>). Short tags are bad for various reasons, so first contact the author of that extension to tell them about the problem. Then either replace short tags with conventional ones, or set this line in php.ini:<br />
<br />
short_open_tag = On<br />
<br />
You should never find short tags in core moodle code. If you do, please file a bug in the bug tracker.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==Serious Error! Could not set up the site!==<br />
<br />
Please refer to the Using Moodle forum discussion [http://moodle.org/mod/forum/discuss.php?d=32071 Serious Error! Could not set up the site!].<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==Uploaded files give "File not found"==<br />
<br />
For example: Not Found: The requested URL /moodle/file.php/2/myfile.jpg was not found on this server.<br />
<br />
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):<br />
<br />
'''AcceptPathInfo''' on<br />
<br />
Note, this will ONLY work for Apache versions 2.x.<br />
<br />
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.<br />
<br />
To use this alternative method, you should change the ''slasharguments'' variable. For moodle versions < 1.7, this is located in the Operating System section of ''Administration > Configuration > [[admin/config|Variables]]''. In later versions, this option is located in ''Site Administration > Server > HTTP''. You should now be able to access your uploaded files.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
<br />
==When I go to the admin page, I get told to make dirroot blank!==<br />
<br />
If you see errors like this:<br />
<br />
Please fix your settings in config.php: <br />
You have: $CFG->dirroot = "/home/users/fred/public_html/moodle"; <br />
but it should be: $CFG->dirroot = "";<br />
<br />
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'':<br />
<br />
if ($dirroot != $CFG->dirroot) {<br />
<br />
and change it to this:<br />
<br />
if (!empty($dirroot) and $dirroot != $CFG->dirroot) {<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==When trying to add a resource I receive error messages==<br />
<br />
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]].<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==Why are all my pages blank?==<br />
<br />
Check the dirroot variable in ''config.php''. You must use complete, absolute pathnames e.g.<br />
<br />
$CFG->dirroot = "d:\inetpub\sites\www.yoursite.com\web\moodle";<br />
<br />
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 enable PHP error displays, set these lines in your ''php.ini'' file and reload the web page.<br />
<br />
display_errors = On<br />
display_startup_errors = On<br />
<br />
To determine if MySQL support is your problem, insert this as the second line in your ''config.php'' file<br />
<br />
phpinfo();<br />
<br />
then reload the web page. Examine the output closely to see if MySQL is supported. If not look for a package you are missing.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
== Why is a particular page blank or incomplete? ==<br />
<br />
*'''Check your web server log files!!''' <br />
:If a particular page is blank or incomplete (it doesn't display the footer), before you do anything else [[Installation_FAQ#How_to_enable_and_check_PHP_error_logs | check your error logs]]. Having established that PHP error logging is working, reproduce the error. Immediately check the error log file right at the end. Hopefully you will see a PHP error message at or very near the end of the file. This may solve your problem directly or makes it a lot easier to diagnose the problem in the Moodle forums.<br />
<br />
*If you are '''upgrading to a new version of Moodle''', check that you do not have an old version of a non-standard block or module installed. Remove any such blocks or modules installed using the admin settings page and start the install process again. However, do also make sure that you have included all optional plugins that were required by your courses. <br />
<br />
*If you '''do not see any blocks listed''', turn editing on and remove any blocks that you have added to that page and try reloading.<br />
<br />
*You may get this error immediately after '''selecting a language'''. At this stage of the installation process your Moodle computer may need to connect to the Internet and download a language pack, so check that the computer can access the Internet by using a browser. Check also that your PHP settings are as given in the Moodle [[Installing_Moodle#Requirements | Moodle Requirements]] page.<br />
<br />
'''See also''':<br />
*Using Moodle [http://moodle.org/mod/forum/discuss.php?d=97734 PHP configuration error] forum discussion <br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
<br />
==Installation hangs when setting-up database tables==<br />
Sometimes the installation will hang when setting up tables. This will be an abrupt hang with half the page displayed in the browser and/or other outputs removed. Examples are:<br />
<br />
- '''Truncated mysql statements''':<br />
<br />
(mysql): SET NAMES 'utf8'<br />
--------------------------------------------------------------------------------<br />
(mysql): SHOW LOCAL VARIABLES LIKE 'character_set_database'<br />
...<br />
...<br />
(no more statements are displayed) <br />
<br />
- '''Missing Continue button''': The “Scroll to continue” link is displayed but no “Continue” button is there. <br />
<br />
'''Note''': There is an exception to this when upgrading an existing database and the installation may appear to hang at the roles generation phase. This process can take a very long time - so please be patient.<br />
<br />
Below are some solutions you can try to overcome this problem:<br />
<br />
*'''Check for mysql limits'''. This is often a mysql error and not a php error. Check that there is no limit placed on your mysql database, e.g. a "questions" limit.<br />
<br />
*'''Check your .htaccess files'''. If the install is on a webhost, adding the following line to the .htaccess file in the moodle directory has been known to solve the problem.<br />
AddType x-mapp-php5 .php<br />
<br />
:Try also renaming the .htaccess file so that it is disabled.<br />
<br />
*'''Code customizations'''. You may also want to look and see if you've customized any of your code. Look at the last successful table, and then look at the block, mod, or other code that is referenced by that table. For example, if your install hangs and continues to say that the forum tables were successful as the last message, look at /mod/forum/ for any custom code. If you have customized code, backup those files and replace with the correct files. You can then restart the install by renaming config.php or reinstalling your database from the backup. If your install is successful, you can make your code changes back into the stock Moodle code.<br />
<br />
*'''Check your memory limit'''. It may also be that the "memory_limit" in your php.ini is set too low. Please check your php.ini file and allocate the recommended amount (see [https://docs.moodle.org/en/Installing_Moodle#Requirements Moodle requirements]). For Moodle version 1.8 and above at least 40MB is recommended.<br />
<br />
*'''Upgrade incrementally'''. To avoid this problem when upgrading, it is preferable to upgrade incrementally. For example: upgrade from 1.6.* to 1.7.* and then to 1.8.* rather than straight from 1.6.* to 1.8.*<br />
<br />
A work-around to this problem is to setup a working Moodle system on your local PC or server using the [http://download.moodle.org Moodle Packages]. Once you have a running Moodle, [https://docs.moodle.org/en/Upgrading_Moodle#Backup_important_data backup the database] and import to your webhost. Then backup the Moodle code itself (the "moodle" directory on your PC) and copy this to your webhost using (for example) FTP. Finally, edit the moodle/config.php file for the new settings that have to be changed for the webhost.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
<br />
==Why can't I upload a new image into my profile?==<br />
<br />
If you don't see anything on your user profile pages to let you upload user images then it's usually because GD is not enabled on your server. GD is a library that allows image processing.<br />
<br />
1. Make sure '''GD has been included in your PHP installation'''. You can check this by going into Administration >> Configuration >> [[Variables]] and looking for the gdversion setting. This setting is chosen automatically every time you visit that page. If it shows GD version 1 or version 2 then everything should be fine. Save that configuration page and go back to your user profile.<br />
<br />
2. If Moodle thinks GD is not installed, then you will need to '''install the GD library'''. <br />
*On Unix you may need to re-compile PHP with arguments something like this:<br />
<br />
./configure --with-apxs=/usr/local/apache/bin/apxs --with-xml --with-gd <br />
--with-jpeg-dir=/usr/local --with-png-dir=/usr --with-ttf --enable-gd-native-ttf <br />
--enable-magic-quotes --with-mysql --enable-sockets --enable-track-vars <br />
--enable-versioning --with-zlib<br />
<br />
* On Windows this is usually a matter of "turning on" the extension in PHP by editing your php.ini file. To do this remove the semicolon for the php_gd2.dll extension - check that this file is actually present in your php extensions folder first (search your php.ini for extension_dir to determine where this points to on your hard disk). You should then have a line that looks like this:<br />
extension=php_gd2.dll<br />
<br />
:Windows users should see the [[Installing AMP|installation instructions]] for further help. <br />
<br />
3. Remember to '''restart your webserver''' (if possible) and re-visit the Moodle configuration page after making any changes to PHP so it can pick up the correct version of GD.<br />
<br />
'''See also''': Using Moodle forum discussion [http://moodle.org/mod/forum/discuss.php?d=44271 Profile pictures] for additional information.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==Why do I keep getting error messages about "headers already sent"?==<br />
<br />
If you see errors like this:<br />
<br />
Warning: Cannot add header information - headers already sent by <br />
(output started at /webs/moodle/config.php:87) in /webs/moodle/lib/moodlelib.php <br />
on line 1322 <br />
<br />
Warning: Cannot add header information - headers already sent by <br />
(output started at /webs/moodle/config.php:87) in /webs/moodle/lib/moodlelib.php <br />
on line 1323 <br />
<br />
Warning: Cannot add header information - headers already sent by <br />
(output started at /webs/moodle/config.php:87) in /webs/moodle/login/index.php <br />
on line 54<br />
<br />
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.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
== Why doesn't my Moodle site display the time and date correctly? ==<br />
<br />
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.<br />
<br />
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)<br />
<br />
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.<br />
<br />
==I receive this error "500:Internal Server Error"==<br />
There are several possible causes for this error:<br />
<br />
1. '''Syntax error''': There is a syntax error in your .htaccess or httpd.conf files. The way in which directives are written [http://httpd.apache.org/docs/1.3/howto/htaccess.html#when differs] depending on which file you are using. You can test for configuration errors in your Apache files using the command:<br />
#apachectl configtest<br />
<br />
2. '''PHPsuexec''': Your server does not support .htaccess files, especially if it is running PHPsuexec, which is an Apache module used for increasing the security of a site on a hosted system. In this situation:<br />
<br />
- you may also see a 403: Forbidden error.<br />
<br />
- the webserver executes under your own username and all files have a maximum permissions level of 755. Check that this is set for your Moodle directory in your control panel or (if you have access to the shell) use this command:<br />
#chmod -R 755 moodle<br />
<br />
- use a PHP.INI file instead of a .htaccess in the directory where the Moodle PHP script is being executed. For example: if you are receiving a memory exhausted error when your server is executing the file moodle/admin/cron.php, use a PHP.INI file to change your memory_limit and copy it to the moodle/admin directory. Remember that PHP.INI files are per-directory, so you'll need to copy it to each sub-directory. The syntax used in a PHP.INI file is different to a .htaccess file and you need to take out php_value/php_flag at the beginning of the line and use an equals sign to assign a value, e.g.<br />
php_value memory_limit 128M <-- .htaccess<br />
memory_limit = 128M <-- php.ini equivalent <br />
<br />
3. '''Incompatible directive''': You may have a directive in your .htaccess or httpd.conf files which are not compatible with your web server version. Check your webserver documentation.<br />
<br />
==I receive this error "403: Forbidden" ==<br />
<br />
Check your webserver configuration. See also the section above I receive this error "500:Internal Server Error".<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
<br />
==How do I uninstall Moodle?==<br />
'''Moodle package installation''': If you have downloaded a Moodle package, simply uninstall using your system commands. On Windows PCs, you should access the Control Panel -> Add/Remove Programs. Select the package name and click Change or Remove Programs.<br />
<br />
'''Webhost/manual installation''': If you have installed Moodle manually or have installed onto a webhost, follow these steps:<br />
*Delete the moodle database using this mysql command (or delete using your mysql client, e.g. PHPMyAdmin):<br />
<pre>sql>DROP DATABASE moodle;</pre><br />
:In the above example replace 'moodle' with the name of the moodle database you created when installing.<br />
*Delete the moodledata directory. If you, or your users, have uploaded materials into this directory take a copy of these before deleting this directory.<br />
*Delete the moodle directory itself. This will delete all of the moodle PHP script files.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==How do I upgrade Moodle? Do I just overwrite the files?==<br />
Do not overwrite files, it may cause strange errors. You should read the [[Upgrade]] documentation before proceeding.<br />
<br />
==Migrating Moodle to a new site or server==<br />
Migrating Moodle means that you have to move the current installation to a new server, and so may have to change IP addresses or DNS entries. To do this you will need to change the $CFG->wwwroot value in the config.php on the new server. You will also have to change any absolute links stored in the database backup file (before restoring the file on the new server) either using the admin/replace.php script, your text editor or another "search and replace" tool, e.g. sed. For more details see the [[Moodle_migration | Moodle Migration]] page.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
<br />
==Fatal error allowed memory size exhausted. How do I increase my php memory limit?==<br />
You will sometimes see an error message something like this:<br />
Fatal error: Allowed memory size of 67108864 bytes exhausted <br />
(tried to allocate xx bytes) in /var/www/moodle/yyyy.php<br />
This error means that the php memory_limit value is not enough for the php script. The memory_limit value is the "allowed memory size" - 64M in the example above (67108864 bytes / 1024 = 65536 KB. 65536 KB / 1024 = 64 MB). You will need to increase the php memory_limit value until this message is not shown anymore. There are two methods of doing this.<br />
*On a hosted installation, add the following line to your .htaccess file (or create one in the moodle directory if it does not already exist):<br />
php_value memory_limit <value>M<br />
Example: php_value memory_limit 40M<br />
*If you have your own server with shell access, edit your php.ini file (make sure it's the correct one by checking in your phpinfo output) as follows:<br />
memory_limit <value>M<br />
Example: memory_limit 40M<br />
Remember that you need to restart your web server to make changes to php.ini effective. An alternative is to disable the memory_limit by using the command ''memory_limit 0''.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==Why does my new installation display correctly on the server, but when I view it from a different machine, styles and images are missing?==<br />
In the installation instructions, one of the suggested settings for 'webroot' is 'localhost'. This is fine if all you want to do is some local testing of your new Moodle installation. If, however, you want to view your new installation from another machine on the same local area network, or view your site on the internet, you will have to change this setting:<br />
*For local testing, 'localhost' is fine for the webroot ($CFG->wwwroot in config.php). <br />
*If you want to test your site from other machines on the same local area network (LAN), then you will have to use the private ip address of the serving machine, (e.g. 192.168.1.2/moodle) or the network name of the serving computer (e.g. network_name_of_serving_machine/moodle) as the web root. Depending on your LAN setup, it may be better to use the network name of the computer rather than its (private) ip address, because the ip address can and will change from time to time. If you don't want to use the network name, then you will have to speak to your network administrator and have them assign a permanent ip address to the serving machine.<br />
*Finally, if you want to test your new installation across the internet, you will have to use either a domain name or a permanent (public) ip address/moodle as your web root. To handle both types of access, see [https://docs.moodle.org/en/masquerading masquerading].<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==Maximum upload file size - how to change it?==<br />
There are several places to change the maximum file upload size. The first place to check is the Administration block. Security -> Site Policies -> and look for "Maximum Uploaded File Size". This is the "maxbyte" variable found in older versions of Moodle (under Admin > Variables). Teachers may also set the maximum file size by the [[Course_settings#Maximum_upload_size|course administration block]].<br />
<br />
The second place to check are the server files. The php.ini file has a limit which will override any other setting. (Hint: remember to restart your server for changes to take effect). For more help see:<br />
*[[Administration_FAQ#How_do_the_limits_on_uploaded_files_work.3F]]<br />
*[[Installing_Moodle#Recheck_PHP_settings]]<br />
*[[Installing_Moodle#Using_a_.htaccess_file_for_webserver_and_PHP_settings]]<br />
*[[Site_policies#Maximum_uploaded_file_size]]<br />
<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
<br />
==See also==<br />
[[Category:FAQ]]<br />
[[Category:Installation]]<br />
<br />
[[es:FAQ Instalación]]<br />
[[fr:FAQ d'installation]]<br />
[[nl:Installatie FAQ]]<br />
[[ja:インストールFAQ]]<br />
[[ru:Установка FAQ]]<br />
[[pl:Instalacja FAQ]]</div>Kawhttps://docs.moodle.org/20/en/index.php?title=Installation_FAQ&diff=36869Installation FAQ2008-05-29T06:47:08Z<p>Kaw: /* Why is a particular page blank or incomplete? */ Typo</p>
<hr />
<div>{{FAQ}}<br />
==Table of Contents==<br />
__TOC__<br />
<br />
==PHP - is it installed and what version do I have?==<br />
<br />
Make a new file on your web site called ''info.php'', containing the following text, and call it from your browser:<br />
<br />
<?PHP phpinfo() ?><br />
<br />
If nothing happens then you don't have PHP installed or your webserver is not configured to handle .php files properly. See the installation docs for some information about where to download it for your computer. See the [[phpinfo]] page for details about the content of this page.<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
<br />
== System information needed for Installation Forum ==<br />
When posting questions to the installation forum, try to provide as much background information as possible about your moodle system. Use this template to copy and paste into your post:<br />
* Server Operating System name (version also if possible): <br />
* Browser name (version also if possible):<br />
* Moodle version:<br />
* Moodle install type? (New/Upgrade):<br />
* Moodle config.php attached?(Y/N):<br />
* Phpinfo attached? (Y/N):<br />
<br />
For the last two items, try to include the following in your post as an attachment:<br />
* A copy of your phpinfo output as shown in your browser (see the instructions above for an explanation of how to obtain this).<br />
* A copy of the Moodle configuration file. This is located in the directory moodle and is named config.php<br />
<br />
Copy and paste both of these into a single text file (using vi, Notepad, etc) and attach this to your post.<br />
<br />
If you cannot provide your phpinfo, try to copy & paste and complete these in your post:<br />
* Webserver (e.g. Apache/IIS) version:<br />
* Database server (e.g. MySQL, PostgreSQL) version:<br />
* PHP version:<br />
<br />
For installation on web hosting accounts: contact your support desk who should be able to tell you this information.<br />
<br />
: '''Security Warning''': Make sure you edit any files and delete any passwords before posting onto the forum.<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
<br />
==What & where are Moodle's configuration settings stored?==<br />
Configuration settings are stored in the config.php file stored in your moodle folder. This file is created during the installation process. If there is a problem and the installation cannot create the file, you can try creating it manually from the [[Configuration file]] docs. Please remember that manually editing the file is not recommended and may lead to blank pages, especially if there are additional spaces and/or lines after the final php closing tag "?>".<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==Running a health check==<br />
Moodle contains a script that will help identify common php and webserver configuration problems as well as configuration problems. It is a good idea to run this script to check if you are having post-installation problems. Use your browser to run this file:<br />
<br />
http://www.mymoodle.com/moodle/admin/health.php<br />
<br />
Change the above line if you have installed moodle in the webroot instead of a folder inside the webroot.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==Downloading previous releases of Moodle==<br />
* '''Generic Packages''': If your server does not meet the [[Installing_Moodle#Requirements | requirements]] for the current version of Moodle, you can download previous releases by using wget, lynx or curl with this URL:<br />
<nowiki>http://download.moodle.org/stable[version_number]</nowiki> <br />
:For example: to download Moodle version 1.5, use http://download.moodle.org/stable15. You'll see a directory tree with the files displayed. Click on the one you want and download as normal - if you require the latest update of the version, scroll to the end of the list and download the "moodle-latest" file, or alternatively use these URLs for zip or tgz downloads:<br />
<nowiki>http://download.moodle.org/stable[version_number]/moodle-latest-[version_number].zip</nowiki><br />
<nowiki>http://download.moodle.org/stable[version_number]/moodle-latest-[version_number].tgz</nowiki><br />
<br />
:Changes made in the version in the last month are listed in the "CHANGES" file in the directory listing. The files you download contain Moodle code and are not the Windows or Mac packages - so you need to have a webserver, a database server and PHP already installed. The earliest version available is Moodle 1.3.<br />
* '''Windows Packages''': To download previous releases of the Moodle packages for Windows, use this URL:<br />
<nowiki>http://download.moodle.org/windows/MoodleWindowsInstaller-latest-[version_number].zip</nowiki><br />
* '''Mac Packages''': To download previous releases of the Mac pacakges, use either of these URLs (depending on whether you need the Intel or PPC package):<br />
<nowiki>http://download.moodle.org/macosx/Moodle4Mac-Intel-[version_number].dmg</nowiki><br />
<nowiki>http://download.moodle.org/macosx/Moodle4Mac-PPC-[version_number}.dmg</nowiki><br />
* '''Using CVS''': You can also use CVS to download older releases and incremental releases of the Moodle generic packages, e.g. Moodle 1.5.4 - see the [[CVS_for_Administrators | CVS documentation]].<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
== How to enable and check PHP error logs==<br />
PHP can be set up to log errors in a variety of different ways: two of these involve the use of the php.ini file and the ini_set command. <br />
* '''Using the php.ini file''': The log settings are contained in the php.ini file stored on the server. If you don't know where that is, edit your Moodle ''config.php'' and add the following as the second line<br />
<br />
phpinfo();<br />
<br />
:then reload the web page. Look for the entry '''Configuration File (php.ini) Path'''.<br />
<br />
:When you have located php.ini open it in your favorite text editor. Find the '''Error handling and logging''' section of the php.ini file. Make sure that both '''display_errors = On''', '''display_startup_errors = On''' and '''log_errors = On''' are present and uncommented. Check the value of '''error_log''' - this tells you the location of the file errors are logged to. If it is commented out then errors will be sent to the web server error log file. Remember, if you make any changes to this file you will need to restart the web server (or just reboot the server).<br />
<br />
* '''Using ini_set commands''': If you are using Moodle 1.7 or higher, the previous steps are not enough. In those versions error logging parameters are dependant on certain administrative settings that you specify in the debugging section. The problem is that if you can't access the administrative pages, you can't set the debugging options. So the only way to modify them is by adding the following lines to your config.php file, just before the last line (the one containing a single'?>' only):<br />
<br />
ini_set ('display_errors', 'on');<br />
ini_set ('log_errors', 'on');<br />
ini_set ('display_startup_errors', 'on');<br />
ini_set ('error_reporting', E_ALL);<br />
<br />
:This will enable the same settings specified above even if Moodle sets them otherwise. <br />
:'''Important''': Remember to put them just before the last line of config.php.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==Any text I add with an apostrophe (') or a quote (") causes errors or comes up with a slash added==<br />
<br />
Problems caused by apostrophes are caused by incorrect "magic quotes" settings. Moodle requires the following settings in the php.ini file (which are usually the default):<br />
<br />
magic_quotes_gpc = On<br />
magic_quotes_runtime = Off<br />
<br />
Please see [[Installing Moodle]] for more details.<br />
<br />
If you are using [[Debian_GNU/Linux_installation|Debian]] then the problem might be in the version of PHP that you have installed. Have a look at this [http://tracker.moodle.org/browse/MDL-9691 bug report ] to see if it matches your situation.<br />
<br />
==Email copies are not being sent from my forums==<br />
<br />
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.<br />
<br />
Basically, you need to set up a process to regularly call the script <code><nowiki>http://yoursite/admin/cron.php</nowiki></code>. Please refer to the [[Cron|cron instructions]].<br />
<br />
Tips:<br />
* Try the default settings in ''Administration > Server > Email''. This generally works.<br />
*Make sure that ''allowuseremailcharset'' in ''Administration > Server > Email'' is set to No. Setting this to Yes can cause a problem in some versions of Moodle.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
<br />
==Error: database connection failed==<br />
<br />
If you get errors like "database connection failed" or "could not connect to the database you specified", here are some possible reasons and some possible solutions.<br />
<br />
* Your '''database server''' isn't installed or running. To check this for MySQL try typing the following command line<br />
$telnet database_host_name 3306<br />
:You should get a cryptic response which includes the version number of the MySQL server. <br />
* If you are attempting to run '''two instances of Moodle on different ports''', use the ip address of the host (not localhost) in the $CFG->dbhost setting, e.g. $CFG->dbhost = 127.0.0.1:3308.<br />
* You don't have the '''PHP mysql or postgresql extensions''' installed (please refer to FAQ re. whether PHP is installed).<br />
* You haven't created a '''Moodle database and assigned a user''' with the correct privileges to access it. <br />
* The '''Moodle database settings''' are incorrect. The database name, database user or database user password in your Moodle configuration file ''config.php'' are incorrect. Use phpMyAdmin to set up and check your MySQL installation.<br />
* Check that there are '''no apostrophes or non-alphabetic letters''' in your MySQL username or password.<br />
* You are using MySQL version 4.1 or higher but the PHP MySQL extension is pre-4.1 (check in your phpinfo output). In this case the '''default password hashing algorithm''' is incompatible with that available in the PHP mysql extension versions 4.x.x. Use these MySQL commands to change the passwords to the old format:<br />
<br />
mysql>SET PASSWORD FOR 'root'@'localhost' = OLD_PASSWORD('password');<br />
mysql>SET PASSWORD FOR 'moodleuser'@'localhost' = OLD_PASSWORD('password');<br />
<br />
:Also, consider upgrading your PHP MySQL extension. See [http://dev.mysql.com/doc/mysql/en/old-client.html this MySQL document] for further information on how to deal with this problem.<br />
* You are using Fedora core 3 or some other Linux system with '''SELinux installed''' and enabled. See the following URL for information on how to disable SELinux: http://fedora.redhat.com/projects/selinux/ If you don't want to disable SELinux, you have to allow httpd process to create network connections:<br />
<br />
setsebool httpd_can_network_connect true<br />
<br />
* Mac OSX users -- if you are running MySQL on a Mac OSX, try changing '''$CFG->dbhost''' from 'localhost' to '127.0.0.1'<br />
'''See also''': MySQL page on [http://dev.mysql.com/doc/refman/5.0/en/common-errors.html common errors] which lists several possible scenarios for connection failure, with advice on how to fix the problems.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==I can't log in - I just stay stuck on the login screen==<br />
<br />
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].<br />
<br />
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]].<br />
<br />
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>.<br />
<br />
If you are still having problems, read the [[Can_not_log_in | Cannot log in]] page.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==I can't log in with message "Please verify that the current setting of session.save_path is correct" ==<br />
<br />
This error occurs when PHP is having problems saving its session files. You may also see these other error messages displayed on the screen or in your log files:<br />
<br />
Warning: Unknown: open(some-path/sessions/sess_acbf942a7399db3489ffa910e35d5242, O_RDWR)<br />
failed: Permission denied (13) in Unknown on line 0<br />
<br />
Warning: Unknown(): open(some-path/sessions/sess_acbf942a7399db3489ffa910e35d5242, O_RDWR) <br />
failed: No space left on device (28) in Unknown on line 0<br />
<br />
Warning: Unknown: Failed to write session data (files). Please verify that the current <br />
setting of session.save_path is correct (some-path/sessions) in Unknown on line 0 <br />
<br />
To temporarily bypass these errors, '''use database sessions''' by editing your [[Configuration_file | moodle configuration file]] and adding this line:<br />
<br />
$CFG->dbsessions = true;<br />
<br />
Database sessions may overload your mysql database and are not ideal in a shared hosting environment, so if this solves the problem, you can start fixing the problem as follows:<br />
* Check '''access rights'''. The session.save_path should be accessible by the apache user. Try this command:<br />
<br />
chown -R apache:apache some-path/sessions<br />
<br />
:This assumes that 'apache' is the name of the user your webserver runs under - it could also be 'nobody'.<br />
* Check the '''permissions''' to the directory that PHP is trying to save to (session.save_path = some-path/sessions). Set the permissions initially to 0777 (everyone read, write, execute) with this command:<br />
<br />
chmod -R 0777 some-path/sessions<br />
<br />
:If this fixes the problem, reduce the permissions (700 is recommended).<br />
<br />
'''See also''': Session problems can be specific to your server environment. As an example, see [http://moodle.org/mod/forum/discuss.php?d=55925#254596 this forum discussion] about session problems with Lycos hosting.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==I log in but the login link doesn't change. I am logged in and can navigate freely.==<br />
<br />
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.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==I keep getting this error: A server error that affects your login session was detected.==<br />
<br />
Please refer to the Using Moodle forum discussion [http://moodle.org/mod/forum/discuss.php?d=73716 A server error that affects your login session was detected. Please login again or restart your browser.].<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==I keep getting this error: Failed opening required '/web/moodle/lib/setup.php'==<br />
<br />
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.<br />
<br />
Sometimes people only use the path from their home directory, or relative to the root of the web server directory.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==My pages show fatal errors such as : Parse error, call to undefined function: get_string()==<br />
<br />
If you see errors like:<br />
<br />
Parse error: parse error, unexpected T_VARIABLE in /path/to/moodle/config.php on line 94 <br />
Fatal error: Call to undefined function: get_string() in /path/to/moodle/mod/resource/lib.php<br />
on line 11<br />
<br />
then you have probably left out a semi-colon or closing quote from a line in ''config.php'' (previous to line 94).<br />
<br />
Another possibility is that you edited ''config.php'' in a program like Word and saved it as a HTML web page, instead of using a plain text editor like Notepad.<br />
<br />
Another thing to check, particularly if you are using 3rd party modules or plugins, is whether any of the php scripts use short open tags (<? ?>) instead of proper ones (<?php ?>). Short tags are bad for various reasons, so first contact the author of that extension to tell them about the problem. Then either replace short tags with conventional ones, or set this line in php.ini:<br />
<br />
short_open_tag = On<br />
<br />
You should never find short tags in core moodle code. If you do, please file a bug in the bug tracker.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==Serious Error! Could not set up the site!==<br />
<br />
Please refer to the Using Moodle forum discussion [http://moodle.org/mod/forum/discuss.php?d=32071 Serious Error! Could not set up the site!].<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==Uploaded files give "File not found"==<br />
<br />
For example: Not Found: The requested URL /moodle/file.php/2/myfile.jpg was not found on this server.<br />
<br />
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):<br />
<br />
'''AcceptPathInfo''' on<br />
<br />
Note, this will ONLY work for Apache versions 2.x.<br />
<br />
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.<br />
<br />
To use this alternative method, you should change the ''slasharguments'' variable. For moodle versions < 1.7, this is located in the Operating System section of ''Administration > Configuration > [[admin/config|Variables]]''. In later versions, this option is located in ''Site Administration > Server > HTTP''. You should now be able to access your uploaded files.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
<br />
==When I go to the admin page, I get told to make dirroot blank!==<br />
<br />
If you see errors like this:<br />
<br />
Please fix your settings in config.php: <br />
You have: $CFG->dirroot = "/home/users/fred/public_html/moodle"; <br />
but it should be: $CFG->dirroot = "";<br />
<br />
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'':<br />
<br />
if ($dirroot != $CFG->dirroot) {<br />
<br />
and change it to this:<br />
<br />
if (!empty($dirroot) and $dirroot != $CFG->dirroot) {<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==When trying to add a resource I receive error messages==<br />
<br />
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]].<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==Why are all my pages blank?==<br />
<br />
Check the dirroot variable in ''config.php''. You must use complete, absolute pathnames e.g.<br />
<br />
$CFG->dirroot = "d:\inetpub\sites\www.yoursite.com\web\moodle";<br />
<br />
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 enable PHP error displays, set these lines in your ''php.ini'' file and reload the web page.<br />
<br />
display_errors = On<br />
display_startup_errors = On<br />
<br />
To determine if MySQL support is your problem, insert this as the second line in your ''config.php'' file<br />
<br />
phpinfo();<br />
<br />
then reload the web page. Examine the output closely to see if MySQL is supported. If not look for a package you are missing.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
== Why is a particular page blank or incomplete? ==<br />
<br />
*'''Check your web server log files!!''' <br />
:If a particular page is blank or incomplete (it doesn't display the footer), before you do anything else [[Installation_FAQ#How_to_enable_and_check_PHP_error_logs | check your error logs]]. Having established that PHP error logging is working, reproduce the error. Immediately check the error log file right at the end. Hopefully you will see a PHP error message at or very near the end of the file. This may solve your problem directly or makes it a lot easier to diagnose the problem in the Moodle forums.<br />
<br />
*If you are '''upgrading to a new version of Moodle''', check that you do not have an old version of a non-standard block or module installed. Remove any such blocks or modules installed using the admin settings page and start the install process again. However, do also make sure that you have included all optional plugins that were required by your courses. <br />
<br />
*If you '''do not see any blocks listed''', turn editing on and remove any blocks that you have added to that page and try reloading.<br />
<br />
*You may get this error immediately after '''selecting a language'''. At this stage of the installation process your Moodle computer may need to connect to the Internet and download a language pack, so check that the computer can access the Internet by using a browser. Check also that your PHP settings are as given in the Moodle [[Installing_Moodle#Requirements | Moodle Requirements]] page.<br />
<br />
'''See also''':<br />
*Using Moodle [http://moodle.org/mod/forum/discuss.php?d=97734 PHP configuration error] forum discussion <br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
<br />
==Installation hangs when setting-up database tables==<br />
Sometimes the installation will hang when setting up tables. This will be an abrupt hang with half the page displayed in the browser and/or other outputs removed. Examples are:<br />
<br />
- '''Truncated mysql statements''':<br />
<br />
(mysql): SET NAMES 'utf8'<br />
--------------------------------------------------------------------------------<br />
(mysql): SHOW LOCAL VARIABLES LIKE 'character_set_database'<br />
...<br />
...<br />
(no more statements are displayed) <br />
<br />
- '''Missing Continue button''': The “Scroll to continue” link is displayed but no “Continue” button is there. <br />
<br />
'''Note''': There is an exception to this when upgrading an existing database and the installation may appear to hang at the roles generation phase. This process can take a very long time - so please be patient.<br />
<br />
Below are some solutions you can try to overcome this problem:<br />
<br />
*'''Check for mysql limits'''. This is often a mysql error and not a php error. Check that there is no limit placed on your mysql database, e.g. a "questions" limit.<br />
<br />
*'''Check your .htaccess files'''. If the install is on a webhost, adding the following line to the .htaccess file in the moodle directory has been known to solve the problem.<br />
AddType x-mapp-php5 .php<br />
<br />
:Try also renaming the .htaccess file so that it is disabled.<br />
<br />
*'''Code customizations'''. You may also want to look and see if you've customized any of your code. Look at the last successful table, and then look at the block, mod, or other code that is referenced by that table. For example, if your install hangs and continues to say that the forum tables were successful as the last message, look at /mod/forum/ for any custom code. If you have customized code, backup those files and replace with the correct files. You can then restart the install by renaming config.php or reinstalling your database from the backup. If your install is successful, you can make your code changes back into the stock Moodle code.<br />
<br />
*'''Check your memory limit'''. It may also be that the "memory_limit" in your php.ini is set too low. Please check your php.ini file and allocate the recommended amount (see [https://docs.moodle.org/en/Installing_Moodle#Requirements Moodle requirements]). For Moodle version 1.8 and above at least 40MB is recommended.<br />
<br />
*'''Upgrade incrementally'''. To avoid this problem when upgrading, prefer to upgrade incrementally. For example: upgrade from 1.6.* to 1.7.* and then to 1.8.* rather than straight from 1.6.* to 1.8.*<br />
<br />
A work-around to this problem is to setup a working Moodle system on your local PC or server using the [http://download.moodle.org Moodle Packages]. Once you have a running Moodle, [https://docs.moodle.org/en/Upgrading_Moodle#Backup_important_data backup the database] and import to your webhost. Then backup the Moodle code itself (the "moodle" directory on your PC) and copy this to your webhost using (for example) FTP. Finally, edit the moodle/config.php file for the new settings that have to be changed for the webhost.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
<br />
==Why can't I upload a new image into my profile?==<br />
<br />
If you don't see anything on your user profile pages to let you upload user images then it's usually because GD is not enabled on your server. GD is a library that allows image processing.<br />
<br />
1. Make sure '''GD has been included in your PHP installation'''. You can check this by going into Administration >> Configuration >> [[Variables]] and looking for the gdversion setting. This setting is chosen automatically every time you visit that page. If it shows GD version 1 or version 2 then everything should be fine. Save that configuration page and go back to your user profile.<br />
<br />
2. If Moodle thinks GD is not installed, then you will need to '''install the GD library'''. <br />
*On Unix you may need to re-compile PHP with arguments something like this:<br />
<br />
./configure --with-apxs=/usr/local/apache/bin/apxs --with-xml --with-gd <br />
--with-jpeg-dir=/usr/local --with-png-dir=/usr --with-ttf --enable-gd-native-ttf <br />
--enable-magic-quotes --with-mysql --enable-sockets --enable-track-vars <br />
--enable-versioning --with-zlib<br />
<br />
* On Windows this is usually a matter of "turning on" the extension in PHP by editing your php.ini file. To do this remove the semicolon for the php_gd2.dll extension - check that this file is actually present in your php extensions folder first (search your php.ini for extension_dir to determine where this points to on your hard disk). You should then have a line that looks like this:<br />
extension=php_gd2.dll<br />
<br />
:Windows users should see the [[Installing AMP|installation instructions]] for further help. <br />
<br />
3. Remember to '''restart your webserver''' (if possible) and re-visit the Moodle configuration page after making any changes to PHP so it can pick up the correct version of GD.<br />
<br />
'''See also''': Using Moodle forum discussion [http://moodle.org/mod/forum/discuss.php?d=44271 Profile pictures] for additional information.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==Why do I keep getting error messages about "headers already sent"?==<br />
<br />
If you see errors like this:<br />
<br />
Warning: Cannot add header information - headers already sent by <br />
(output started at /webs/moodle/config.php:87) in /webs/moodle/lib/moodlelib.php <br />
on line 1322 <br />
<br />
Warning: Cannot add header information - headers already sent by <br />
(output started at /webs/moodle/config.php:87) in /webs/moodle/lib/moodlelib.php <br />
on line 1323 <br />
<br />
Warning: Cannot add header information - headers already sent by <br />
(output started at /webs/moodle/config.php:87) in /webs/moodle/login/index.php <br />
on line 54<br />
<br />
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.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
== Why doesn't my Moodle site display the time and date correctly? ==<br />
<br />
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.<br />
<br />
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)<br />
<br />
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.<br />
<br />
==I receive this error "500:Internal Server Error"==<br />
There are several possible causes for this error:<br />
<br />
1. '''Syntax error''': There is a syntax error in your .htaccess or httpd.conf files. The way in which directives are written [http://httpd.apache.org/docs/1.3/howto/htaccess.html#when differs] depending on which file you are using. You can test for configuration errors in your Apache files using the command:<br />
#apachectl configtest<br />
<br />
2. '''PHPsuexec''': Your server does not support .htaccess files, especially if it is running PHPsuexec, which is an Apache module used for increasing the security of a site on a hosted system. In this situation:<br />
<br />
- you may also see a 403: Forbidden error.<br />
<br />
- the webserver executes under your own username and all files have a maximum permissions level of 755. Check that this is set for your Moodle directory in your control panel or (if you have access to the shell) use this command:<br />
#chmod -R 755 moodle<br />
<br />
- use a PHP.INI file instead of a .htaccess in the directory where the Moodle PHP script is being executed. For example: if you are receiving a memory exhausted error when your server is executing the file moodle/admin/cron.php, use a PHP.INI file to change your memory_limit and copy it to the moodle/admin directory. Remember that PHP.INI files are per-directory, so you'll need to copy it to each sub-directory. The syntax used in a PHP.INI file is different to a .htaccess file and you need to take out php_value/php_flag at the beginning of the line and use an equals sign to assign a value, e.g.<br />
php_value memory_limit 128M <-- .htaccess<br />
memory_limit = 128M <-- php.ini equivalent <br />
<br />
3. '''Incompatible directive''': You may have a directive in your .htaccess or httpd.conf files which are not compatible with your web server version. Check your webserver documentation.<br />
<br />
==I receive this error "403: Forbidden" ==<br />
<br />
Check your webserver configuration. See also the section above I receive this error "500:Internal Server Error".<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
<br />
==How do I uninstall Moodle?==<br />
'''Moodle package installation''': If you have downloaded a Moodle package, simply uninstall using your system commands. On Windows PCs, you should access the Control Panel -> Add/Remove Programs. Select the package name and click Change or Remove Programs.<br />
<br />
'''Webhost/manual installation''': If you have installed Moodle manually or have installed onto a webhost, follow these steps:<br />
*Delete the moodle database using this mysql command (or delete using your mysql client, e.g. PHPMyAdmin):<br />
<pre>sql>DROP DATABASE moodle;</pre><br />
:In the above example replace 'moodle' with the name of the moodle database you created when installing.<br />
*Delete the moodledata directory. If you, or your users, have uploaded materials into this directory take a copy of these before deleting this directory.<br />
*Delete the moodle directory itself. This will delete all of the moodle PHP script files.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==How do I upgrade Moodle? Do I just overwrite the files?==<br />
Do not overwrite files, it may cause strange errors. You should read the [[Upgrade]] documentation before proceeding.<br />
<br />
==Migrating Moodle to a new site or server==<br />
Migrating Moodle means that you have to move the current installation to a new server, and so may have to change IP addresses or DNS entries. To do this you will need to change the $CFG->wwwroot value in the config.php on the new server. You will also have to change any absolute links stored in the database backup file (before restoring the file on the new server) either using the admin/replace.php script, your text editor or another "search and replace" tool, e.g. sed. For more details see the [[Moodle_migration | Moodle Migration]] page.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
<br />
==Fatal error allowed memory size exhausted. How do I increase my php memory limit?==<br />
You will sometimes see an error message something like this:<br />
Fatal error: Allowed memory size of 67108864 bytes exhausted <br />
(tried to allocate xx bytes) in /var/www/moodle/yyyy.php<br />
This error means that the php memory_limit value is not enough for the php script. The memory_limit value is the "allowed memory size" - 64M in the example above (67108864 bytes / 1024 = 65536 KB. 65536 KB / 1024 = 64 MB). You will need to increase the php memory_limit value until this message is not shown anymore. There are two methods of doing this.<br />
*On a hosted installation, add the following line to your .htaccess file (or create one in the moodle directory if it does not already exist):<br />
php_value memory_limit <value>M<br />
Example: php_value memory_limit 40M<br />
*If you have your own server with shell access, edit your php.ini file (make sure it's the correct one by checking in your phpinfo output) as follows:<br />
memory_limit <value>M<br />
Example: memory_limit 40M<br />
Remember that you need to restart your web server to make changes to php.ini effective. An alternative is to disable the memory_limit by using the command ''memory_limit 0''.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==Why does my new installation display correctly on the server, but when I view it from a different machine, styles and images are missing?==<br />
In the installation instructions, one of the suggested settings for 'webroot' is 'localhost'. This is fine if all you want to do is some local testing of your new Moodle installation. If, however, you want to view your new installation from another machine on the same local area network, or view your site on the internet, you will have to change this setting:<br />
*For local testing, 'localhost' is fine for the webroot ($CFG->wwwroot in config.php). <br />
*If you want to test your site from other machines on the same local area network (LAN), then you will have to use the private ip address of the serving machine, (e.g. 192.168.1.2/moodle) or the network name of the serving computer (e.g. network_name_of_serving_machine/moodle) as the web root. Depending on your LAN setup, it may be better to use the network name of the computer rather than its (private) ip address, because the ip address can and will change from time to time. If you don't want to use the network name, then you will have to speak to your network administrator and have them assign a permanent ip address to the serving machine.<br />
*Finally, if you want to test your new installation across the internet, you will have to use either a domain name or a permanent (public) ip address/moodle as your web root. To handle both types of access, see [https://docs.moodle.org/en/masquerading masquerading].<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==Maximum upload file size - how to change it?==<br />
There are several places to change the maximum file upload size. The first place to check is the Administration block. Security -> Site Policies -> and look for "Maximum Uploaded File Size". This is the "maxbyte" variable found in older versions of Moodle (under Admin > Variables). Teachers may also set the maximum file size by the [[Course_settings#Maximum_upload_size|course administration block]].<br />
<br />
The second place to check are the server files. The php.ini file has a limit which will override any other setting. (Hint: remember to restart your server for changes to take effect). For more help see:<br />
*[[Administration_FAQ#How_do_the_limits_on_uploaded_files_work.3F]]<br />
*[[Installing_Moodle#Recheck_PHP_settings]]<br />
*[[Installing_Moodle#Using_a_.htaccess_file_for_webserver_and_PHP_settings]]<br />
*[[Site_policies#Maximum_uploaded_file_size]]<br />
<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
<br />
==See also==<br />
[[Category:FAQ]]<br />
[[Category:Installation]]<br />
<br />
[[es:FAQ Instalación]]<br />
[[fr:FAQ d'installation]]<br />
[[nl:Installatie FAQ]]<br />
[[ja:インストールFAQ]]<br />
[[ru:Установка FAQ]]<br />
[[pl:Instalacja FAQ]]</div>Kawhttps://docs.moodle.org/20/en/index.php?title=Installation_FAQ&diff=36868Installation FAQ2008-05-29T06:45:38Z<p>Kaw: /* Why is a particular page blank or incomplete? */ Added language pack as an example</p>
<hr />
<div>{{FAQ}}<br />
==Table of Contents==<br />
__TOC__<br />
<br />
==PHP - is it installed and what version do I have?==<br />
<br />
Make a new file on your web site called ''info.php'', containing the following text, and call it from your browser:<br />
<br />
<?PHP phpinfo() ?><br />
<br />
If nothing happens then you don't have PHP installed or your webserver is not configured to handle .php files properly. See the installation docs for some information about where to download it for your computer. See the [[phpinfo]] page for details about the content of this page.<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
<br />
== System information needed for Installation Forum ==<br />
When posting questions to the installation forum, try to provide as much background information as possible about your moodle system. Use this template to copy and paste into your post:<br />
* Server Operating System name (version also if possible): <br />
* Browser name (version also if possible):<br />
* Moodle version:<br />
* Moodle install type? (New/Upgrade):<br />
* Moodle config.php attached?(Y/N):<br />
* Phpinfo attached? (Y/N):<br />
<br />
For the last two items, try to include the following in your post as an attachment:<br />
* A copy of your phpinfo output as shown in your browser (see the instructions above for an explanation of how to obtain this).<br />
* A copy of the Moodle configuration file. This is located in the directory moodle and is named config.php<br />
<br />
Copy and paste both of these into a single text file (using vi, Notepad, etc) and attach this to your post.<br />
<br />
If you cannot provide your phpinfo, try to copy & paste and complete these in your post:<br />
* Webserver (e.g. Apache/IIS) version:<br />
* Database server (e.g. MySQL, PostgreSQL) version:<br />
* PHP version:<br />
<br />
For installation on web hosting accounts: contact your support desk who should be able to tell you this information.<br />
<br />
: '''Security Warning''': Make sure you edit any files and delete any passwords before posting onto the forum.<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
<br />
==What & where are Moodle's configuration settings stored?==<br />
Configuration settings are stored in the config.php file stored in your moodle folder. This file is created during the installation process. If there is a problem and the installation cannot create the file, you can try creating it manually from the [[Configuration file]] docs. Please remember that manually editing the file is not recommended and may lead to blank pages, especially if there are additional spaces and/or lines after the final php closing tag "?>".<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==Running a health check==<br />
Moodle contains a script that will help identify common php and webserver configuration problems as well as configuration problems. It is a good idea to run this script to check if you are having post-installation problems. Use your browser to run this file:<br />
<br />
http://www.mymoodle.com/moodle/admin/health.php<br />
<br />
Change the above line if you have installed moodle in the webroot instead of a folder inside the webroot.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==Downloading previous releases of Moodle==<br />
* '''Generic Packages''': If your server does not meet the [[Installing_Moodle#Requirements | requirements]] for the current version of Moodle, you can download previous releases by using wget, lynx or curl with this URL:<br />
<nowiki>http://download.moodle.org/stable[version_number]</nowiki> <br />
:For example: to download Moodle version 1.5, use http://download.moodle.org/stable15. You'll see a directory tree with the files displayed. Click on the one you want and download as normal - if you require the latest update of the version, scroll to the end of the list and download the "moodle-latest" file, or alternatively use these URLs for zip or tgz downloads:<br />
<nowiki>http://download.moodle.org/stable[version_number]/moodle-latest-[version_number].zip</nowiki><br />
<nowiki>http://download.moodle.org/stable[version_number]/moodle-latest-[version_number].tgz</nowiki><br />
<br />
:Changes made in the version in the last month are listed in the "CHANGES" file in the directory listing. The files you download contain Moodle code and are not the Windows or Mac packages - so you need to have a webserver, a database server and PHP already installed. The earliest version available is Moodle 1.3.<br />
* '''Windows Packages''': To download previous releases of the Moodle packages for Windows, use this URL:<br />
<nowiki>http://download.moodle.org/windows/MoodleWindowsInstaller-latest-[version_number].zip</nowiki><br />
* '''Mac Packages''': To download previous releases of the Mac pacakges, use either of these URLs (depending on whether you need the Intel or PPC package):<br />
<nowiki>http://download.moodle.org/macosx/Moodle4Mac-Intel-[version_number].dmg</nowiki><br />
<nowiki>http://download.moodle.org/macosx/Moodle4Mac-PPC-[version_number}.dmg</nowiki><br />
* '''Using CVS''': You can also use CVS to download older releases and incremental releases of the Moodle generic packages, e.g. Moodle 1.5.4 - see the [[CVS_for_Administrators | CVS documentation]].<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
== How to enable and check PHP error logs==<br />
PHP can be set up to log errors in a variety of different ways: two of these involve the use of the php.ini file and the ini_set command. <br />
* '''Using the php.ini file''': The log settings are contained in the php.ini file stored on the server. If you don't know where that is, edit your Moodle ''config.php'' and add the following as the second line<br />
<br />
phpinfo();<br />
<br />
:then reload the web page. Look for the entry '''Configuration File (php.ini) Path'''.<br />
<br />
:When you have located php.ini open it in your favorite text editor. Find the '''Error handling and logging''' section of the php.ini file. Make sure that both '''display_errors = On''', '''display_startup_errors = On''' and '''log_errors = On''' are present and uncommented. Check the value of '''error_log''' - this tells you the location of the file errors are logged to. If it is commented out then errors will be sent to the web server error log file. Remember, if you make any changes to this file you will need to restart the web server (or just reboot the server).<br />
<br />
* '''Using ini_set commands''': If you are using Moodle 1.7 or higher, the previous steps are not enough. In those versions error logging parameters are dependant on certain administrative settings that you specify in the debugging section. The problem is that if you can't access the administrative pages, you can't set the debugging options. So the only way to modify them is by adding the following lines to your config.php file, just before the last line (the one containing a single'?>' only):<br />
<br />
ini_set ('display_errors', 'on');<br />
ini_set ('log_errors', 'on');<br />
ini_set ('display_startup_errors', 'on');<br />
ini_set ('error_reporting', E_ALL);<br />
<br />
:This will enable the same settings specified above even if Moodle sets them otherwise. <br />
:'''Important''': Remember to put them just before the last line of config.php.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==Any text I add with an apostrophe (') or a quote (") causes errors or comes up with a slash added==<br />
<br />
Problems caused by apostrophes are caused by incorrect "magic quotes" settings. Moodle requires the following settings in the php.ini file (which are usually the default):<br />
<br />
magic_quotes_gpc = On<br />
magic_quotes_runtime = Off<br />
<br />
Please see [[Installing Moodle]] for more details.<br />
<br />
If you are using [[Debian_GNU/Linux_installation|Debian]] then the problem might be in the version of PHP that you have installed. Have a look at this [http://tracker.moodle.org/browse/MDL-9691 bug report ] to see if it matches your situation.<br />
<br />
==Email copies are not being sent from my forums==<br />
<br />
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.<br />
<br />
Basically, you need to set up a process to regularly call the script <code><nowiki>http://yoursite/admin/cron.php</nowiki></code>. Please refer to the [[Cron|cron instructions]].<br />
<br />
Tips:<br />
* Try the default settings in ''Administration > Server > Email''. This generally works.<br />
*Make sure that ''allowuseremailcharset'' in ''Administration > Server > Email'' is set to No. Setting this to Yes can cause a problem in some versions of Moodle.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
<br />
==Error: database connection failed==<br />
<br />
If you get errors like "database connection failed" or "could not connect to the database you specified", here are some possible reasons and some possible solutions.<br />
<br />
* Your '''database server''' isn't installed or running. To check this for MySQL try typing the following command line<br />
$telnet database_host_name 3306<br />
:You should get a cryptic response which includes the version number of the MySQL server. <br />
* If you are attempting to run '''two instances of Moodle on different ports''', use the ip address of the host (not localhost) in the $CFG->dbhost setting, e.g. $CFG->dbhost = 127.0.0.1:3308.<br />
* You don't have the '''PHP mysql or postgresql extensions''' installed (please refer to FAQ re. whether PHP is installed).<br />
* You haven't created a '''Moodle database and assigned a user''' with the correct privileges to access it. <br />
* The '''Moodle database settings''' are incorrect. The database name, database user or database user password in your Moodle configuration file ''config.php'' are incorrect. Use phpMyAdmin to set up and check your MySQL installation.<br />
* Check that there are '''no apostrophes or non-alphabetic letters''' in your MySQL username or password.<br />
* You are using MySQL version 4.1 or higher but the PHP MySQL extension is pre-4.1 (check in your phpinfo output). In this case the '''default password hashing algorithm''' is incompatible with that available in the PHP mysql extension versions 4.x.x. Use these MySQL commands to change the passwords to the old format:<br />
<br />
mysql>SET PASSWORD FOR 'root'@'localhost' = OLD_PASSWORD('password');<br />
mysql>SET PASSWORD FOR 'moodleuser'@'localhost' = OLD_PASSWORD('password');<br />
<br />
:Also, consider upgrading your PHP MySQL extension. See [http://dev.mysql.com/doc/mysql/en/old-client.html this MySQL document] for further information on how to deal with this problem.<br />
* You are using Fedora core 3 or some other Linux system with '''SELinux installed''' and enabled. See the following URL for information on how to disable SELinux: http://fedora.redhat.com/projects/selinux/ If you don't want to disable SELinux, you have to allow httpd process to create network connections:<br />
<br />
setsebool httpd_can_network_connect true<br />
<br />
* Mac OSX users -- if you are running MySQL on a Mac OSX, try changing '''$CFG->dbhost''' from 'localhost' to '127.0.0.1'<br />
'''See also''': MySQL page on [http://dev.mysql.com/doc/refman/5.0/en/common-errors.html common errors] which lists several possible scenarios for connection failure, with advice on how to fix the problems.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==I can't log in - I just stay stuck on the login screen==<br />
<br />
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].<br />
<br />
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]].<br />
<br />
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>.<br />
<br />
If you are still having problems, read the [[Can_not_log_in | Cannot log in]] page.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==I can't log in with message "Please verify that the current setting of session.save_path is correct" ==<br />
<br />
This error occurs when PHP is having problems saving its session files. You may also see these other error messages displayed on the screen or in your log files:<br />
<br />
Warning: Unknown: open(some-path/sessions/sess_acbf942a7399db3489ffa910e35d5242, O_RDWR)<br />
failed: Permission denied (13) in Unknown on line 0<br />
<br />
Warning: Unknown(): open(some-path/sessions/sess_acbf942a7399db3489ffa910e35d5242, O_RDWR) <br />
failed: No space left on device (28) in Unknown on line 0<br />
<br />
Warning: Unknown: Failed to write session data (files). Please verify that the current <br />
setting of session.save_path is correct (some-path/sessions) in Unknown on line 0 <br />
<br />
To temporarily bypass these errors, '''use database sessions''' by editing your [[Configuration_file | moodle configuration file]] and adding this line:<br />
<br />
$CFG->dbsessions = true;<br />
<br />
Database sessions may overload your mysql database and are not ideal in a shared hosting environment, so if this solves the problem, you can start fixing the problem as follows:<br />
* Check '''access rights'''. The session.save_path should be accessible by the apache user. Try this command:<br />
<br />
chown -R apache:apache some-path/sessions<br />
<br />
:This assumes that 'apache' is the name of the user your webserver runs under - it could also be 'nobody'.<br />
* Check the '''permissions''' to the directory that PHP is trying to save to (session.save_path = some-path/sessions). Set the permissions initially to 0777 (everyone read, write, execute) with this command:<br />
<br />
chmod -R 0777 some-path/sessions<br />
<br />
:If this fixes the problem, reduce the permissions (700 is recommended).<br />
<br />
'''See also''': Session problems can be specific to your server environment. As an example, see [http://moodle.org/mod/forum/discuss.php?d=55925#254596 this forum discussion] about session problems with Lycos hosting.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==I log in but the login link doesn't change. I am logged in and can navigate freely.==<br />
<br />
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.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==I keep getting this error: A server error that affects your login session was detected.==<br />
<br />
Please refer to the Using Moodle forum discussion [http://moodle.org/mod/forum/discuss.php?d=73716 A server error that affects your login session was detected. Please login again or restart your browser.].<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==I keep getting this error: Failed opening required '/web/moodle/lib/setup.php'==<br />
<br />
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.<br />
<br />
Sometimes people only use the path from their home directory, or relative to the root of the web server directory.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==My pages show fatal errors such as : Parse error, call to undefined function: get_string()==<br />
<br />
If you see errors like:<br />
<br />
Parse error: parse error, unexpected T_VARIABLE in /path/to/moodle/config.php on line 94 <br />
Fatal error: Call to undefined function: get_string() in /path/to/moodle/mod/resource/lib.php<br />
on line 11<br />
<br />
then you have probably left out a semi-colon or closing quote from a line in ''config.php'' (previous to line 94).<br />
<br />
Another possibility is that you edited ''config.php'' in a program like Word and saved it as a HTML web page, instead of using a plain text editor like Notepad.<br />
<br />
Another thing to check, particularly if you are using 3rd party modules or plugins, is whether any of the php scripts use short open tags (<? ?>) instead of proper ones (<?php ?>). Short tags are bad for various reasons, so first contact the author of that extension to tell them about the problem. Then either replace short tags with conventional ones, or set this line in php.ini:<br />
<br />
short_open_tag = On<br />
<br />
You should never find short tags in core moodle code. If you do, please file a bug in the bug tracker.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==Serious Error! Could not set up the site!==<br />
<br />
Please refer to the Using Moodle forum discussion [http://moodle.org/mod/forum/discuss.php?d=32071 Serious Error! Could not set up the site!].<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==Uploaded files give "File not found"==<br />
<br />
For example: Not Found: The requested URL /moodle/file.php/2/myfile.jpg was not found on this server.<br />
<br />
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):<br />
<br />
'''AcceptPathInfo''' on<br />
<br />
Note, this will ONLY work for Apache versions 2.x.<br />
<br />
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.<br />
<br />
To use this alternative method, you should change the ''slasharguments'' variable. For moodle versions < 1.7, this is located in the Operating System section of ''Administration > Configuration > [[admin/config|Variables]]''. In later versions, this option is located in ''Site Administration > Server > HTTP''. You should now be able to access your uploaded files.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
<br />
==When I go to the admin page, I get told to make dirroot blank!==<br />
<br />
If you see errors like this:<br />
<br />
Please fix your settings in config.php: <br />
You have: $CFG->dirroot = "/home/users/fred/public_html/moodle"; <br />
but it should be: $CFG->dirroot = "";<br />
<br />
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'':<br />
<br />
if ($dirroot != $CFG->dirroot) {<br />
<br />
and change it to this:<br />
<br />
if (!empty($dirroot) and $dirroot != $CFG->dirroot) {<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==When trying to add a resource I receive error messages==<br />
<br />
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]].<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==Why are all my pages blank?==<br />
<br />
Check the dirroot variable in ''config.php''. You must use complete, absolute pathnames e.g.<br />
<br />
$CFG->dirroot = "d:\inetpub\sites\www.yoursite.com\web\moodle";<br />
<br />
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 enable PHP error displays, set these lines in your ''php.ini'' file and reload the web page.<br />
<br />
display_errors = On<br />
display_startup_errors = On<br />
<br />
To determine if MySQL support is your problem, insert this as the second line in your ''config.php'' file<br />
<br />
phpinfo();<br />
<br />
then reload the web page. Examine the output closely to see if MySQL is supported. If not look for a package you are missing.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
== Why is a particular page blank or incomplete? ==<br />
<br />
*'''Check your web server log files!!''' <br />
:If a particular page is blank or incomplete (it doesn't display the footer), before you do anything else [[Installation_FAQ#How_to_enable_and_check_PHP_error_logs | check your error logs]]. Having established that PHP error logging is working, reproduce the error. Immediately check the error log file right at the end. Hopefully you will see a PHP error message at or very near the end of the file. This may solve your problem directly or makes it a lot easier to diagnose the problem in the Moodle forums.<br />
<br />
*If you are '''upgrading to a new version of Moodle''', check that you do not have an old version of a non-standard block or module installed. Remove any such blocks or modules installed using the admin settings page and start the install process again. However, do also make sure that you have included all optional plugins that were required by your courses. <br />
<br />
*If you '''do not see any blocks listed''', turn editing on and remove any blocks that you have added to that page and try reloading.<br />
<br />
*You may get this error immediately after '''selecting a language'''. At this stage of the installation process your Moodle computer may need to connect to the Internet and download a language pack, so check that the computer can access the Internet by using a browser. Check also that your PHP settings are as given in the Moodle [[Installing_Moodle#Requirements | System Requirements page]].<br />
<br />
'''See also''':<br />
*Using Moodle [http://moodle.org/mod/forum/discuss.php?d=97734 PHP configuration error] forum discussion <br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
<br />
==Installation hangs when setting-up database tables==<br />
Sometimes the installation will hang when setting up tables. This will be an abrupt hang with half the page displayed in the browser and/or other outputs removed. Examples are:<br />
<br />
- '''Truncated mysql statements''':<br />
<br />
(mysql): SET NAMES 'utf8'<br />
--------------------------------------------------------------------------------<br />
(mysql): SHOW LOCAL VARIABLES LIKE 'character_set_database'<br />
...<br />
...<br />
(no more statements are displayed) <br />
<br />
- '''Missing Continue button''': The “Scroll to continue” link is displayed but no “Continue” button is there. <br />
<br />
'''Note''': There is an exception to this when upgrading an existing database and the installation may appear to hang at the roles generation phase. This process can take a very long time - so please be patient.<br />
<br />
Below are some solutions you can try to overcome this problem:<br />
<br />
*'''Check for mysql limits'''. This is often a mysql error and not a php error. Check that there is no limit placed on your mysql database, e.g. a "questions" limit.<br />
<br />
*'''Check your .htaccess files'''. If the install is on a webhost, adding the following line to the .htaccess file in the moodle directory has been known to solve the problem.<br />
AddType x-mapp-php5 .php<br />
<br />
:Try also renaming the .htaccess file so that it is disabled.<br />
<br />
*'''Code customizations'''. You may also want to look and see if you've customized any of your code. Look at the last successful table, and then look at the block, mod, or other code that is referenced by that table. For example, if your install hangs and continues to say that the forum tables were successful as the last message, look at /mod/forum/ for any custom code. If you have customized code, backup those files and replace with the correct files. You can then restart the install by renaming config.php or reinstalling your database from the backup. If your install is successful, you can make your code changes back into the stock Moodle code.<br />
<br />
*'''Check your memory limit'''. It may also be that the "memory_limit" in your php.ini is set too low. Please check your php.ini file and allocate the recommended amount (see [https://docs.moodle.org/en/Installing_Moodle#Requirements Moodle requirements]). For Moodle version 1.8 and above at least 40MB is recommended.<br />
<br />
*'''Upgrade incrementally'''. To avoid this problem when upgrading, prefer to upgrade incrementally. For example: upgrade from 1.6.* to 1.7.* and then to 1.8.* rather than straight from 1.6.* to 1.8.*<br />
<br />
A work-around to this problem is to setup a working Moodle system on your local PC or server using the [http://download.moodle.org Moodle Packages]. Once you have a running Moodle, [https://docs.moodle.org/en/Upgrading_Moodle#Backup_important_data backup the database] and import to your webhost. Then backup the Moodle code itself (the "moodle" directory on your PC) and copy this to your webhost using (for example) FTP. Finally, edit the moodle/config.php file for the new settings that have to be changed for the webhost.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
<br />
==Why can't I upload a new image into my profile?==<br />
<br />
If you don't see anything on your user profile pages to let you upload user images then it's usually because GD is not enabled on your server. GD is a library that allows image processing.<br />
<br />
1. Make sure '''GD has been included in your PHP installation'''. You can check this by going into Administration >> Configuration >> [[Variables]] and looking for the gdversion setting. This setting is chosen automatically every time you visit that page. If it shows GD version 1 or version 2 then everything should be fine. Save that configuration page and go back to your user profile.<br />
<br />
2. If Moodle thinks GD is not installed, then you will need to '''install the GD library'''. <br />
*On Unix you may need to re-compile PHP with arguments something like this:<br />
<br />
./configure --with-apxs=/usr/local/apache/bin/apxs --with-xml --with-gd <br />
--with-jpeg-dir=/usr/local --with-png-dir=/usr --with-ttf --enable-gd-native-ttf <br />
--enable-magic-quotes --with-mysql --enable-sockets --enable-track-vars <br />
--enable-versioning --with-zlib<br />
<br />
* On Windows this is usually a matter of "turning on" the extension in PHP by editing your php.ini file. To do this remove the semicolon for the php_gd2.dll extension - check that this file is actually present in your php extensions folder first (search your php.ini for extension_dir to determine where this points to on your hard disk). You should then have a line that looks like this:<br />
extension=php_gd2.dll<br />
<br />
:Windows users should see the [[Installing AMP|installation instructions]] for further help. <br />
<br />
3. Remember to '''restart your webserver''' (if possible) and re-visit the Moodle configuration page after making any changes to PHP so it can pick up the correct version of GD.<br />
<br />
'''See also''': Using Moodle forum discussion [http://moodle.org/mod/forum/discuss.php?d=44271 Profile pictures] for additional information.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==Why do I keep getting error messages about "headers already sent"?==<br />
<br />
If you see errors like this:<br />
<br />
Warning: Cannot add header information - headers already sent by <br />
(output started at /webs/moodle/config.php:87) in /webs/moodle/lib/moodlelib.php <br />
on line 1322 <br />
<br />
Warning: Cannot add header information - headers already sent by <br />
(output started at /webs/moodle/config.php:87) in /webs/moodle/lib/moodlelib.php <br />
on line 1323 <br />
<br />
Warning: Cannot add header information - headers already sent by <br />
(output started at /webs/moodle/config.php:87) in /webs/moodle/login/index.php <br />
on line 54<br />
<br />
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.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
== Why doesn't my Moodle site display the time and date correctly? ==<br />
<br />
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.<br />
<br />
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)<br />
<br />
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.<br />
<br />
==I receive this error "500:Internal Server Error"==<br />
There are several possible causes for this error:<br />
<br />
1. '''Syntax error''': There is a syntax error in your .htaccess or httpd.conf files. The way in which directives are written [http://httpd.apache.org/docs/1.3/howto/htaccess.html#when differs] depending on which file you are using. You can test for configuration errors in your Apache files using the command:<br />
#apachectl configtest<br />
<br />
2. '''PHPsuexec''': Your server does not support .htaccess files, especially if it is running PHPsuexec, which is an Apache module used for increasing the security of a site on a hosted system. In this situation:<br />
<br />
- you may also see a 403: Forbidden error.<br />
<br />
- the webserver executes under your own username and all files have a maximum permissions level of 755. Check that this is set for your Moodle directory in your control panel or (if you have access to the shell) use this command:<br />
#chmod -R 755 moodle<br />
<br />
- use a PHP.INI file instead of a .htaccess in the directory where the Moodle PHP script is being executed. For example: if you are receiving a memory exhausted error when your server is executing the file moodle/admin/cron.php, use a PHP.INI file to change your memory_limit and copy it to the moodle/admin directory. Remember that PHP.INI files are per-directory, so you'll need to copy it to each sub-directory. The syntax used in a PHP.INI file is different to a .htaccess file and you need to take out php_value/php_flag at the beginning of the line and use an equals sign to assign a value, e.g.<br />
php_value memory_limit 128M <-- .htaccess<br />
memory_limit = 128M <-- php.ini equivalent <br />
<br />
3. '''Incompatible directive''': You may have a directive in your .htaccess or httpd.conf files which are not compatible with your web server version. Check your webserver documentation.<br />
<br />
==I receive this error "403: Forbidden" ==<br />
<br />
Check your webserver configuration. See also the section above I receive this error "500:Internal Server Error".<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
<br />
==How do I uninstall Moodle?==<br />
'''Moodle package installation''': If you have downloaded a Moodle package, simply uninstall using your system commands. On Windows PCs, you should access the Control Panel -> Add/Remove Programs. Select the package name and click Change or Remove Programs.<br />
<br />
'''Webhost/manual installation''': If you have installed Moodle manually or have installed onto a webhost, follow these steps:<br />
*Delete the moodle database using this mysql command (or delete using your mysql client, e.g. PHPMyAdmin):<br />
<pre>sql>DROP DATABASE moodle;</pre><br />
:In the above example replace 'moodle' with the name of the moodle database you created when installing.<br />
*Delete the moodledata directory. If you, or your users, have uploaded materials into this directory take a copy of these before deleting this directory.<br />
*Delete the moodle directory itself. This will delete all of the moodle PHP script files.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==How do I upgrade Moodle? Do I just overwrite the files?==<br />
Do not overwrite files, it may cause strange errors. You should read the [[Upgrade]] documentation before proceeding.<br />
<br />
==Migrating Moodle to a new site or server==<br />
Migrating Moodle means that you have to move the current installation to a new server, and so may have to change IP addresses or DNS entries. To do this you will need to change the $CFG->wwwroot value in the config.php on the new server. You will also have to change any absolute links stored in the database backup file (before restoring the file on the new server) either using the admin/replace.php script, your text editor or another "search and replace" tool, e.g. sed. For more details see the [[Moodle_migration | Moodle Migration]] page.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
<br />
==Fatal error allowed memory size exhausted. How do I increase my php memory limit?==<br />
You will sometimes see an error message something like this:<br />
Fatal error: Allowed memory size of 67108864 bytes exhausted <br />
(tried to allocate xx bytes) in /var/www/moodle/yyyy.php<br />
This error means that the php memory_limit value is not enough for the php script. The memory_limit value is the "allowed memory size" - 64M in the example above (67108864 bytes / 1024 = 65536 KB. 65536 KB / 1024 = 64 MB). You will need to increase the php memory_limit value until this message is not shown anymore. There are two methods of doing this.<br />
*On a hosted installation, add the following line to your .htaccess file (or create one in the moodle directory if it does not already exist):<br />
php_value memory_limit <value>M<br />
Example: php_value memory_limit 40M<br />
*If you have your own server with shell access, edit your php.ini file (make sure it's the correct one by checking in your phpinfo output) as follows:<br />
memory_limit <value>M<br />
Example: memory_limit 40M<br />
Remember that you need to restart your web server to make changes to php.ini effective. An alternative is to disable the memory_limit by using the command ''memory_limit 0''.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==Why does my new installation display correctly on the server, but when I view it from a different machine, styles and images are missing?==<br />
In the installation instructions, one of the suggested settings for 'webroot' is 'localhost'. This is fine if all you want to do is some local testing of your new Moodle installation. If, however, you want to view your new installation from another machine on the same local area network, or view your site on the internet, you will have to change this setting:<br />
*For local testing, 'localhost' is fine for the webroot ($CFG->wwwroot in config.php). <br />
*If you want to test your site from other machines on the same local area network (LAN), then you will have to use the private ip address of the serving machine, (e.g. 192.168.1.2/moodle) or the network name of the serving computer (e.g. network_name_of_serving_machine/moodle) as the web root. Depending on your LAN setup, it may be better to use the network name of the computer rather than its (private) ip address, because the ip address can and will change from time to time. If you don't want to use the network name, then you will have to speak to your network administrator and have them assign a permanent ip address to the serving machine.<br />
*Finally, if you want to test your new installation across the internet, you will have to use either a domain name or a permanent (public) ip address/moodle as your web root. To handle both types of access, see [https://docs.moodle.org/en/masquerading masquerading].<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==Maximum upload file size - how to change it?==<br />
There are several places to change the maximum file upload size. The first place to check is the Administration block. Security -> Site Policies -> and look for "Maximum Uploaded File Size". This is the "maxbyte" variable found in older versions of Moodle (under Admin > Variables). Teachers may also set the maximum file size by the [[Course_settings#Maximum_upload_size|course administration block]].<br />
<br />
The second place to check are the server files. The php.ini file has a limit which will override any other setting. (Hint: remember to restart your server for changes to take effect). For more help see:<br />
*[[Administration_FAQ#How_do_the_limits_on_uploaded_files_work.3F]]<br />
*[[Installing_Moodle#Recheck_PHP_settings]]<br />
*[[Installing_Moodle#Using_a_.htaccess_file_for_webserver_and_PHP_settings]]<br />
*[[Site_policies#Maximum_uploaded_file_size]]<br />
<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
<br />
==See also==<br />
[[Category:FAQ]]<br />
[[Category:Installation]]<br />
<br />
[[es:FAQ Instalación]]<br />
[[fr:FAQ d'installation]]<br />
[[nl:Installatie FAQ]]<br />
[[ja:インストールFAQ]]<br />
[[ru:Установка FAQ]]<br />
[[pl:Instalacja FAQ]]</div>Kawhttps://docs.moodle.org/20/en/index.php?title=Installation_FAQ&diff=36853Installation FAQ2008-05-28T12:02:18Z<p>Kaw: /* Maximum upload file size - how to change it? */ Added link to admin faq on file upload limits</p>
<hr />
<div>{{FAQ}}<br />
==Table of Contents==<br />
__TOC__<br />
<br />
==PHP - is it installed and what version do I have?==<br />
<br />
Make a new file on your web site called ''info.php'', containing the following text, and call it from your browser:<br />
<br />
<?PHP phpinfo() ?><br />
<br />
If nothing happens then you don't have PHP installed or your webserver is not configured to handle .php files properly. See the installation docs for some information about where to download it for your computer. See the [[phpinfo]] page for details about the content of this page.<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
<br />
== System information needed for Installation Forum ==<br />
When posting questions to the installation forum, try to provide as much background information as possible about your moodle system. Use this template to copy and paste into your post:<br />
* Server Operating System name (version also if possible): <br />
* Browser name (version also if possible):<br />
* Moodle version:<br />
* Moodle install type? (New/Upgrade):<br />
* Moodle config.php attached?(Y/N):<br />
* Phpinfo attached? (Y/N):<br />
<br />
For the last two items, try to include the following in your post as an attachment:<br />
* A copy of your phpinfo output as shown in your browser (see the instructions above for an explanation of how to obtain this).<br />
* A copy of the Moodle configuration file. This is located in the directory moodle and is named config.php<br />
<br />
Copy and paste both of these into a single text file (using vi, Notepad, etc) and attach this to your post.<br />
<br />
If you cannot provide your phpinfo, try to copy & paste and complete these in your post:<br />
* Webserver (e.g. Apache/IIS) version:<br />
* Database server (e.g. MySQL, PostgreSQL) version:<br />
* PHP version:<br />
<br />
For installation on web hosting accounts: contact your support desk who should be able to tell you this information.<br />
<br />
: '''Security Warning''': Make sure you edit any files and delete any passwords before posting onto the forum.<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
<br />
==What & where are Moodle's configuration settings stored?==<br />
Configuration settings are stored in the config.php file stored in your moodle folder. This file is created during the installation process. If there is a problem and the installation cannot create the file, you can try creating it manually from the [[Configuration file]] docs. Please remember that manually editing the file is not recommended and may lead to blank pages, especially if there are additional spaces and/or lines after the final php closing tag "?>".<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==Running a health check==<br />
Moodle contains a script that will help identify common php and webserver configuration problems as well as configuration problems. It is a good idea to run this script to check if you are having post-installation problems. Use your browser to run this file:<br />
<br />
http://www.mymoodle.com/moodle/admin/health.php<br />
<br />
Change the above line if you have installed moodle in the webroot instead of a folder inside the webroot.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==Downloading previous releases of Moodle==<br />
* '''Generic Packages''': If your server does not meet the [[Installing_Moodle#Requirements | requirements]] for the current version of Moodle, you can download previous releases by using wget, lynx or curl with this URL:<br />
<nowiki>http://download.moodle.org/stable[version_number]</nowiki> <br />
:For example: to download Moodle version 1.5, use http://download.moodle.org/stable15. You'll see a directory tree with the files displayed. Click on the one you want and download as normal - if you require the latest update of the version, scroll to the end of the list and download the "moodle-latest" file, or alternatively use these URLs for zip or tgz downloads:<br />
<nowiki>http://download.moodle.org/stable[version_number]/moodle-latest-[version_number].zip</nowiki><br />
<nowiki>http://download.moodle.org/stable[version_number]/moodle-latest-[version_number].tgz</nowiki><br />
<br />
:Changes made in the version in the last month are listed in the "CHANGES" file in the directory listing. The files you download contain Moodle code and are not the Windows or Mac packages - so you need to have a webserver, a database server and PHP already installed. The earliest version available is Moodle 1.3.<br />
* '''Windows Packages''': To download previous releases of the Moodle packages for Windows, use this URL:<br />
<nowiki>http://download.moodle.org/windows/MoodleWindowsInstaller-latest-[version_number].zip</nowiki><br />
* '''Mac Packages''': To download previous releases of the Mac pacakges, use either of these URLs (depending on whether you need the Intel or PPC package):<br />
<nowiki>http://download.moodle.org/macosx/Moodle4Mac-Intel-[version_number].dmg</nowiki><br />
<nowiki>http://download.moodle.org/macosx/Moodle4Mac-PPC-[version_number}.dmg</nowiki><br />
* '''Using CVS''': You can also use CVS to download older releases and incremental releases of the Moodle generic packages, e.g. Moodle 1.5.4 - see the [[CVS_for_Administrators | CVS documentation]].<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
== How to enable and check PHP error logs==<br />
PHP can be set up to log errors in a variety of different ways: two of these involve the use of the php.ini file and the ini_set command. <br />
* '''Using the php.ini file''': The log settings are contained in the php.ini file stored on the server. If you don't know where that is, edit your Moodle ''config.php'' and add the following as the second line<br />
<br />
phpinfo();<br />
<br />
:then reload the web page. Look for the entry '''Configuration File (php.ini) Path'''.<br />
<br />
:When you have located php.ini open it in your favorite text editor. Find the '''Error handling and logging''' section of the php.ini file. Make sure that both '''display_errors = On''', '''display_startup_errors = On''' and '''log_errors = On''' are present and uncommented. Check the value of '''error_log''' - this tells you the location of the file errors are logged to. If it is commented out then errors will be sent to the web server error log file. Remember, if you make any changes to this file you will need to restart the web server (or just reboot the server).<br />
<br />
* '''Using ini_set commands''': If you are using Moodle 1.7 or higher, the previous steps are not enough. In those versions error logging parameters are dependant on certain administrative settings that you specify in the debugging section. The problem is that if you can't access the administrative pages, you can't set the debugging options. So the only way to modify them is by adding the following lines to your config.php file, just before the last line (the one containing a single'?>' only):<br />
<br />
ini_set ('display_errors', 'on');<br />
ini_set ('log_errors', 'on');<br />
ini_set ('display_startup_errors', 'on');<br />
ini_set ('error_reporting', E_ALL);<br />
<br />
:This will enable the same settings specified above even if Moodle sets them otherwise. <br />
:'''Important''': Remember to put them just before the last line of config.php.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==Any text I add with an apostrophe (') or a quote (") causes errors or comes up with a slash added==<br />
<br />
Problems caused by apostrophes are caused by incorrect "magic quotes" settings. Moodle requires the following settings in the php.ini file (which are usually the default):<br />
<br />
magic_quotes_gpc = On<br />
magic_quotes_runtime = Off<br />
<br />
Please see [[Installing Moodle]] for more details.<br />
<br />
If you are using [[Debian_GNU/Linux_installation|Debian]] then the problem might be in the version of PHP that you have installed. Have a look at this [http://tracker.moodle.org/browse/MDL-9691 bug report ] to see if it matches your situation.<br />
<br />
==Email copies are not being sent from my forums==<br />
<br />
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.<br />
<br />
Basically, you need to set up a process to regularly call the script <code><nowiki>http://yoursite/admin/cron.php</nowiki></code>. Please refer to the [[Cron|cron instructions]].<br />
<br />
Tips:<br />
* Try the default settings in ''Administration > Server > Email''. This generally works.<br />
*Make sure that ''allowuseremailcharset'' in ''Administration > Server > Email'' is set to No. Setting this to Yes can cause a problem in some versions of Moodle.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
<br />
==Error: database connection failed==<br />
<br />
If you get errors like "database connection failed" or "could not connect to the database you specified", here are some possible reasons and some possible solutions.<br />
<br />
* Your '''database server''' isn't installed or running. To check this for MySQL try typing the following command line<br />
$telnet database_host_name 3306<br />
:You should get a cryptic response which includes the version number of the MySQL server. <br />
* If you are attempting to run '''two instances of Moodle on different ports''', use the ip address of the host (not localhost) in the $CFG->dbhost setting, e.g. $CFG->dbhost = 127.0.0.1:3308.<br />
* You don't have the '''PHP mysql or postgresql extensions''' installed (please refer to FAQ re. whether PHP is installed).<br />
* You haven't created a '''Moodle database and assigned a user''' with the correct privileges to access it. <br />
* The '''Moodle database settings''' are incorrect. The database name, database user or database user password in your Moodle configuration file ''config.php'' are incorrect. Use phpMyAdmin to set up and check your MySQL installation.<br />
* Check that there are '''no apostrophes or non-alphabetic letters''' in your MySQL username or password.<br />
* You are using MySQL version 4.1 or higher but the PHP MySQL extension is pre-4.1 (check in your phpinfo output). In this case the '''default password hashing algorithm''' is incompatible with that available in the PHP mysql extension versions 4.x.x. Use these MySQL commands to change the passwords to the old format:<br />
<br />
mysql>SET PASSWORD FOR 'root'@'localhost' = OLD_PASSWORD('password');<br />
mysql>SET PASSWORD FOR 'moodleuser'@'localhost' = OLD_PASSWORD('password');<br />
<br />
:Also, consider upgrading your PHP MySQL extension. See [http://dev.mysql.com/doc/mysql/en/old-client.html this MySQL document] for further information on how to deal with this problem.<br />
* You are using Fedora core 3 or some other Linux system with '''SELinux installed''' and enabled. See the following URL for information on how to disable SELinux: http://fedora.redhat.com/projects/selinux/ If you don't want to disable SELinux, you have to allow httpd process to create network connections:<br />
<br />
setsebool httpd_can_network_connect true<br />
<br />
* Mac OSX users -- if you are running MySQL on a Mac OSX, try changing '''$CFG->dbhost''' from 'localhost' to '127.0.0.1'<br />
'''See also''': MySQL page on [http://dev.mysql.com/doc/refman/5.0/en/common-errors.html common errors] which lists several possible scenarios for connection failure, with advice on how to fix the problems.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==I can't log in - I just stay stuck on the login screen==<br />
<br />
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].<br />
<br />
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]].<br />
<br />
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>.<br />
<br />
If you are still having problems, read the [[Can_not_log_in | Cannot log in]] page.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==I can't log in with message "Please verify that the current setting of session.save_path is correct" ==<br />
<br />
This error occurs when PHP is having problems saving its session files. You may also see these other error messages displayed on the screen or in your log files:<br />
<br />
Warning: Unknown: open(some-path/sessions/sess_acbf942a7399db3489ffa910e35d5242, O_RDWR)<br />
failed: Permission denied (13) in Unknown on line 0<br />
<br />
Warning: Unknown(): open(some-path/sessions/sess_acbf942a7399db3489ffa910e35d5242, O_RDWR) <br />
failed: No space left on device (28) in Unknown on line 0<br />
<br />
Warning: Unknown: Failed to write session data (files). Please verify that the current <br />
setting of session.save_path is correct (some-path/sessions) in Unknown on line 0 <br />
<br />
To temporarily bypass these errors, '''use database sessions''' by editing your [[Configuration_file | moodle configuration file]] and adding this line:<br />
<br />
$CFG->dbsessions = true;<br />
<br />
Database sessions may overload your mysql database and are not ideal in a shared hosting environment, so if this solves the problem, you can start fixing the problem as follows:<br />
* Check '''access rights'''. The session.save_path should be accessible by the apache user. Try this command:<br />
<br />
chown -R apache:apache some-path/sessions<br />
<br />
:This assumes that 'apache' is the name of the user your webserver runs under - it could also be 'nobody'.<br />
* Check the '''permissions''' to the directory that PHP is trying to save to (session.save_path = some-path/sessions). Set the permissions initially to 0777 (everyone read, write, execute) with this command:<br />
<br />
chmod -R 0777 some-path/sessions<br />
<br />
:If this fixes the problem, reduce the permissions (700 is recommended).<br />
<br />
'''See also''': Session problems can be specific to your server environment. As an example, see [http://moodle.org/mod/forum/discuss.php?d=55925#254596 this forum discussion] about session problems with Lycos hosting.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==I log in but the login link doesn't change. I am logged in and can navigate freely.==<br />
<br />
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.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==I keep getting this error: A server error that affects your login session was detected.==<br />
<br />
Please refer to the Using Moodle forum discussion [http://moodle.org/mod/forum/discuss.php?d=73716 A server error that affects your login session was detected. Please login again or restart your browser.].<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==I keep getting this error: Failed opening required '/web/moodle/lib/setup.php'==<br />
<br />
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.<br />
<br />
Sometimes people only use the path from their home directory, or relative to the root of the web server directory.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==My pages show fatal errors such as : Parse error, call to undefined function: get_string()==<br />
<br />
If you see errors like:<br />
<br />
Parse error: parse error, unexpected T_VARIABLE in /path/to/moodle/config.php on line 94 <br />
Fatal error: Call to undefined function: get_string() in /path/to/moodle/mod/resource/lib.php<br />
on line 11<br />
<br />
then you have probably left out a semi-colon or closing quote from a line in ''config.php'' (previous to line 94).<br />
<br />
Another possibility is that you edited ''config.php'' in a program like Word and saved it as a HTML web page, instead of using a plain text editor like Notepad.<br />
<br />
Another thing to check, particularly if you are using 3rd party modules or plugins, is whether any of the php scripts use short open tags (<? ?>) instead of proper ones (<?php ?>). Short tags are bad for various reasons, so first contact the author of that extension to tell them about the problem. Then either replace short tags with conventional ones, or set this line in php.ini:<br />
<br />
short_open_tag = On<br />
<br />
You should never find short tags in core moodle code. If you do, please file a bug in the bug tracker.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==Serious Error! Could not set up the site!==<br />
<br />
Please refer to the Using Moodle forum discussion [http://moodle.org/mod/forum/discuss.php?d=32071 Serious Error! Could not set up the site!].<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==Uploaded files give "File not found"==<br />
<br />
For example: Not Found: The requested URL /moodle/file.php/2/myfile.jpg was not found on this server.<br />
<br />
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):<br />
<br />
'''AcceptPathInfo''' on<br />
<br />
Note, this will ONLY work for Apache versions 2.x.<br />
<br />
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.<br />
<br />
To use this alternative method, you should change the ''slasharguments'' variable. For moodle versions < 1.7, this is located in the Operating System section of ''Administration > Configuration > [[admin/config|Variables]]''. In later versions, this option is located in ''Site Administration > Server > HTTP''. You should now be able to access your uploaded files.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
<br />
==When I go to the admin page, I get told to make dirroot blank!==<br />
<br />
If you see errors like this:<br />
<br />
Please fix your settings in config.php: <br />
You have: $CFG->dirroot = "/home/users/fred/public_html/moodle"; <br />
but it should be: $CFG->dirroot = "";<br />
<br />
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'':<br />
<br />
if ($dirroot != $CFG->dirroot) {<br />
<br />
and change it to this:<br />
<br />
if (!empty($dirroot) and $dirroot != $CFG->dirroot) {<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==When trying to add a resource I receive error messages==<br />
<br />
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]].<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==Why are all my pages blank?==<br />
<br />
Check the dirroot variable in ''config.php''. You must use complete, absolute pathnames e.g.<br />
<br />
$CFG->dirroot = "d:\inetpub\sites\www.yoursite.com\web\moodle";<br />
<br />
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 enable PHP error displays, set these lines in your ''php.ini'' file and reload the web page.<br />
<br />
display_errors = On<br />
display_startup_errors = On<br />
<br />
To determine if MySQL support is your problem, insert this as the second line in your ''config.php'' file<br />
<br />
phpinfo();<br />
<br />
then reload the web page. Examine the output closely to see if MySQL is supported. If not look for a package you are missing.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
== Why is a particular page blank or incomplete? ==<br />
<br />
*'''Check your web server log files!!''' <br />
:If a particular page is blank or incomplete (it doesn't display the footer), before you do anything else [[Installation_FAQ#How_to_enable_and_check_PHP_error_logs | check your error logs]]. Having established that PHP error logging is working, reproduce the error. Immediately check the error log file right at the end. Hopefully you will see a PHP error message at or very near the end of the file. This may solve your problem directly or makes it a lot easier to diagnose the problem in the Moodle forums.<br />
<br />
*If you are '''upgrading to a new version of Moodle''', check that you do not have an old version of a non-standard block or module installed. Remove any such blocks or modules installed using the admin settings page and start the install process again. However, do also make sure that you have included all optional plugins that were required by your courses. <br />
<br />
*If you '''do not see any blocks listed''', turn editing on and remove any blocks that you have added to that page and try reloading.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
<br />
==Installation hangs when setting-up database tables==<br />
Sometimes the installation will hang when setting up tables. This will be an abrupt hang with half the page displayed in the browser and/or other outputs removed. Examples are:<br />
<br />
- '''Truncated mysql statements''':<br />
<br />
(mysql): SET NAMES 'utf8'<br />
--------------------------------------------------------------------------------<br />
(mysql): SHOW LOCAL VARIABLES LIKE 'character_set_database'<br />
...<br />
...<br />
(no more statements are displayed) <br />
<br />
- '''Missing Continue button''': The “Scroll to continue” link is displayed but no “Continue” button is there. <br />
<br />
'''Note''': There is an exception to this when upgrading an existing database and the installation may appear to hang at the roles generation phase. This process can take a very long time - so please be patient.<br />
<br />
Below are some solutions you can try to overcome this problem:<br />
<br />
*'''Check for mysql limits'''. This is often a mysql error and not a php error. Check that there is no limit placed on your mysql database, e.g. a "questions" limit.<br />
<br />
*'''Check your .htaccess files'''. If the install is on a webhost, adding the following line to the .htaccess file in the moodle directory has been known to solve the problem.<br />
AddType x-mapp-php5 .php<br />
<br />
:Try also renaming the .htaccess file so that it is disabled.<br />
<br />
*'''Code customizations'''. You may also want to look and see if you've customized any of your code. Look at the last successful table, and then look at the block, mod, or other code that is referenced by that table. For example, if your install hangs and continues to say that the forum tables were successful as the last message, look at /mod/forum/ for any custom code. If you have customized code, backup those files and replace with the correct files. You can then restart the install by renaming config.php or reinstalling your database from the backup. If your install is successful, you can make your code changes back into the stock Moodle code.<br />
<br />
*'''Check your memory limit'''. It may also be that the "memory_limit" in your php.ini is set too low. Please check your php.ini file and allocate the recommended amount (see [https://docs.moodle.org/en/Installing_Moodle#Requirements Moodle requirements]). For Moodle version 1.8 and above at least 40MB is recommended.<br />
<br />
*'''Upgrade incrementally'''. To avoid this problem when upgrading, prefer to upgrade incrementally. For example: upgrade from 1.6.* to 1.7.* and then to 1.8.* rather than straight from 1.6.* to 1.8.*<br />
<br />
A work-around to this problem is to setup a working Moodle system on your local PC or server using the [http://download.moodle.org Moodle Packages]. Once you have a running Moodle, [https://docs.moodle.org/en/Upgrading_Moodle#Backup_important_data backup the database] and import to your webhost. Then backup the Moodle code itself (the "moodle" directory on your PC) and copy this to your webhost using (for example) FTP. Finally, edit the moodle/config.php file for the new settings that have to be changed for the webhost.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
<br />
==Why can't I upload a new image into my profile?==<br />
<br />
If you don't see anything on your user profile pages to let you upload user images then it's usually because GD is not enabled on your server. GD is a library that allows image processing.<br />
<br />
1. Make sure '''GD has been included in your PHP installation'''. You can check this by going into Administration >> Configuration >> [[Variables]] and looking for the gdversion setting. This setting is chosen automatically every time you visit that page. If it shows GD version 1 or version 2 then everything should be fine. Save that configuration page and go back to your user profile.<br />
<br />
2. If Moodle thinks GD is not installed, then you will need to '''install the GD library'''. <br />
*On Unix you may need to re-compile PHP with arguments something like this:<br />
<br />
./configure --with-apxs=/usr/local/apache/bin/apxs --with-xml --with-gd <br />
--with-jpeg-dir=/usr/local --with-png-dir=/usr --with-ttf --enable-gd-native-ttf <br />
--enable-magic-quotes --with-mysql --enable-sockets --enable-track-vars <br />
--enable-versioning --with-zlib<br />
<br />
* On Windows this is usually a matter of "turning on" the extension in PHP by editing your php.ini file. To do this remove the semicolon for the php_gd2.dll extension - check that this file is actually present in your php extensions folder first (search your php.ini for extension_dir to determine where this points to on your hard disk). You should then have a line that looks like this:<br />
extension=php_gd2.dll<br />
<br />
:Windows users should see the [[Installing AMP|installation instructions]] for further help. <br />
<br />
3. Remember to '''restart your webserver''' (if possible) and re-visit the Moodle configuration page after making any changes to PHP so it can pick up the correct version of GD.<br />
<br />
'''See also''': Using Moodle forum discussion [http://moodle.org/mod/forum/discuss.php?d=44271 Profile pictures] for additional information.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==Why do I keep getting error messages about "headers already sent"?==<br />
<br />
If you see errors like this:<br />
<br />
Warning: Cannot add header information - headers already sent by <br />
(output started at /webs/moodle/config.php:87) in /webs/moodle/lib/moodlelib.php <br />
on line 1322 <br />
<br />
Warning: Cannot add header information - headers already sent by <br />
(output started at /webs/moodle/config.php:87) in /webs/moodle/lib/moodlelib.php <br />
on line 1323 <br />
<br />
Warning: Cannot add header information - headers already sent by <br />
(output started at /webs/moodle/config.php:87) in /webs/moodle/login/index.php <br />
on line 54<br />
<br />
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.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
== Why doesn't my Moodle site display the time and date correctly? ==<br />
<br />
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.<br />
<br />
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)<br />
<br />
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.<br />
<br />
==I receive this error "500:Internal Server Error"==<br />
There are several possible causes for this error:<br />
<br />
1. '''Syntax error''': There is a syntax error in your .htaccess or httpd.conf files. The way in which directives are written [http://httpd.apache.org/docs/1.3/howto/htaccess.html#when differs] depending on which file you are using. You can test for configuration errors in your Apache files using the command:<br />
#apachectl configtest<br />
<br />
2. '''PHPsuexec''': Your server does not support .htaccess files, especially if it is running PHPsuexec, which is an Apache module used for increasing the security of a site on a hosted system. In this situation:<br />
<br />
- you may also see a 403: Forbidden error.<br />
<br />
- the webserver executes under your own username and all files have a maximum permissions level of 755. Check that this is set for your Moodle directory in your control panel or (if you have access to the shell) use this command:<br />
#chmod -R 755 moodle<br />
<br />
- use a PHP.INI file instead of a .htaccess in the directory where the Moodle PHP script is being executed. For example: if you are receiving a memory exhausted error when your server is executing the file moodle/admin/cron.php, use a PHP.INI file to change your memory_limit and copy it to the moodle/admin directory. Remember that PHP.INI files are per-directory, so you'll need to copy it to each sub-directory. The syntax used in a PHP.INI file is different to a .htaccess file and you need to take out php_value/php_flag at the beginning of the line and use an equals sign to assign a value, e.g.<br />
php_value memory_limit 128M <-- .htaccess<br />
memory_limit = 128M <-- php.ini equivalent <br />
<br />
3. '''Incompatible directive''': You may have a directive in your .htaccess or httpd.conf files which are not compatible with your web server version. Check your webserver documentation.<br />
<br />
==I receive this error "403: Forbidden" ==<br />
<br />
Check your webserver configuration. See also the section above I receive this error "500:Internal Server Error".<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
<br />
==How do I uninstall Moodle?==<br />
'''Moodle package installation''': If you have downloaded a Moodle package, simply uninstall using your system commands. On Windows PCs, you should access the Control Panel -> Add/Remove Programs. Select the package name and click Change or Remove Programs.<br />
<br />
'''Webhost/manual installation''': If you have installed Moodle manually or have installed onto a webhost, follow these steps:<br />
*Delete the moodle database using this mysql command (or delete using your mysql client, e.g. PHPMyAdmin):<br />
<pre>sql>DROP DATABASE moodle;</pre><br />
:In the above example replace 'moodle' with the name of the moodle database you created when installing.<br />
*Delete the moodledata directory. If you, or your users, have uploaded materials into this directory take a copy of these before deleting this directory.<br />
*Delete the moodle directory itself. This will delete all of the moodle PHP script files.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==How do I upgrade Moodle? Do I just overwrite the files?==<br />
Do not overwrite files, it may cause strange errors. You should read the [[Upgrade]] documentation before proceeding.<br />
<br />
==Migrating Moodle to a new site or server==<br />
Migrating Moodle means that you have to move the current installation to a new server, and so may have to change IP addresses or DNS entries. To do this you will need to change the $CFG->wwwroot value in the config.php on the new server. You will also have to change any absolute links stored in the database backup file (before restoring the file on the new server) either using the admin/replace.php script, your text editor or another "search and replace" tool, e.g. sed. For more details see the [[Moodle_migration | Moodle Migration]] page.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
<br />
==Fatal error allowed memory size exhausted. How do I increase my php memory limit?==<br />
You will sometimes see an error message something like this:<br />
Fatal error: Allowed memory size of 67108864 bytes exhausted <br />
(tried to allocate xx bytes) in /var/www/moodle/yyyy.php<br />
This error means that the php memory_limit value is not enough for the php script. The memory_limit value is the "allowed memory size" - 64M in the example above (67108864 bytes / 1024 = 65536 KB. 65536 KB / 1024 = 64 MB). You will need to increase the php memory_limit value until this message is not shown anymore. There are two methods of doing this.<br />
*On a hosted installation, add the following line to your .htaccess file (or create one in the moodle directory if it does not already exist):<br />
php_value memory_limit <value>M<br />
Example: php_value memory_limit 40M<br />
*If you have your own server with shell access, edit your php.ini file (make sure it's the correct one by checking in your phpinfo output) as follows:<br />
memory_limit <value>M<br />
Example: memory_limit 40M<br />
Remember that you need to restart your web server to make changes to php.ini effective. An alternative is to disable the memory_limit by using the command ''memory_limit 0''.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==Why does my new installation display correctly on the server, but when I view it from a different machine, styles and images are missing?==<br />
In the installation instructions, one of the suggested settings for 'webroot' is 'localhost'. This is fine if all you want to do is some local testing of your new Moodle installation. If, however, you want to view your new installation from another machine on the same local area network, or view your site on the internet, you will have to change this setting:<br />
*For local testing, 'localhost' is fine for the webroot ($CFG->wwwroot in config.php). <br />
*If you want to test your site from other machines on the same local area network (LAN), then you will have to use the private ip address of the serving machine, (e.g. 192.168.1.2/moodle) or the network name of the serving computer (e.g. network_name_of_serving_machine/moodle) as the web root. Depending on your LAN setup, it may be better to use the network name of the computer rather than its (private) ip address, because the ip address can and will change from time to time. If you don't want to use the network name, then you will have to speak to your network administrator and have them assign a permanent ip address to the serving machine.<br />
*Finally, if you want to test your new installation across the internet, you will have to use either a domain name or a permanent (public) ip address/moodle as your web root. To handle both types of access, see [https://docs.moodle.org/en/masquerading masquerading].<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==Maximum upload file size - how to change it?==<br />
There are several places to change the maximum file upload size. The first place to check is the Administration block. Security -> Site Policies -> and look for "Maximum Uploaded File Size". This is the "maxbyte" variable found in older versions of Moodle (under Admin > Variables). Teachers may also set the maximum file size by the [[Course_settings#Maximum_upload_size|course administration block]].<br />
<br />
The second place to check are the server files. The php.ini file has a limit which will override any other setting. (Hint: remember to restart your server for changes to take effect). For more help see:<br />
*[[Administration_FAQ#How_do_the_limits_on_uploaded_files_work.3F]]<br />
*[[Installing_Moodle#Recheck_PHP_settings]]<br />
*[[Installing_Moodle#Using_a_.htaccess_file_for_webserver_and_PHP_settings]]<br />
*[[Site_policies#Maximum_uploaded_file_size]]<br />
<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
<br />
==See also==<br />
[[Category:FAQ]]<br />
[[Category:Installation]]<br />
<br />
[[es:FAQ Instalación]]<br />
[[fr:FAQ d'installation]]<br />
[[nl:Installatie FAQ]]<br />
[[ja:インストールFAQ]]<br />
[[ru:Установка FAQ]]<br />
[[pl:Instalacja FAQ]]</div>Kawhttps://docs.moodle.org/20/en/index.php?title=Administration_FAQ&diff=36841Administration FAQ2008-05-28T07:25:06Z<p>Kaw: /* How do the limits on uploaded files work? */ Added hosted server forum link</p>
<hr />
<div>{{FAQ}}<br />
<br />
==Changing text in Moodle==<br />
<br />
The language editing interface in ''Administration > Language > Language editing'' enables you to easily change any word or phrase used on the site. You may need to search through several files to find the word or phrase you are looking for. The file moodle.php contains all common site-wide phrases and the admin.php contains many admin phrases.<br />
<br />
== How do the limits on uploaded files work? ==<br />
<br />
File upload sizes are restricted in a number of ways - each one in the list restricts the following ones.<br />
<br />
1. Firstly, there is a setting in Apache 2 which you may need to change. On Redhat this setting is very low by default, you can change the limit by adding or editing a line in Apache's ''/etc/httpd/conf/httpd.conf'' and/or ''/etc/httpd/conf.d/php.conf'' with the upload size in bytes (different operating systems may have these files in different locations):<br />
<br />
LimitRequestBody 10485760<br />
<br />
2. PHP also has two more byte limits, which you can set in ''php.ini'' and sometimes in a ''.htaccess'' file:<br />
<br />
php_value upload_max_filesize 50000000<br />
php_value post_max_size 50000000<br />
<br />
To convert from Bytes to Megabytes use [http://www.onlineconversion.com/computer.htm this convertor ]<br />
<br />
Please note that a server re-start may be required for the above changes to take effect.<br />
<br />
3. Moodle has a site-wide limit called maxbytes that may be set in ''Administration > Configuration > [[admin/config|Variables]]''.<br />
<br />
4. A limit may be set by teachers in the [[course/edit|Course settings]].<br />
<br />
5. Activity modules such as [[Forums]] and [[Assignments]] have their own limits which may be set when adding or editing the activity.<br />
<br />
'''See also'''<br />
<br />
* Using Moodle [http://moodle.org/mod/forum/discuss.php?d=39625 Detailed instructions to increase the maximum allowed size for uploaded files] forum discussion<br />
* Using Moodle [http://moodle.org/mod/forum/discuss.php?d=97907 Instructions to increase maximum allowed size on hosted servers] forum discussion<br />
* Instructions below on How to change the maximum execution time<br />
<br />
== How to change upload file size on a Windows localhost==<br />
In a localhost (using a [[Complete install packages]] on a computer) for 1.6 it is easy to change the uploaded file size to something larger than the default 16M. <br />
<br />
Here is an example of how to change the upload file size to 100M.<br />
*Find ..'''/Apache/bin/php.ini''' and open it with WordPad by right-clicking -> Open With -> then choose WordPad. <br />
*In this file scroll or do a search on the text "_max_" to find <code>upload_max_filesize = 16M</code> <br />
*Change that line to<br />
upload_max_filesize = 100M<br />
*In the same way, find <code>post_max_size = 16M</code> <br />
*Change that line to<br />
post_max_size = 100M<br />
*Save the file. <br />
<br />
After any changes to the php.ini file you need to restart Apache. So restart xampp and browse to localhost. You should find that the Upload file size in Configuration now reads 100M.<br />
<br />
'''See also'''<br />
<br />
* Instructions below on How to change the maximum execution time<br />
<br />
== How to change the maximum execution time ==<br />
<br />
A side-effect of increasing the file upload limit is that the php scripts may execute beyond the limit set by default (300 seconds/5 minutes). To change this, look for max_execution_time in php.ini and change to something like this:<br />
<br />
max_execution_time = 600<br />
<br />
If you are using Apache and have a .htaccess file to change php settings, add this line to your .htaccess file:<br />
<br />
php_value max_execution_time 600<br />
<br />
Restart your webserver for these changes to take effect, and check that the values have been changed by looking at your phpinfo output in the moodle admin -> environment page.<br />
<br />
== I have forgotten the admin password ==<br />
Firstly, try using the button "Send my details via email". Otherwise, you will need to access the database using MySQL admin. Passwords for all users, including admin, are stored encrypted in the table ''mdl_user''. Copy the guest password (guest) into the admin password field then login using it.<br />
<br />
Additional solutions are detailed in the discussions [http://moodle.org/mod/forum/discuss.php?d=18103 change admin's password] and [http://moodle.org/mod/forum/discuss.php?d=4552&parent=38070 login/password].<br />
<br />
== My log table has disappeared - No logs found! ==<br />
The most likely cause is that the mdl_log table has become corrupted. See the [[#How_do_I_repair_a_corrupted_Moodle_database.3F|database repair section]] below.<br />
<br />
==My style sheet changes aren't showing up==<br />
<br />
Browsers usually cache style sheets and so a forced refresh (CTRL + F5) is required before any changes show up.<br />
<br />
==How do I make my Moodle site homepage look like the moodle.org homepage?==<br />
<br />
Please see the theme how-to [[Homepage design|homepage design of moodle.org]] for full details.<br />
<br />
== Site-wide scales ==<br />
To add a site-wide scale, available in all courses, follow the Scales link in any course Administration block. Add a new scale, then use the move down arrow to move the scale from custom scales to standard scales.<br />
<br />
==Why do I see <nowiki>[[missing strings]]</nowiki>?==<br />
<br />
Double square brackets around text indicate that language strings are missing. Try checking for untranslated words or phrases in ''Administration > Language > [[Language editing]]'' and update local language packs in ''Administration > Language > [[Language packs]]'' (or ''Administration > Configuration > Language'' in Moodle 1.6).<br />
<br />
Language strings for non-standard modules and plugins are generally contained in a ''lang'' folder within the module or plugin folder. For sites which have migrated to UTF-8, it may be necessary to re-name the folder e.g. ''en'' should be re-named ''en_utf8''.<br />
<br />
==How do I find the version of Moodle currently installed?==<br />
See the [[Moodle version]] information.<br />
<br />
==How do I repair a corrupted Moodle database?==<br />
Database corruption usually occurs as a result of a hardware (especially disk-based) failure, or when a disk becomes full. Typical symptoms are failure on login, with this message displayed:<br />
<br />
Session Replace: Table './moodle/mdl_sessions2' is marked as crashed and should be repaired<br />
<br />
The problem can be repaired using the mysqlcheck command (the command you type is in bold and we assume the database name is 'moodle' and its type is MySQL):<br />
<br />
#'''mysqlcheck –u moodleuser –p –-auto-repair moodle'''<br />
Enter password:<br />
moodle.adodb_logsql OK<br />
moodle.mdl_assignment OK<br />
moodle.mdl_assignment_submissions OK<br />
...<br />
moodle.mdl_log<br />
error : Table './moodle/mdl_log' is marked as crashed and should be repaired<br />
...<br />
moodle.mdl_sessions2<br />
error : Table './moodle/mdl_sessions2' is marked as crashed and should be repaired<br />
<br />
Repairing tables<br />
moodle_18_latest.mdl_log OK<br />
moodle_18_latest.mdl_sessions2 OK<br />
<br />
Your mysql database server must be running when executing the mysqlcheck command. If there are problems with the tables, the auto-repair option will fix them as shown above. Note that the repair process can take a long time to complete. Re-run the command again to double-check that all is OK. <br />
<br />
Individual Moodle tables may be repaired using MySQL Admin/PHPMyAdmin as follows:<br />
# In the databases section, select the Moodle database.<br />
# Click the SQL tab, then in the "Run SQL query/queries on database moodle" field type <code>REPAIR TABLE mdl_tablename</code><br />
# Click the Go button.<br />
For example, to repair the Moodle log tables, type <code>REPAIR TABLE mdl_log</code><br />
<br />
See also: <br />
*[http://moodle.org/mod/forum/discuss.php?d=58208#279638 Forum discussion] on a moodle database optimization script<br />
*[[Performance#MySQL_performance | Performance Documentation]] on database repair and optimization<br />
*[http://www.databasejournal.com/features/mysql/article.php/10897_3300511_2 Database Journal article on repairing database corruption in MySQL]<br />
<br />
==Re. Site files, what does "files placed here can be accessed by anyone" mean?==<br />
<br />
Unlike course files, which require a user to have appropriate rights in order to access them, files within the site files folder are accessible by anyone provided with the URI. For example visitors to the site may view images stored in the site files folder without being logged in. Please refer to [[Site files]] for more information.<br />
<br />
==My site is stuck in maintenance mode==<br />
<br />
Sometimes Moodle gets stuck in maintenance mode and you'll see the message "This site is undergoing maintenance and is currently unavailable" despite your attempts to turn-off maintenance mode. When you put Moodle into maintenance mode it creates a file called maintenance.html in moodledata/1/maintenance.html (the site files folder). To fix this try the following:<br />
<br />
* Check that the web server user has write permissions to the moodledata folder.<br />
* Manually delete the maintenance.html file.<br />
<br />
==Incomplete page displayed when I click "Turn Editing On"==<br />
This is usually as a result of an incompatible contributed module or block that you have installed. Follow these steps:<br />
#Follow the module removal instructions in [[Installing contributed modules or plugins]].<br />
#Re-visit your course page and try clicking on the "Turn Editing On" button again. <br />
<br />
If you find an incompatible module or block, please report the problem to the person named as the maintainer in the [http://moodle.org/mod/data/view.php?id=6009 Modules and Plugins database].<br />
<br />
=="a request parameter (id) was missing" when uploading a file==<br />
<br />
This message sometimes is generated when attempting to upload a file larger than the upload limit.<br />
<br />
==I cannot delete the News Forum on a course==<br />
The News Forum is deleted by setting the number of items to display to zero. To do this, change the setting in Course Admin menu -> Settings -> News Items to Show.<br />
<br />
==How can I change the URL of the moodle service==<br />
<br />
You should configure your Apache server, at httpd.conf, using Listen, Port and DocumentRoot directives and Directory section. After restarting Apache, you also must open config.php in a text editor, and change the line:<br />
$CFG->wwwroot = 'http://mydomain/testmoodle';<br />
<br />
Your Moodle site will also contain absolute links to resources which point to the previous URL. To change this see the [[Moodle_migration#Migrating_a_complete_Moodle_site | migrating a complete Moodle site]] instructions.<br />
<br />
'''See also''': [http://moodle.org/mod/forum/discuss.php?d=51667 Forum discussion]<br />
<br />
==Why is the Moodle Registration button still displayed after I register my site?==<br />
The registration button is provided so that you can place your moodle site to the http://www.moodle.org/sites list. Before registering, the button is displayed at the top of the Site Administration -> Notifications page. Once you have successfully registered, this is moved to the bottom of the same page. The button remains there so that you can update the details of your registration.<br />
<br />
If the registration process fails for some reason to complete fully, there are two methods of letting your local Moodle install know that you have registered:<br />
<br />
* The preferred method is to use your mysql client program to execute these commands (assuming your Moodle database is called "moodle"):<br />
mysql> USE moodle;<br />
mysql> INSERT INTO mdl_config (name,value) VALUES ('registered',unix_timestamp());<br />
<br />
* Alternatively, edit your <nowiki>moodle/config.php</nowiki> file and add this line:<br />
$CFG->registered = '9999999999';<br />
:Note that this line in your config.php will stop the reminders about re-registering.<br />
<br />
For an explanation of the idea behind the button see [http://tracker.moodle.org/browse/MDL-7359 MDL-7359] in the moodle tracker.<br />
<br />
For an explanation of how sites are checked see [[Verification_of_sites_on_moodle.org | the site verification page]]<br />
<br />
==How do I enable/disable debugging?==<br />
There are a few ways you can enable or disable debugging on your site. If you are able to login as an administrator and access the Site Administration block, then the easiest way is to go to Admin->Server->Debugging and set it there. There are several options - the most often recommended setting for debugging is 'ALL: Show all reasonable PHP debugging messages'. To disable debugging, simply set this to 'NONE: Do not show any errors or warnings.'.<br />
<br />
If you are unable to set your debugging level in this manner, you still have a couple ways to set it - in your config.php or in the database.<br />
<br />
* In <nowiki>moodle/config.php</nowiki> you can add these lines:<br />
<br />
$CFG->debug=2047; <br />
$CFG->debugdisplay=1;<br />
<br />
:Then simply remove them (or comment them out) when you're done.<br />
<br />
* To enable debugging in the database, simply use a database utility such as the MySQL Admin plugin for Moodle, or PHPMyAdmin, etc., and enter the following:<br />
<br />
UPDATE `mdl_config` SET `value` = '2047' WHERE `name` ='debug';<br />
<br />
:To turn it back off, use this command:<br />
<br />
UPDATE `mdl_config` SET `value` = '0' WHERE `name` ='debug';<br />
:<br />
<br />
==How do I install the Moodle Features Demo course?==<br />
<br />
# Download the [http://moodle.org/file.php/1/backup-features-20060925-0911.zip Moodle Features Demo Course backup].<br />
# Log into your Moodle installation as an administrator.<br />
# Access ''Administration > Front Page > Site files'' (or ''Administration > Server > Site files'' in Moodle 1.7).<br />
# Upload the backup file.<br />
# Follow the restore link opposite the backup file.<br />
# Follow the instructions provided, selecting the option to restore to a new course.<br />
<br />
=="Could not create guest user record!" error message==<br />
<br />
Most likely the database table mdl_user needs repairing. This may be done as follows using phpMyAdmin:<br />
<br />
# Click the SQL tab.<br />
# In the "Run SQL query/queries on database moodle" field type <code>REPAIR TABLE mdl_user</code><br />
# Click the Go button.<br />
<br />
=="Your session has timed out. Please login again." error message==<br />
<br />
Please do one/all of the following:<br />
* Try deleting cookies manually from your browser and close it down, then access your site again. Sometimes this clears up the problem.<br />
* Check that your ''moodledata/sessions'' directory has write permissions. When you access Moodle a new file should be created there.<br />
* If you are running two versions of Moodle on the same computer, set a cookie prefix in ''Administration > Server > [[Session handling]]''.<br />
<br />
==See also==<br />
* [[Administration hacks]]<br />
<br />
[[Category:FAQ]]<br />
<br />
[[es:FAQ Administración]]<br />
[[fr:FAQ d'administration]]<br />
[[pl:Administracja FAQ]]</div>Kawhttps://docs.moodle.org/20/en/index.php?title=1and1_MySQL_installation&diff=354661and1 MySQL installation2008-04-30T12:07:52Z<p>Kaw: Nowiki change</p>
<hr />
<div>There are examples of Moodle being successfully installed on 1and1 Apache hosted sites. There are some formalities that you must follow. In the config.php file, you must use the following format for the listed database variables:<br />
<br />
$CFG->dbtype = 'mysql'; // mysql or postgres7 (for now)<br />
$CFG->dbhost = 'db123.yourdomain.net'; // eg localhost or db.isp.com<br />
$CFG->dbname = 'db123456789'; // database name, eg moodle<br />
$CFG->dbuser = 'dbo123456789'; // your database username<br />
$CFG->dbpass = 'yourpassword'; // your database password<br />
$CFG->prefix = 'mdl_'; // Prefix to use for all table names<br />
<br />
Other variables must be defined as follows:<br />
<br />
$CFG->wwwroot = <nowiki>'http://www.yourdomain.com';</nowiki><br />
$CFG->dirroot = '/homepages/12/d123456789/htdocs/yourdirectory';<br />
$CFG->dataroot = '/homepages/12/d123456789/htdocs/moodledata';<br />
<br />
So far, this gets me into the Moodle setup program on the server, but I get errors when trying to install Moodle. It can't seem to correctly set up the database. Please edit this page to provide more information to the many users of 1and1. Thank you.<br />
<br />
----<br />
In my experience you need to add .htaccess file which contains this line <br />
'''AddType x-mapp-php5 .php'''<br />
to your moodle folder <br />
as described in [https://docs.moodle.org/en/Installation_FAQ#Installation_hangs_when_setting-up_database_tables Installation hangs when setting-up database tables]FAQ. <br />
<p>You also need to use a MySQL 5.0 database for moodle 1.8.</p><br />
<br />
----<br />
I can confirm the above. I struggled with a fresh installation of Version 1.9 with a MySQL 5.0 db set up. The addition of<br />
'''AddType x-mapp-php5 .php'''<br />
as a single entry in the .htaccess file of the moodle directory solved the problem - the unattended installation worked well without error.<br />
<br />
[[Category:Installation]]</div>Kawhttps://docs.moodle.org/20/en/index.php?title=Moodle_migration&diff=35465Moodle migration2008-04-30T11:45:04Z<p>Kaw: /* DNS changes */ Added firewall changes link</p>
<hr />
<div>There may be times when you need to move your Moodle site from one server to another, for example, moving from shared hosting to a dedicated server - this is known as migrating your Moodle site. One common mistake to watch out for is to remember to update the relevant details in your Moodle ''config.php'' file.<br />
<br />
==Migrating a complete Moodle site - method 1==<br />
<br />
This involves moving a whole site from one server to another. If you are changing the domain/IP address to the new server you need to do these steps:<br />
* '''Maintenance mode'''. Place your current Moodle site in maintenance mode to prevent any further additions to the Moodle database. Don't let administrators login during the migration as they are not affected by the maintenance mode setting.<br />
* '''Backup your current Moodle database'''. Do this by following the instructions in the [[Upgrading | upgrading Moodle]] page. This will give you a text file containing the mysql dump.<br />
* '''Copy the Moodle software'''. You will need to copy the Moodle code itself to the new server - upgrade the code to the latest version if you can.<br />
* '''Change <code>$CFG->wwwroot</code>'''. In your (possibly new) Moodle directory, change the <code>$CFG->wwwroot</code> variable in the ''config.php'' file for the new server.<br />
* '''Copy data directory contents (moodledata)'''. Copy the contents of your data directory (check for the value in <code>$CFG->dataroot</code>) to the new server. Check also that permissions remain the same on the new dataroot folder and change the value if you have changed its location on the new server.<br />
* '''Change your Moodle URL'''. If you have a new URL, you'll need to change this in the Moodle database to the new server. This is needed as links to pictures, files, etc are stored as absolute links and will reference the old <code>$CFG->wwwroot</code> value. So when loading a mysql backup dump of the Moodle server into mysql on another server the absolute referenced links will be broken. There are two methods of doing this:<br />
:(a) The first method changes the Moodle URL using the Moodle script ''replace.php'' while your site is currently running just before you backup the Moodle database. Point your browser to <nowiki>http://yourserver.com/admin/replace.php</nowiki><br />
<br />
:Enter the url for your old server (<nowiki>http://oldserver.com/</nowiki>) and new server (<nowiki>http://newserver.com/</nowiki>) and it will fix the mysql tables. You will also need to clear out any cached links by restarting your webserver. Now, take another backup of the Moodle database - this one will have the correct URLs.<br />
<br />
:(b) The second method is to backup the Moodle database first, then use the search and replace feature of your text editor (or use a unix tool like sed) to replace the old URL with the new one in the mysql backup file. Here is an example sed command:<br />
<br />
: <code>#sed -e 's/oldserver.com/newserver.com/g' oldmysqldump.sql > newmysqldump.sql</code><br />
<br />
:'''Tip''': You may want to check the mysqldump file to see how the old server was referenced.<br />
:After changing the URL, restore the mysql database<br />
* '''Test the migration'''. To test the new install, access Moodle using your browser and the new server's URL. When you have tested that a number of links in the courses work, take the new Moodle site out of maintenance mode.<br />
'''See also''': [http://moodle.org/mod/forum/discuss.php?d=85812 Forum discussion] on migrating Moodle's data directory on a Windows system.<br />
<br />
==Migrating a complete Moodle site - method 2==<br />
<br />
Do you have shell access on both servers? If so, the following method is a very quick and efficient method to migrate a *nix based site.<br />
<br />
It is also useful for creating snapshots or test sites.<br />
*Set up a new empty database on the '''new''' server.<br />
*Place your Moodle site into maintenance mode.<br />
*Login to shell on the '''old''' server.<br />
*Use rsync to copy '''moodledata''' and '''public_html''' (or whatever directory your Moodle install is in) to the new server - execute (replacing caps with your details; SOURCE = the directory you want to copy) for each directory:<br />
::<code>rsync -av -e ssh SOURCE/ USERNAME@NEW_SERVER.COM:/PATH/TO/DESTINATION/</code><br />
*Dump existing database and move and import into database on new server by executing:<br />
::<code>mysqldump --allow-keywords --opt -uMySQL_USERNAME -pPASSWORD DATABASE | ssh USER@DOMAIN "mysql -uMySQL_USERNAME -pPASSWORD DATABASE"</code><br />
*On the '''new server''', update '''config.php''' with relevant details.<br />
*To fix any internal Moodle links, login to your "new" Moodle install on your new server and use '''admin/replace.php''' to search and replace the old uri for the new.<br />
*Make sure everything is working.<br />
<br />
Takes about 15 minutes.<br />
<br />
When happy all has gone well, set up redirects/make DNS changes if required, take new site out of maintenance mode and "switch off" old site.<br />
<br />
==Other points to consider==<br />
<br />
===Upgrade Moodle===<br />
<br />
When migrating Moodle it is often a good idea to take the opportunity to upgrade Moodle to the latest version. If you manage your own server, follow the instructions in [[Upgrading | upgrading moodle]], otherwise check if your host can upgrade for you.<br />
<br />
===Restoring a single course across servers===<br />
<br />
You may need to restore a single course from an old site to a new one, especially if you are testing the migration. When restoring a Moodle backup file to Moodle on a different server than the one used to create the backup, the absolute referenced links to files maybe broken. To fix this problem open the ''backup-coursename.zip'' file and edit the ''moodle.xml'' file replacing links with <code>$@FILEPHP@$</code>.<br />
<br />
For example, replace <nowiki>http://yourserver.com/file.php/243/</nowiki> with <code>$@FILEPHP@$</code><br />
<br />
When the file is restored it will use the correct file path for the new course.<br />
<br />
===DNS & Masquerading changes===<br />
<br />
You may have had to change the DNS entries for the new Moodle site. If you have done so, it will take some time for the changes to replicate, so be patient. If your server is located behind a firewall, you may also have to change your firewall rules to allow access to the new server. See the [[Masquerading | masquerading docs]].<br />
<br />
===Internal and external access===<br />
<br />
If you have a set up where your Moodle site can be accessed via a network and via the internet, ensure you check that the new site can be accessed internally and externally. <br />
<br />
==See also==<br />
<br />
Using Moodle forum discussions:<br />
* [http://moodle.org/mod/forum/discuss.php?d=62959 Changing Moodle URL] <br />
* [http://moodle.org/mod/forum/discuss.php?d=57477 Changing site address] <br />
* [http://moodle.org/mod/forum/discuss.php?d=76704 Upgrading whilst migrating] <br />
* [http://moodle.org/mod/forum/discuss.php?d=65450 Internal and external access] <br />
<br />
[[Category:Installation]]<br />
<br />
[[fr:Migration de Moodle]]<br />
[[nl:Moodle verhuizen]]</div>Kawhttps://docs.moodle.org/20/en/index.php?title=Installing_Moodle&diff=35268Installing Moodle2008-04-27T14:52:14Z<p>Kaw: /* Requirements */ Fixed formatting</p>
<hr />
<div>'''Firstly don't panic! :-)'''<br />
<br />
This guide explains how to install Moodle for the first time. For some of these steps it goes into a lot of detail to try and cover the majority of possible web server setups, so this page may look long and complicated. Don't panic, once you know how to do it you can install Moodle in minutes!<br />
<br />
If you have problems please read this page carefully - most common issues are answered in here. If you still have trouble, you can seek help from the Moodle community via [http://moodle.org/course/view.php?id=5 moodle.org Using Moodle].<br />
<br />
Another option is to contact a [http://moodle.com/hosting/ Moodle Partner providing Moodle hosting] who can completely maintain Moodle for you, so that you can ignore all this and get straight into educating! A Moodle partner is the preferred option but if you decide to choose a hosting company that has cpanel then [http://otaru-jc.ac.jp/hagley/settingupmoodleonhostingwithcpanel.swf this tutorial will guide you] through the process of choosing a host and setting up moodle via cpanel. <br />
<br />
'''Warning:''' some hosting companies offer one-click moodle install options, which whilst sometimes effective, usually use old (sometimes years old) versions of moodle and sometimes simply don't work. If one of these goes wrong, your best bet is often to start from scratch following the instructions here yourself. Its almost certainly quicker.<br />
<br />
If you want to run Moodle on your own computer and this page looks a bit daunting, then please see our guides: [[Installing AMP |Installing Apache, MySQL and PHP(AMP)]] or [[Complete install packages| how to install one of Moodle's complete packages]]. They provide alternative instructions to install all this on most popular platforms.<br />
==Table of Contents==<br />
__TOC__<br />
<br />
==Requirements==<br />
<br />
Moodle is primarily developed in Linux using [[Apache]], [[MySQL]] and [[PHP]] (also sometimes known as the LAMP platform), but is also regularly tested with Windows XP/2000/2003 (WAMP), Solaris 10 (Sparc and x64), Mac OS X and Netware 6 operating systems. Support for PostgreSQL, Oracle and Microsoft SQL Server is also available.<br />
<br />
'''Blank page problem while installing Moodle on Windows Vista may occur; following these steps: [[Installing Moodle on Windows Vista]] might help.<br />
<br />
'''Note if you are using a hosted account''': Most web hosts support all of these requirements by default. You should contact your web host's support desk to check that this is the case '''before''' signing-up with them. It is especially important to ask about any PHP memory limits or MySQL question limits. If your prospective host does not provide a service which meets these requirements, or you are already signed up with them, ask them why and consider taking your business elsewhere if they do not change.<br />
<br />
The requirements for Moodle are as follows:<br />
<br />
'''Hardware''' (unless you are using a hosted server). <br />
* Disk space: 160MB free (min). You will require more free space to store your teaching materials.<br />
* Memory: 256MB (min), 1GB (recommended). The general rule of thumb is that Moodle can support 50 ''concurrent'' users for every 1GB of RAM, but this will vary depending on your specific hardware and software combination. <br />
'''Software'''<br />
* Web server software. Most people use [[Apache]], but Moodle should work fine under any web server that supports [[PHP]], such as [[IIS]] on Windows platforms. PHP does impose requirements on versions of web servers, however these are complex and the general advice is to use the newest version possible of your chosen web server. <br />
* PHP scripting language. (Please note that there have been issues installing Moodle with [http://www.php-accelerator.co.uk PHP-Accelerator]). There are currently two versions (or branches) of PHP available: PHP4 and PHP5 and the version requirements are listed below.<br />
** For Moodle version 1.4 or later: PHP4 (version 4.1.0 or later) or PHP5 (version 5.1.0 or later) are supported.<br />
** For Moodle version 1.6 or later: the PHP4 (version 4.3.0 or later) or PHP5 (version 5.1.0 or later) are supported. <br />
** Future Moodle versions 2.0 or later will not support PHP4 and will require PHP5 (version 5.2.0 or later).<br />
** PHP Settings. Check these settings in your php.ini or .htaccess file (if you're using Apache). For settings which use ON/OFF as their values, you can substitute 1 for ON and 0 for OFF if you prefer. <br />
*** ''safe_mode'' needs to be OFF.<br />
*** ''memory_limit'' should be at least 16M (32M is recommended for Moodle 1.7 and 40M for Moodle 1.8 or later). Large sites may need more than 128M. PHP 5.2.x requires higher memory_limit values than previous versions of PHP. 64bit operating systems require even more memory.<br />
*** ''session.save_handler'' needs to be set to FILES.<br />
*** ''magic_quotes_gpc'' needs to be ON. This is preferred but not necessary.<br />
*** ''magic_quotes_runtime'' needs to be OFF.<br />
*** ''file_uploads'' needs to be ON.<br />
*** ''session.auto_start'' needs to be OFF.<br />
*** ''session.bug_compat_warn'' needs to be OFF.<br />
** PHP Extensions and libraries<br />
*** The mbstring extension is recommended for Moodle 1.6 or later.<br />
*** The iconv extension is recommended for Moodle 1.6 or later.<br />
*** [http://www.libgd.org/ GD library] and the [http://www.freetype.org/ FreeType 2] library and extensions are needed to be able to look at the dynamic graphs that the logs pages make.<br />
*** The mysql extension is required if you are using the MySQL database. Note that in some Linux distributions (notably Red Hat) this is an optional installation.<br />
*** The pgsql extension is required if you are using the PostgreSQL database.<br />
*** The zlib extension is required for zip/unzip functionality.<br />
*** The curl extension is recommended for Moodle 1.8 or later.<br />
*** The tokenizer extension is recommended for Moodle 1.8 or later.<br />
*** The curl and openssl extensions are required for the Moodle network functionality (Moodle 1.8 or later).<br />
*** Other PHP extensions may be required to support optional Moodle functionality, especially external authentication and/or enrolment (e.g. LDAP extension for LDAP authentication and the sockets extension for Chat server).<br />
* A working database server: [[MySQL]] or [[PostgreSQL]] are completely supported and recommended for use with any version of Moodle. Support for Microsoft SQL Server and Oracle has been added in Moodle 1.7. MySQL is ''the'' choice for many people because it is very popular, but there are some [[Arguments in favour of PostgreSQL|arguments in favour of PostgreSQL]], especially if you are planning a large deployment. <br />
** For Moodle 1.5 or later, MySQL (version 3.23 or later) or PostgreSQL (7.4 or later). <br />
** For Moodle 1.6 or later, MySQL (version 4.1.12 or later) or PostgreSQL (7.4 or later).<br />
** For Moodle 1.7 or later, MySQL (version 4.1.12 or later), PostgreSQL (7.4 or later) or Microsoft SQL Server 2005 (version 9 or [http://moodle.org/mod/forum/discuss.php?d=59284 SQL Server Express 2005])<br />
: MySQL Notes: For Moodle 1.6 or later, If you use latin languages only you can use MySQL 4.1.12. If you are using non-latin languages you require MySQL 4.1.16 or later. Currently the MySQL setting "strict mode" must be OFF (set to "" or "MYSQL40") in the MySQL configuration file. <br />
: PostgreSQL Notes: The minimum version of PostgreSQL is 7.4 and Moodle is widely used with 8.0 and 8.1.<br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<br />
== How many users? ==<br />
<br />
In addition to the hardware and software requirements, you will also need to think about the capacity of your Moodle installation in terms of the number of users it can handle. There are two numbers to plan for:<br />
<br />
* '''Browsing users''': the maximum number of users able to browse your Moodle site. This is the number of computers in your organization or on your course (whichever is greater).<br />
* '''Concurrent database users''': the maximum number of concurrent database users (needed for Moodle activities such as quizzes). This is the number of users who will be using Moodle at the same time. In an educational institution, use your timetable/roster to obtain this figure.<br />
<br />
Once you know these figures for your users, you can start work out if your Moodle installation can support this capacity. The exact number of users depends on your hardware/software/network combination. Usually the amount of memory installed (RAM) is the deciding factor but a faster overall processor speed will also help in reducing waiting times for pages to load. <br />
<br />
The general rule of thumb for a single server is that the approx max concurrent users = RAM (GB) * 50 and the approx max browsing users = Approx max concurrent users * 5. As an example, a university with 500 total computers on campus and 100 concurrent users at any time will need approx 2GB of RAM on the one server to support the number of concurrent users.<br />
<br />
'''Note if you are using a hosted account''': Ask your provider what limits are placed on the number of concurrent database connections and the processor load. This will give a good estimate of the number of users your Moodle install can manage.<br />
<br />
'''Note:''' As of August 31, 2007, the moodle 1.8.2+ codes are still not suitable for large installation, especially if you have large number (e.g. 20,000+) of courses. The main reason is the codes related to ROLES are still not fully optimized with database queries and still need some work. If you are planning to use 1.8.x codes for a larger institution, please make sure that you have sufficient time to do your own testing and performance profiling.<br />
<br />
[Update] This performance issue has been improved quite a bit in the most recent 1.8.3+ version (see this thread discussion: http://moodle.org/mod/forum/discuss.php?d=83281). However, you should still plan with caution if you are planning to use Moodle 1.8.x code base for larger installation.<br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<br />
== Download and copy files into place ==<br />
<br />
There are two ways to get Moodle, either as a compressed package or via CVS. <br />
* There are two types of compressed packages on the [http://download.moodle.org/ download page: http://download.moodle.org/], the standard distribution with Moodle only files and the [[Complete install packages|complete install]], which contains programs to operate Moodle in a web environment. <br />
* To use CVS, helpful instructions are available at the [[CVS_for_Administrators | CVS for Administrators]] page. The full [http://cvs.moodle.org/moodle/ Moodle CVS repository] is also available for browsing. <br />
<br />
After downloading, unpack the archive using either <br />
tar -zxvf [filename]<br />
or<br />
unzip [filename]<br />
as appropriate. <br />
<br />
If using CVS, run the CVS Checkout command.<br />
<br />
You will now be left with a directory called "moodle", containing a number of files and folders.<br />
<br />
You can either place the whole folder in your web server documents directory, in which case the site will be located at '''<nowiki>http://yourwebserver.com/moodle</nowiki>''', or you can copy all the contents straight into the main web server documents directory, in which case the site will be simply '''<nowiki>http://yourwebserver.com</nowiki>'''.<br />
<br />
If you are downloading Moodle to your local computer and then uploading it to your web site, it is usually better to upload the whole archive as one file, and then do the unpacking on the server. Even web hosting interfaces like cPanel allow you to uncompress archives in the "File Manager".<br />
<br />
=== Structure of moodle directory ===<br />
<br />
You can safely skip this section, but here is a quick summary of the contents of the Moodle folder, to help get you oriented:<br />
<br />
:''config.php'' - contains basic settings. This file does not come with Moodle - you will create it.<br />
:''install.php'' - the script you will run to create config.php<br />
:''version.php'' - defines the current version of Moodle code<br />
:''index.php'' - the front page of the site<br />
:''admin/'' - code to administrate the whole server<br />
:''auth/'' - plugin modules to authenticate users<br />
:''blocks/'' - plugin modules for the little side blocks on many pages<br />
:''calendar/'' - all the code for managing and displaying calendars<br />
:''course/'' - code to display and manage courses<br />
:''doc/'' - help documentation for Moodle (eg this page)<br />
:''files/'' - code to display and manage uploaded files<br />
:''lang/'' - texts in different languages, one directory per language<br />
:''lib/'' - libraries of core Moodle code<br />
:''login/'' - code to handle login and account creation<br />
:''mod/'' - all the main Moodle course modules are in here<br />
:''pix/'' - generic site graphics<br />
:''theme/'' - theme packs/skins to change the look of the site.<br />
:''user/'' - code to display and manage users<br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<br />
== Setting-up your system==<br />
To ensure that Moodle will install successfully, you need to check that the web server settings are correct, then create a blank database for Moodle to use and finally create a directory on your hard disk for Moodle to save your materials and other files you upload into your courses.<br />
<br />
=== Check web server settings ===<br />
<br />
*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. Mine usually looks like this:<br />
<br />
'''DirectoryIndex''' index.php index.html index.htm<br />
<br />
:Just make sure index.php is in the list (and preferably towards the start of the list, for efficiency).<br />
<br />
*Secondly, '''if you are using Apache 2''', then you should turn on the ''AcceptPathInfo'' variable, which allows scripts to be passed arguments like <nowiki>http://server/file.php/arg1/arg2</nowiki>. 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.<br />
<br />
'''AcceptPathInfo''' on<br />
<br />
=== Recheck PHP settings ===<br />
Moodle requires a number of PHP settings to be active for it to work. These were given in the Requirements section and '''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, so it is useful to double-check that the settings are correct. These are defined in PHP's configuration file (usually called '''php.ini''') or in the Apache '''.htaccess''' file:<br />
<br />
safe_mode = 0 (necessary)<br />
memory_limit = 40M (varies: minimum 16M, 32M Moodle v1.7, 40M Moodle v1.8, 128M large sites)<br />
session.save_handler = files (unless you are using another handler, e.g. mm) <br />
magic_quotes_gpc = 1 (preferred but not necessary)<br />
magic_quotes_runtime = 0 (necessary)<br />
file_uploads = 1<br />
session.auto_start = 0<br />
session.bug_compat_warn = 0<br />
<br />
You may also want to set other, optional php.ini file settings while you are already editing it. For instance, you may want to reset the maximum upload size of file attachments, which usually defaults to 2M(egabytes). For instance, to set these to 16 Megabytes:<br />
<br />
post_max_size = 16M<br />
upload_max_filesize = 16M<br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<br />
=== Using a .htaccess file for webserver and PHP settings ===<br />
<br />
Use the above if you can directly edit your server's files, but if you are setting-up Moodle on a webhost, or 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. This only works on Apache servers and only when Overrides have been allowed in the main Apache configuration. Moodle is supplied with a htaccess file which you can use, or you can create your own file manually.<br />
<br />
* '''Use the default htaccess file'''. The easiest thing to do is just copy the sample file from moodle/lib/htaccess and edit it to suit your needs. It contains further instructions. For example, in a Unix shell:<br />
<br />
cd moodle<br />
cp moodle/lib/htaccess .htaccess<br />
<br />
* '''Create your own file'''. Alternatively you can create your own file called '''.htaccess''' in Moodle's main directory that contains lines like the following. <br />
<br />
DirectoryIndex index.php index.html index.htm<br />
php_value memory_limit 40M (adjust to your version of Moodle)<br />
php_flag magic_quotes_gpc 1<br />
php_flag magic_quotes_runtime 0<br />
php_flag file_uploads 1<br />
php_flag session.auto_start 0<br />
php_flag session.bug_compat_warn 0<br />
<br />
:If you have Apache version 2 installed, add these lines:<br />
<br />
<IfDefine APACHE2><br />
AcceptPathInfo on<br />
</IfDefine><br />
<br />
:Otherwise add this single line:<br />
<br />
AcceptPathInfo on<br />
<br />
:Optionally, you can also do things like define the maximum size for uploaded files, etc by adding these lines:<br />
<br />
LimitRequestBody 0<br />
php_value upload_max_filesize 2M<br />
php_value post_max_size 2M<br />
<br />
:The value given in these lines is 2M. You may want to change this at a later date to allow uploading of larger files.<br />
<br />
'''Note''': Use a .htaccess file only [http://httpd.apache.org/docs/1.3/howto/htaccess.html#when as a last resort] as it can have an impact on the performance of your Moodle site and cause pages to load slowly on your browser.<br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<br />
=== Creating an empty database ===<br />
<br />
You need to create an empty database (eg "''moodle''") in your database system along with a special user (eg "moodleuser") that has access to that database (and that database only). You could use the "root" user if you wanted to for a test server, but this is not recommended for a production system: if hackers manage to discover the password then your whole database system would be at risk, rather than just one database.<br />
<br />
::'''Warning''': Bear in mind that, as of Moodle version 1.5.x, Moodle doesn't work with MySQL 5.x's strict mode setting (STRICT_TRANS_TABLES and/or STRICT_ALL_TABLES) -- see [http://moodle.org/mod/forum/discuss.php?d=58552 forum discussion]. So if you are using MySQL 5.x, edit MySQL's configuration file (called "my.ini" in Windows and "my.cnf" on Unix/Linux) and comment out that option or set it to <code>sql-mode=<nowiki>''</nowiki></code>. You have to restart MySQL after changing this setting. <br><br> If you do not have access to your server, use PHPMyAdmin (or another MySQL client) and enter the command <code>SET @@global.sql_mode=<nowiki>''</nowiki>;</code> (be sure to use single quotes, and don't forget the semicolon).<br />
<br />
<table style=background-color:lightCyan border=1 cellpadding=5 cellspacing=0 ><tr><td><br />
====Using a hosted server====<br />
If you are using a webhost, they will probably have a control panel web interface for you to create your database.<br />
<br />
The '''[http://www.cpanel.com/ cPanel]''' system is one of the most popular of these. <br />
To create a database using cPanel:<br />
<br />
# Click on the '''MySQL Databases''' icon.<br />
# Type '''moodle''' in the New Database field and click '''Create Database'''.<br />
# Type a ''username'' and ''password'' (not one you use elsewhere) in the respective fields and click '''Create User'''.<br>Note that the ''username'' and ''database'' names may be prefixed by your cPanel account name and an underscore, and truncated to 16 characters. When entering this information into the Moodle installer - use the full names.<br />
# Now use the '''Add Users to Databases''' button and give this new user account '''ALL''' rights to the new database.<br />
<br />
Continue with [[Installing_Moodle#CreatDataDir |Creating the data directory]]<br />
<br />
</table><br />
<br />
====Using the command line====<br />
<br />
If you have access to Unix or Windows command lines then you can do the same sort of thing by typing commands. You should do this using the MySQL Client program as follows (commands which you type-in are shown in bold):<br />
<br />
- Start the MySQL Client program:<br />
#'''mysql -u root -p'''<br />
Enter password:<br />
Welcome to the MySQL monitor. Commands end with ; or \g.<br />
Your MySQL connection id is 2 to server version: 5.0.22-log<br />
<br />
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.<br />
<br />
mysql><br />
<br />
- The prompt changes to "mysql>" to indicate that you are now working in the MySQL Client program. When working in MySQL, all commands which you type-in must end in a semi-colon. (If you hit the Enter key without the final semi-colon, you'll get the line continuation symbol '->'; this is your second chance to type the semi-colon and hit Enter.) <br />
<br />
- Begin by checking for any existing databases called "moodle" - if there are any you should change the name in all the commands which follow:<br />
mysql> '''SHOW DATABASES;'''<br />
+-------------------------+<br />
| Database |<br />
+-------------------------+<br />
| information_schema |<br />
| mysql |<br />
| test |<br />
+-------------------------+<br />
3 rows in set (0.03 sec)<br />
<br />
- Create a database to store the Moodle tables. We'll call this "moodle", as there are none with that name already in the above list, but change it if you need to.<br />
mysql> '''CREATE DATABASE moodle;'''<br />
Query OK, 1 row affected (0.00 sec)<br />
<br />
- Change the default character set and collation of the "moodle" database to UTF8. Leave this out if you are installing Moodle 1.5 or earlier):<br />
mysql> '''ALTER DATABASE moodle DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;'''<br />
Query OK, 1 row affected (0.00 sec)<br />
<br />
- Create a username and password to access the database "moodle" and grant database access permissions. We'll call the user "moodleuser" and set the password as "yourpassword". It's a good idea to change these for your installation however most people keep the username as "moodleuser". Remember the username and password you have set, as you'll need it in the configuration screens later. This is a long command so has been split over several lines by pressing the Return key.<br />
mysql> '''GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,'''<br />
-> '''DROP,INDEX,ALTER ON moodle.*'''<br />
-> '''TO moodleuser@localhost IDENTIFIED BY 'yourpassword';'''<br />
Query OK, 0 rows affected (0.01 sec)<br />
<br />
:'''Security Warnings''': Never leave the password as the one shown here. Make sure you have a strong password (a mixture of letters and numbers, upper and lower case). Avoid granting "ALL" permissions on the database.<br />
: '''Note''': For MySQL 4.0.1 or earlier, you don't need the CREATE TEMPORARY TABLES permission. <br />
<br />
- Exit the MySQL Client program:<br />
mysql> '''QUIT'''<br />
Bye<br />
#<br />
<br />
- Reload the grant tables using the mysqladmin program:<br />
#'''mysqladmin -u root -p reload'''<br />
Enter password:<br />
#<br />
<br />
And some example command lines for PostgreSQL:<br />
<br />
# su - postgres<br />
> psql -c "create user moodleuser createdb;" template1<br />
> psql -c "create database moodle <font color="red">with encoding 'unicode'</font>;" -U moodleuser template1<br />
> psql -c "alter user moodleuser nocreatedb;" template1<br />
> psql -c "alter user moodleuser with encrypted password 'yourpassword';" template1<br />
> su - root<br />
# /etc/init.d/postgresql reload<br />
<br />
If the Postgres create database command above (>psql -c "create database moodle...") gives an error message you may want to try:<br />
psql -c "create database moodle with template=template1 encoding = 'unicode' owner = moodleuser <br> location = '/var/mydata';"<br />
<br />
If the create database command asks you for a password, run the line containing 'encrypted password' first before proceeding.<br />
<br />
'''See also''':<br />
* Step-by-step instructions on [https://docs.moodle.org/en/Step-by-step_Install_Guide_for_Ubuntu installation for Ubuntu(Debian)]<br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<div id=CreatDataDir ><br />
<br />
=== Creating the data directory ===<br />
<br />
Moodle will also need some space on your server's hard disk to store uploaded files, such as course documents and user pictures. The Moodle installer tries hard to create the '''moodledata''' directory for you but if it fails then you will have to create a directory for this purpose manually.<br />
<br />
'''Security warning''': For security purposes, it's best that this directory is NOT accessible directly via the web. The easiest way to do this is to simply locate it OUTSIDE the web directory, but if you must have it in the web directory (and you are using Apache) then protect it by creating a file in the data directory called '''.htaccess''', containing these lines:<br />
<br />
order deny,allow<br />
deny from all<br />
<br />
'''Ownership & Permissions''': To make sure that Moodle can save uploaded files in this directory, check that the web server software has permission to read, write and execute in this directory. On Unix machines, this means setting the owner of the directory to be something like "nobody" or "apache", and then giving that user read, write and execute permissions. As an example, to change the owner to "nobody" you could use:<br />
<br />
chown -R nobody:apache moodledata<br />
<br />
To change the permissions so that the owner has read,write and execute permissions, use something like this:<br />
<br />
chmod -R 0770 moodledata<br />
<br />
'''Note''': If you are receiving permission denied messages, try ''chmod -R 0770 moodledata'' and then adjust the settings so that they are more secure. A more secure setting is ''chmod -R 0750 moodledata''. According to the comments in config-dist.php, "On hosting systems you might need to make sure that your group has no permissions at all while others have full permissions." To do this you could use ''chmod -R 707 moodledata''. See also the [[Security | security page]].<br />
<br />
Remember that by default moodle will issue a warning about moodle data directories created inside the web directory, but otherwise this directory can be located where you wish. You can later move or change the location of this directory, but if you do, be sure to edit the setting in the '''config.php''' file that sets this; e.g. if moodledata is under a directory called data, then it would look like this:<br />
<br />
$CFG->dataroot = '/data/moodledata';<br />
<br />
<table style=background-color:lightCyan border=1 cellpadding=5 cellspacing=0 ><tr><td><br />
<br />
'''CPanel and webhosts'''<br />
<br />
On cPanel systems you can use the "File Manager" to find the folder, click on it, then choose "Change Permissions". On many shared hosting servers, you will probably need to restrict all file access to your "group" (to prevent other webhost customers from looking at or changing your files), but provide full read/write access to everyone else (which will allow the web server to access your files). Speak to your server administrator if you are having trouble setting this up securely. In particular it will not be possible to create a usable data directory on sites that use a PHP feature known as "'''Safe Mode'''".<br />
</table><br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<br />
== Run the installer script to create config.php ==<br />
<br />
To run the installer script (install.php), just try to access your Moodle main URL using a web browser, or access '''<nowiki>http://yourserver/install.php</nowiki>''' directly.<br />
<br />
(The Installer will try to set a session cookie. If you get a popup warning in your browser make sure you accept that cookie!)<br />
<br />
Moodle will detect that configuration is necessary and will lead you through some screens to help you create a new configuration file called '''config.php'''. At the end of the process Moodle will try and write the file into the right location, otherwise you can press a button to download it from the installer and then upload '''config.php''' into the main Moodle directory on the server.<br />
<br />
Along the way the installer will test your server environment and give you suggestions about how to fix any problems. For most common issues these suggestions should be sufficient, but if you get stuck, check in the Installation Forum for more help.<br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<br />
== Go to the admin page to continue configuration ==<br />
<br />
Once the basic config.php has been correctly created in the previous step, trying to access the front page of your site will take you to the "admin" page for the rest of the configuration.<br />
<br />
The first time you access this admin page, you will be presented with a GPL "shrink wrap" agreement with which you must agree before you can continue with the setup.<br />
<br />
Now Moodle will start setting up your database and creating tables to store data. Firstly, the main database tables are created. You should see a number of SQL statements followed by status messages that look like this:<br />
<br />
CREATE TABLE course (<br />
id int(10) unsigned NOT NULL auto_increment,<br />
category int(10) unsigned NOT NULL default '0',<br />
password varchar(50) NOT NULL default <nowiki>''</nowiki>,<br />
fullname varchar(254) NOT NULL default <nowiki>''</nowiki>,<br />
shortname varchar(15) NOT NULL default <nowiki>''</nowiki>,<br />
summary text NOT NULL,<br />
format tinyint(4) NOT NULL default '1',<br />
teacher varchar(100) NOT NULL default 'Teacher',<br />
startdate int(10) unsigned NOT NULL default '0',<br />
enddate int(10) unsigned NOT NULL default '0',<br />
timemodified int(10) unsigned NOT NULL default '0',<br />
PRIMARY KEY (id)<br />
) TYPE=MyISAM;<br />
<br />
<font color="green">SUCCESS</font><br />
<br />
...and so on, followed by: <font color="green">Main databases set up successfully.</font><br />
<br />
If you don't see these, then there must have been some problem with the database or the configuration settings you defined in config.php. Check that PHP isn't in a restricted "Safe Mode" (commercial web hosts sometimes have safe mode turned on). You can check PHP variables by creating a little file containing '''<?php phpinfo() ?>''' and looking at it through a browser. Check all these and try this page again.<br />
<br />
Scroll down the very bottom of the page and press the "Continue" link.<br />
<br />
You should now see a form where you can define more configuration variables for your installation, such as the default language, SMTP hosts and so on. Don't worry too much about getting everything right just now - you can always come back and edit these later on using the admin interface. The defaults are designed to be useful and secure for most sites. Scroll down to the bottom and click "Save changes".<br />
<br />
If (and only if) you find yourself getting stuck on this page, unable to continue, then your server probably has what I call the "buggy referrer" problem. This is easy to fix: just turn off the "secureforms" setting, then try to continue again.<br />
<br />
Next you will see more pages that print lots of status messages as they set up all the tables required by the various Moodle module. As before, they should all be <font color="green">green</font>.<br />
<br />
Scroll down the very bottom of the page and press the "Continue" link.<br />
<br />
The next page is a form where you can define parameters for your Moodle site and the front page, such as the name, format, description and so on. Fill this out (you can always come back and change these later) and then press "Save changes".<br />
<br />
Finally, you will then be asked to create a top-level administration user for future access to the admin pages. Fill out the details with your own name, email etc and then click "Save changes". Not all the fields are required, but if you miss any important fields you'll be re-prompted for them.<br />
<br />
'''Make sure you remember the username and password you chose for the administration user account, as they will be necessary to access the administration page in future.'''<br />
<br />
(If for any reason your install is interrupted, or there is a system error of some kind that prevents you from logging in using the admin account, you can usually log in using the default username of "'''admin'''", with password "'''admin'''".)<br />
<br />
Once successful, you will be returned to the home page of your new site! Note the administration links that appear down the left hand side of the page (these items also appear on a separate Admin page) - these items are only visible to you because you are logged in as the admin user. All your further administration of Moodle can now be done using this menu, such as:<br />
<br />
* creating and deleting courses<br />
* creating and editing user accounts<br />
* administering teacher accounts<br />
* changing site-wide settings like themes etc<br />
<br />
But you are not done installing yet! There is one very important thing still to do (see the next section on cron).<br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<br />
== Set up cron ==<br />
<br />
Moodle's background tasks (e.g. sending out forum emails and performing course backups) are performed by a script which you can set to execute at specific times of the day. This is known as a cron script. Please refer to the [[Cron|Cron instructions]].<br />
<br />
== Set up backups ==<br />
<br />
Please refer to the [[Backup settings| backup instructions]].<br />
<br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<br />
== Create a new course ==<br />
<br />
Now that Moodle is running properly, you can try creating a new course to play with.<br />
<br />
Select "Create a new course" from the Admin page (or the admin links on the home page).<br />
<br />
Fill out the form, paying special attention to the course format. You don't have to worry about the details too much at this stage, as everything can be changed later by the teacher. Note that the yellow help icons are everywhere to provide contextual help on any aspect.<br />
<br />
Press "Save changes", and you will be taken to a new form where you can assign teachers to the course. You can only add existing user accounts from this form - if you want to create a new teacher account then either ask the teacher to create one for themselves (see the login page), or create one for them using the "Add a new user" on the Admin page.<br />
<br />
Once done, the course is ready to customize, and is accessible via the "Courses" link on the home page.<br />
<br />
==See also==<br />
<br />
* [[Installation FAQ]]<br />
*[[Complete install packages]] might be an easier first time installs on some systems<br />
* [[Installing Apache, MySQL and PHP]] - Open source programs that can run Moodle on the web or on a desktop<br />
* [[Upgrading Moodle]]<br />
* Using Moodle [http://moodle.org/mod/forum/discuss.php?d=42688 Selecting a web host for Moodle] forum discussion<br />
* [[masquerading|Masquerading]] - Running Moodle behind a masquerading/NAT firewall<br />
<br />
[[Category:Installation]]<br />
<br />
[[cs:Instalace]]<br />
[[de:Installieren von Moodle]]<br />
[[es:Instalación de moodle]]<br />
[[fr:Installation de Moodle]]<br />
[[ja:Moodleのインストール]]<br />
[[nl:Installatiegids]]<br />
[[pl:Instalacja Moodle]]<br />
[[pt:Instalação do Moodle]]<br />
[[ru:Установка Moodle]]<br />
[[sk:Inštalácia]]<br />
[[zh:安装Moodlezh:]]</div>Kawhttps://docs.moodle.org/20/en/index.php?title=Installation_FAQ&diff=35267Installation FAQ2008-04-27T13:58:05Z<p>Kaw: /* Installation hangs when setting-up database tables */ Added examples and highlights</p>
<hr />
<div>{{FAQ}}<br />
==Table of Contents==<br />
__TOC__<br />
<br />
==PHP - is it installed and what version do I have?==<br />
<br />
Make a new file on your web site called ''info.php'', containing the following text, and call it from your browser:<br />
<br />
<?PHP phpinfo() ?><br />
<br />
If nothing happens then you don't have PHP installed or your webserver is not configured to handle .php files properly. See the installation docs for some information about where to download it for your computer. See the [[phpinfo]] page for details about the content of this page.<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
<br />
== System information needed for Installation Forum ==<br />
When posting questions to the installation forum, try to provide as much background information as possible about your moodle system. Use this template to copy and paste into your post:<br />
* Server Operating System name (version also if possible): <br />
* Browser name (version also if possible):<br />
* Moodle version:<br />
* Moodle install type? (New/Upgrade):<br />
* Moodle config.php attached?(Y/N):<br />
* Phpinfo attached? (Y/N):<br />
<br />
For the last two items, try to include the following in your post as an attachment:<br />
* A copy of your phpinfo output as shown in your browser (see the instructions above for an explanation of how to obtain this).<br />
* A copy of the Moodle configuration file. This is located in the directory moodle and is named config.php<br />
<br />
Copy and paste both of these into a single text file (using vi, Notepad, etc) and attach this to your post.<br />
<br />
If you cannot provide your phpinfo, try to copy & paste and complete these in your post:<br />
* Webserver (e.g. Apache/IIS) version:<br />
* Database server (e.g. MySQL, PostgreSQL) version:<br />
* PHP version:<br />
<br />
For installation on web hosting accounts: contact your support desk who should be able to tell you this information.<br />
<br />
: '''Security Warning''': Make sure you edit any files and delete any passwords before posting onto the forum.<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
<br />
==What & where are Moodle's configuration settings stored?==<br />
Configuration settings are stored in the config.php file stored in your moodle folder. This file is created during the installation process. If there is a problem and the installation cannot create the file, you can try creating it manually from the [[Configuration file]] docs. Please remember that manually editing the file is not recommended and may lead to blank pages, especially if there are additional spaces and/or lines after the final php closing tag "?>".<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==Running a health check==<br />
Moodle contains a script that will help identify common php and webserver configuration problems as well as configuration problems. It is a good idea to run this script to check if you are having post-installation problems. Use your browser to run this file:<br />
<br />
http://www.mymoodle.com/moodle/admin/health.php<br />
<br />
Change the above line if you have installed moodle in the webroot instead of a folder inside the webroot.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==Downloading previous releases of Moodle==<br />
* '''Generic Packages''': If your server does not meet the [[Installing_Moodle#Requirements | requirements]] for the current version of Moodle, you can download previous releases by using wget, lynx or curl with this URL:<br />
<nowiki>http://download.moodle.org/stable[version_number]</nowiki> <br />
:For example: to download Moodle version 1.5, use http://download.moodle.org/stable15. You'll see a directory tree with the files displayed. Click on the one you want and download as normal - if you require the latest update of the version, scroll to the end of the list and download the "moodle-latest" file, or alternatively use these URLs for zip or tgz downloads:<br />
<nowiki>http://download.moodle.org/stable[version_number]/moodle-latest-[version_number].zip</nowiki><br />
<nowiki>http://download.moodle.org/stable[version_number]/moodle-latest-[version_number].tgz</nowiki><br />
<br />
:Changes made in the version in the last month are listed in the "CHANGES" file in the directory listing. The files you download contain Moodle code and are not the Windows or Mac packages - so you need to have a webserver, a database server and PHP already installed. The earliest version available is Moodle 1.3.<br />
* '''Windows Packages''': To download previous releases of the Moodle packages for Windows, use this URL:<br />
<nowiki>http://download.moodle.org/windows/MoodleWindowsInstaller-latest-[version_number].zip</nowiki><br />
* '''Mac Packages''': To download previous releases of the Mac pacakges, use either of these URLs (depending on whether you need the Intel or PPC package):<br />
<nowiki>http://download.moodle.org/macosx/Moodle4Mac-Intel-[version_number].dmg</nowiki><br />
<nowiki>http://download.moodle.org/macosx/Moodle4Mac-PPC-[version_number}.dmg</nowiki><br />
* '''Using CVS''': You can also use CVS to download older releases and incremental releases of the Moodle generic packages, e.g. Moodle 1.5.4 - see the [[CVS_for_Administrators | CVS documentation]].<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
== How to enable and check PHP error logs==<br />
PHP can be set up to log errors in a variety of different ways: two of these involve the use of the php.ini file and the ini_set command. <br />
* '''Using the php.ini file''': The log settings are contained in the php.ini file stored on the server. If you don't know where that is, edit your Moodle ''config.php'' and add the following as the second line<br />
<br />
phpinfo();<br />
<br />
:then reload the web page. Look for the entry '''Configuration File (php.ini) Path'''.<br />
<br />
:When you have located php.ini open it in your favorite text editor. Find the '''Error handling and logging''' section of the php.ini file. Make sure that both '''display_errors = On''', '''display_startup_errors = On''' and '''log_errors = On''' are present and uncommented. Check the value of '''error_log''' - this tells you the location of the file errors are logged to. If it is commented out then errors will be sent to the web server error log file. Remember, if you make any changes to this file you will need to restart the web server (or just reboot the server).<br />
<br />
* '''Using ini_set commands''': If you are using Moodle 1.7 or higher, the previous steps are not enough. In those versions error logging parameters are dependant on certain administrative settings that you specify in the debugging section. The problem is that if you can't access the administrative pages, you can't set the debugging options. So the only way to modify them is by adding the following lines to your config.php file, just before the last line (the one containing a single'?>' only):<br />
<br />
ini_set ('display_errors', 'on');<br />
ini_set ('log_errors', 'on');<br />
ini_set ('display_startup_errors', 'on');<br />
ini_set ('error_reporting', E_ALL);<br />
<br />
:This will enable the same settings specified above even if Moodle sets them otherwise. <br />
:'''Important''': Remember to put them just before the last line of config.php.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==Any text I add with an apostrophe (') or a quote (") causes errors or comes up with a slash added==<br />
<br />
Problems caused by apostrophes are caused by incorrect "magic quotes" settings. Moodle requires the following settings in the php.ini file (which are usually the default):<br />
<br />
magic_quotes_gpc = On<br />
magic_quotes_runtime = Off<br />
<br />
Please see [[Installing Moodle]] for more details.<br />
<br />
If you are using [[Debian_GNU/Linux_installation|Debian]] then the problem might be in the version of PHP that you have installed. Have a look at this [http://tracker.moodle.org/browse/MDL-9691 bug report ] to see if it matches your situation.<br />
<br />
==Email copies are not being sent from my forums==<br />
<br />
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.<br />
<br />
Basically, you need to set up a process to regularly call the script <code><nowiki>http://yoursite/admin/cron.php</nowiki></code>. Please refer to the [[Cron|cron instructions]].<br />
<br />
Tips:<br />
* Try the default settings in ''Administration > Server > Email''. This generally works.<br />
*Make sure that ''allowuseremailcharset'' in ''Administration > Server > Email'' is set to No. Setting this to Yes can cause a problem in some versions of Moodle.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
<br />
==Error: database connection failed==<br />
<br />
If you get errors like "database connection failed" or "could not connect to the database you specified", here are some possible reasons and some possible solutions.<br />
<br />
* Your '''database server''' isn't installed or running. To check this for MySQL try typing the following command line<br />
$telnet database_host_name 3306<br />
:You should get a cryptic response which includes the version number of the MySQL server. <br />
* If you are attempting to run '''two instances of Moodle on different ports''', use the ip address of the host (not localhost) in the $CFG->dbhost setting, e.g. $CFG->dbhost = 127.0.0.1:3308.<br />
* You don't have the '''PHP mysql or postgresql extensions''' installed (please refer to FAQ re. whether PHP is installed).<br />
* You haven't created a '''Moodle database and assigned a user''' with the correct privileges to access it. <br />
* The '''Moodle database settings''' are incorrect. The database name, database user or database user password in your Moodle configuration file ''config.php'' are incorrect. Use phpMyAdmin to set up and check your MySQL installation.<br />
* Check that there are '''no apostrophes or non-alphabetic letters''' in your MySQL username or password.<br />
* You are using MySQL version 4.1 or higher but the PHP MySQL extension is pre-4.1 (check in your phpinfo output). In this case the '''default password hashing algorithm''' is incompatible with that available in the PHP mysql extension versions 4.x.x. Use these MySQL commands to change the passwords to the old format:<br />
<br />
mysql>SET PASSWORD FOR 'root'@'localhost' = OLD_PASSWORD('password');<br />
mysql>SET PASSWORD FOR 'moodleuser'@'localhost' = OLD_PASSWORD('password');<br />
<br />
:Also, consider upgrading your PHP MySQL extension. See [http://dev.mysql.com/doc/mysql/en/old-client.html this MySQL document] for further information on how to deal with this problem.<br />
* You are using Fedora core 3 or some other Linux system with '''SELinux installed''' and enabled. See the following URL for information on how to disable SELinux: http://fedora.redhat.com/projects/selinux/ If you don't want to disable SELinux, you have to allow httpd process to create network connections:<br />
<br />
setsebool httpd_can_network_connect true<br />
<br />
* Mac OSX users -- if you are running MySQL on a Mac OSX, try changing '''$CFG->dbhost''' from 'localhost' to '127.0.0.1'<br />
'''See also''': MySQL page on [http://dev.mysql.com/doc/refman/5.0/en/common-errors.html common errors] which lists several possible scenarios for connection failure, with advice on how to fix the problems.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==I can't log in - I just stay stuck on the login screen==<br />
<br />
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].<br />
<br />
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]].<br />
<br />
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>.<br />
<br />
If you are still having problems, read the [[Can_not_log_in | Cannot log in]] page.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==I can't log in with message "Please verify that the current setting of session.save_path is correct" ==<br />
<br />
This error occurs when PHP is having problems saving its session files. You may also see these other error messages displayed on the screen or in your log files:<br />
<br />
Warning: Unknown: open(some-path/sessions/sess_acbf942a7399db3489ffa910e35d5242, O_RDWR)<br />
failed: Permission denied (13) in Unknown on line 0<br />
<br />
Warning: Unknown(): open(some-path/sessions/sess_acbf942a7399db3489ffa910e35d5242, O_RDWR) <br />
failed: No space left on device (28) in Unknown on line 0<br />
<br />
Warning: Unknown: Failed to write session data (files). Please verify that the current <br />
setting of session.save_path is correct (some-path/sessions) in Unknown on line 0 <br />
<br />
To temporarily bypass these errors, '''use database sessions''' by editing your [[Configuration_file | moodle configuration file]] and adding this line:<br />
<br />
$CFG->dbsessions = true;<br />
<br />
Database sessions may overload your mysql database and are not ideal in a shared hosting environment, so if this solves the problem, you can start fixing the problem as follows:<br />
* Check '''access rights'''. The session.save_path should be accessible by the apache user. Try this command:<br />
<br />
chown -R apache:apache some-path/sessions<br />
<br />
:This assumes that 'apache' is the name of the user your webserver runs under - it could also be 'nobody'.<br />
* Check the '''permissions''' to the directory that PHP is trying to save to (session.save_path = some-path/sessions). Set the permissions initially to 0777 (everyone read, write, execute) with this command:<br />
<br />
chmod -R 0777 some-path/sessions<br />
<br />
:If this fixes the problem, reduce the permissions (700 is recommended).<br />
<br />
'''See also''': Session problems can be specific to your server environment. As an example, see [http://moodle.org/mod/forum/discuss.php?d=55925#254596 this forum discussion] about session problems with Lycos hosting.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==I log in but the login link doesn't change. I am logged in and can navigate freely.==<br />
<br />
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.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==I keep getting this error: A server error that affects your login session was detected.==<br />
<br />
Please refer to the Using Moodle forum discussion [http://moodle.org/mod/forum/discuss.php?d=73716 A server error that affects your login session was detected. Please login again or restart your browser.].<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==I keep getting this error: Failed opening required '/web/moodle/lib/setup.php'==<br />
<br />
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.<br />
<br />
Sometimes people only use the path from their home directory, or relative to the root of the web server directory.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==My pages show fatal errors such as : Parse error, call to undefined function: get_string()==<br />
<br />
If you see errors like:<br />
<br />
Parse error: parse error, unexpected T_VARIABLE in /path/to/moodle/config.php on line 94 <br />
Fatal error: Call to undefined function: get_string() in /path/to/moodle/mod/resource/lib.php<br />
on line 11<br />
<br />
then you have probably left out a semi-colon or closing quote from a line in ''config.php'' (previous to line 94).<br />
<br />
Another possibility is that you edited ''config.php'' in a program like Word and saved it as a HTML web page, instead of using a plain text editor like Notepad.<br />
<br />
Another thing to check, particularly if you are using 3rd party modules or plugins, is whether any of the php scripts use short open tags (<? ?>) instead of proper ones (<?php ?>). Short tags are bad for various reasons, so first contact the author of that extension to tell them about the problem. Then either replace short tags with conventional ones, or set this line in php.ini:<br />
<br />
short_open_tag = On<br />
<br />
You should never find short tags in core moodle code. If you do, please file a bug in the bug tracker.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==Serious Error! Could not set up the site!==<br />
<br />
Please refer to the Using Moodle forum discussion [http://moodle.org/mod/forum/discuss.php?d=32071 Serious Error! Could not set up the site!].<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==Uploaded files give "File not found"==<br />
<br />
For example: Not Found: The requested URL /moodle/file.php/2/myfile.jpg was not found on this server.<br />
<br />
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):<br />
<br />
'''AcceptPathInfo''' on<br />
<br />
Note, this will ONLY work for Apache versions 2.x.<br />
<br />
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.<br />
<br />
To use this alternative method, you should change the ''slasharguments'' variable. For moodle versions < 1.7, this is located in the Operating System section of ''Administration > Configuration > [[admin/config|Variables]]''. In later versions, this option is located in ''Site Administration > Server > HTTP''. You should now be able to access your uploaded files.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
<br />
==When I go to the admin page, I get told to make dirroot blank!==<br />
<br />
If you see errors like this:<br />
<br />
Please fix your settings in config.php: <br />
You have: $CFG->dirroot = "/home/users/fred/public_html/moodle"; <br />
but it should be: $CFG->dirroot = "";<br />
<br />
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'':<br />
<br />
if ($dirroot != $CFG->dirroot) {<br />
<br />
and change it to this:<br />
<br />
if (!empty($dirroot) and $dirroot != $CFG->dirroot) {<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==When trying to add a resource I receive error messages==<br />
<br />
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]].<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==Why are all my pages blank?==<br />
<br />
Check the dirroot variable in ''config.php''. You must use complete, absolute pathnames e.g.<br />
<br />
$CFG->dirroot = "d:\inetpub\sites\www.yoursite.com\web\moodle";<br />
<br />
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 enable PHP error displays, set these lines in your ''php.ini'' file and reload the web page.<br />
<br />
display_errors = On<br />
display_startup_errors = On<br />
<br />
To determine if MySQL support is your problem, insert this as the second line in your ''config.php'' file<br />
<br />
phpinfo();<br />
<br />
then reload the web page. Examine the output closely to see if MySQL is supported. If not look for a package you are missing.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
== Why is a particular page blank or incomplete? ==<br />
<br />
*'''Check your web server log files!!''' <br />
:If a particular page is blank or incomplete (it doesn't display the footer), before you do anything else [[Installation_FAQ#How_to_enable_and_check_PHP_error_logs | check your error logs]]. Having established that PHP error logging is working, reproduce the error. Immediately check the error log file right at the end. Hopefully you will see a PHP error message at or very near the end of the file. This may solve your problem directly or makes it a lot easier to diagnose the problem in the Moodle forums.<br />
<br />
*If you are '''upgrading to a new version of Moodle''', check that you do not have an old version of a non-standard block or module installed. Remove any such blocks or modules installed using the admin settings page and start the install process again. However, do also make sure that you have included all optional plugins that were required by your courses. <br />
<br />
*If you '''do not see any blocks listed''', turn editing on and remove any blocks that you have added to that page and try reloading.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
<br />
==Installation hangs when setting-up database tables==<br />
Sometimes the installation will hang when setting up tables. This will be an abrupt hang with half the page displayed in the browser and/or other outputs removed. Examples are:<br />
<br />
- '''Truncated mysql statements''':<br />
<br />
(mysql): SET NAMES 'utf8'<br />
--------------------------------------------------------------------------------<br />
(mysql): SHOW LOCAL VARIABLES LIKE 'character_set_database'<br />
...<br />
...<br />
(no more statements are displayed) <br />
<br />
- '''Missing Continue button''': The “Scroll to continue” link is displayed but no “Continue” button is there. <br />
<br />
'''Note''': There is an exception to this when upgrading an existing database and the installation may appear to hang at the roles generation phase. This process can take a very long time - so please be patient.<br />
<br />
Below are some solutions you can try to overcome this problem:<br />
<br />
*'''Check for mysql limits'''. This is often a mysql error and not a php error. Check that there is no limit placed on your mysql database, e.g. a "questions" limit.<br />
<br />
*'''Check your .htaccess files'''. If the install is on a webhost, adding the following line to the .htaccess file in the moodle directory has been known to solve the problem.<br />
AddType x-mapp-php5 .php<br />
<br />
:Try also renaming the .htaccess file so that it is disabled.<br />
<br />
*'''Code customizations'''. You may also want to look and see if you've customized any of your code. Look at the last successful table, and then look at the block, mod, or other code that is referenced by that table. For example, if your install hangs and continues to say that the forum tables were successful as the last message, look at /mod/forum/ for any custom code. If you have customized code, backup those files and replace with the correct files. You can then restart the install by renaming config.php or reinstalling your database from the backup. If your install is successful, you can make your code changes back into the stock Moodle code.<br />
<br />
*'''Check your memory limit'''. It may also be that the "memory_limit" in your php.ini is set too low. Please check your php.ini file and allocate the recommended amount (see [https://docs.moodle.org/en/Installing_Moodle#Requirements Moodle requirements]). For Moodle version 1.8 and above at least 40MB is recommended.<br />
<br />
*'''Upgrade incrementally'''. To avoid this problem when upgrading, prefer to upgrade incrementally. For example: upgrade from 1.6.* to 1.7.* and then to 1.8.* rather than straight from 1.6.* to 1.8.*<br />
<br />
A work-around to this problem is to setup a working Moodle system on your local PC or server using the [http://download.moodle.org Moodle Packages]. Once you have a running Moodle, [https://docs.moodle.org/en/Upgrading_Moodle#Backup_important_data backup the database] and import to your webhost. Then backup the Moodle code itself (the "moodle" directory on your PC) and copy this to your webhost using (for example) FTP. Finally, edit the moodle/config.php file for the new settings that have to be changed for the webhost.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
<br />
==Why can't I upload a new image into my profile?==<br />
<br />
If you don't see anything on your user profile pages to let you upload user images then it's usually because GD is not enabled on your server. GD is a library that allows image processing.<br />
<br />
1. Make sure '''GD has been included in your PHP installation'''. You can check this by going into Administration >> Configuration >> [[Variables]] and looking for the gdversion setting. This setting is chosen automatically every time you visit that page. If it shows GD version 1 or version 2 then everything should be fine. Save that configuration page and go back to your user profile.<br />
<br />
2. If Moodle thinks GD is not installed, then you will need to '''install the GD library'''. <br />
*On Unix you may need to re-compile PHP with arguments something like this:<br />
<br />
./configure --with-apxs=/usr/local/apache/bin/apxs --with-xml --with-gd <br />
--with-jpeg-dir=/usr/local --with-png-dir=/usr --with-ttf --enable-gd-native-ttf <br />
--enable-magic-quotes --with-mysql --enable-sockets --enable-track-vars <br />
--enable-versioning --with-zlib<br />
<br />
* On Windows this is usually a matter of "turning on" the extension in PHP by editing your php.ini file. To do this remove the semicolon for the php_gd2.dll extension - check that this file is actually present in your php extensions folder first (search your php.ini for extension_dir to determine where this points to on your hard disk). You should then have a line that looks like this:<br />
extension=php_gd2.dll<br />
<br />
:Windows users should see the [[Installing AMP|installation instructions]] for further help. <br />
<br />
3. Remember to '''restart your webserver''' (if possible) and re-visit the Moodle configuration page after making any changes to PHP so it can pick up the correct version of GD.<br />
<br />
'''See also''': Using Moodle forum discussion [http://moodle.org/mod/forum/discuss.php?d=44271 Profile pictures] for additional information.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==Why do I keep getting error messages about "headers already sent"?==<br />
<br />
If you see errors like this:<br />
<br />
Warning: Cannot add header information - headers already sent by <br />
(output started at /webs/moodle/config.php:87) in /webs/moodle/lib/moodlelib.php <br />
on line 1322 <br />
<br />
Warning: Cannot add header information - headers already sent by <br />
(output started at /webs/moodle/config.php:87) in /webs/moodle/lib/moodlelib.php <br />
on line 1323 <br />
<br />
Warning: Cannot add header information - headers already sent by <br />
(output started at /webs/moodle/config.php:87) in /webs/moodle/login/index.php <br />
on line 54<br />
<br />
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.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
== Why doesn't my Moodle site display the time and date correctly? ==<br />
<br />
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.<br />
<br />
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)<br />
<br />
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.<br />
<br />
==I receive this error "500:Internal Server Error"==<br />
There are several possible causes for this error:<br />
<br />
1. '''Syntax error''': There is a syntax error in your .htaccess or httpd.conf files. The way in which directives are written [http://httpd.apache.org/docs/1.3/howto/htaccess.html#when differs] depending on which file you are using. You can test for configuration errors in your Apache files using the command:<br />
#apachectl configtest<br />
<br />
2. '''PHPsuexec''': Your server does not support .htaccess files, especially if it is running PHPsuexec, which is an Apache module used for increasing the security of a site on a hosted system. In this situation:<br />
<br />
- you may also see a 403: Forbidden error.<br />
<br />
- the webserver executes under your own username and all files have a maximum permissions level of 755. Check that this is set for your Moodle directory in your control panel or (if you have access to the shell) use this command:<br />
#chmod -R 755 moodle<br />
<br />
- use a PHP.INI file instead of a .htaccess in the directory where the Moodle PHP script is being executed. For example: if you are receiving a memory exhausted error when your server is executing the file moodle/admin/cron.php, use a PHP.INI file to change your memory_limit and copy it to the moodle/admin directory. Remember that PHP.INI files are per-directory, so you'll need to copy it to each sub-directory. The syntax used in a PHP.INI file is different to a .htaccess file and you need to take out php_value/php_flag at the beginning of the line and use an equals sign to assign a value, e.g.<br />
php_value memory_limit 128M <-- .htaccess<br />
memory_limit = 128M <-- php.ini equivalent <br />
<br />
3. '''Incompatible directive''': You may have a directive in your .htaccess or httpd.conf files which are not compatible with your web server version. Check your webserver documentation.<br />
<br />
==I receive this error "403: Forbidden" ==<br />
<br />
Check your webserver configuration. See also the section above I receive this error "500:Internal Server Error".<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
<br />
==How do I uninstall Moodle?==<br />
'''Moodle package installation''': If you have downloaded a Moodle package, simply uninstall using your system commands. On Windows PCs, you should access the Control Panel -> Add/Remove Programs. Select the package name and click Change or Remove Programs.<br />
<br />
'''Webhost/manual installation''': If you have installed Moodle manually or have installed onto a webhost, follow these steps:<br />
*Delete the moodle database using this mysql command (or delete using your mysql client, e.g. PHPMyAdmin):<br />
<pre>sql>DROP DATABASE moodle;</pre><br />
:In the above example replace 'moodle' with the name of the moodle database you created when installing.<br />
*Delete the moodledata directory. If you, or your users, have uploaded materials into this directory take a copy of these before deleting this directory.<br />
*Delete the moodle directory itself. This will delete all of the moodle PHP script files.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==How do I upgrade Moodle? Do I just overwrite the files?==<br />
Do not overwrite files, it may cause strange errors. You should read the [[Upgrade]] documentation before proceeding.<br />
<br />
==Migrating Moodle to a new site or server==<br />
Migrating Moodle means that you have to move the current installation to a new server, and so may have to change IP addresses or DNS entries. To do this you will need to change the $CFG->wwwroot value in the config.php on the new server. You will also have to change any absolute links stored in the database backup file (before restoring the file on the new server) either using the admin/replace.php script, your text editor or another "search and replace" tool, e.g. sed. For more details see the [[Moodle_migration | Moodle Migration]] page.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
<br />
==Fatal error allowed memory size exhausted. How do I increase my php memory limit?==<br />
You will sometimes see an error message something like this:<br />
Fatal error: Allowed memory size of 67108864 bytes exhausted <br />
(tried to allocate xx bytes) in /var/www/moodle/yyyy.php<br />
This error means that the php memory_limit value is not enough for the php script. The memory_limit value is the "allowed memory size" - 64M in the example above (67108864 bytes / 1024 = 65536 KB. 65536 KB / 1024 = 64 MB). You will need to increase the php memory_limit value until this message is not shown anymore. There are two methods of doing this.<br />
*On a hosted installation, add the following line to your .htaccess file (or create one in the moodle directory if it does not already exist):<br />
php_value memory_limit <value>M<br />
Example: php_value memory_limit 40M<br />
*If you have your own server with shell access, edit your php.ini file (make sure it's the correct one by checking in your phpinfo output) as follows:<br />
memory_limit <value>M<br />
Example: memory_limit 40M<br />
Remember that you need to restart your web server to make changes to php.ini effective. An alternative is to disable the memory_limit by using the command ''memory_limit 0''.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==Why does my new installation display correctly on the server, but when I view it from a different machine, styles and images are missing?==<br />
In the installation instructions, one of the suggested settings for 'webroot' is 'localhost'. This is fine if all you want to do is some local testing of your new Moodle installation. If, however, you want to view your new installation from another machine on the same local area network, or view your site on the internet, you will have to change this setting:<br />
*For local testing, 'localhost' is fine for the webroot ($CFG->wwwroot in config.php). <br />
*If you want to test your site from other machines on the same local area network (LAN), then you will have to use the private ip address of the serving machine, (e.g. 192.168.1.2/moodle) or the network name of the serving computer (e.g. network_name_of_serving_machine/moodle) as the web root. Depending on your LAN setup, it may be better to use the network name of the computer rather than its (private) ip address, because the ip address can and will change from time to time. If you don't want to use the network name, then you will have to speak to your network administrator and have them assign a permanent ip address to the serving machine.<br />
*Finally, if you want to test your new installation across the internet, you will have to use either a domain name or a permanent (public) ip address/moodle as your web root. To handle both types of access, see [https://docs.moodle.org/en/masquerading masquerading].<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==Maximum upload file size - how to change it?==<br />
There are several places to change the maximum file upload size. The first place to check is the Administration block. Security -> Site Policies -> and look for "Maximum Uploaded File Size". This is the "maxbyte" variable found in older versions of Moodle (under Admin > Variables). Teachers may also set the maximum file size by the [[Course_settings#Maximum_upload_size|course administration block]].<br />
<br />
The second place to check are the server files. The php.ini file has a limit which will override any other setting. (Hint: remember to restart your server for changes to take effect). For more help see:<br />
*[[Installing_Moodle#Recheck_PHP_settings]]<br />
*[[Installing_Moodle#Using_a_.htaccess_file_for_webserver_and_PHP_settings]]<br />
*[[Site_policies#Maximum_uploaded_file_size]]<br />
<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
<br />
==See also==<br />
[[Category:FAQ]]<br />
[[Category:Installation]]<br />
<br />
[[es:FAQ Instalación]]<br />
[[fr:FAQ d'installation]]<br />
[[nl:Installatie FAQ]]<br />
[[ja:インストールFAQ]]<br />
[[ru:Установка FAQ]]<br />
[[pl:Instalacja FAQ]]</div>Kawhttps://docs.moodle.org/20/en/index.php?title=Installation_FAQ&diff=35032Installation FAQ2008-04-22T06:24:19Z<p>Kaw: Added 403 Forbidden section</p>
<hr />
<div>{{FAQ}}<br />
==Table of Contents==<br />
__TOC__<br />
<br />
==PHP - is it installed and what version do I have?==<br />
<br />
Make a new file on your web site called ''info.php'', containing the following text, and call it from your browser:<br />
<br />
<?PHP phpinfo() ?><br />
<br />
If nothing happens then you don't have PHP installed or your webserver is not configured to handle .php files properly. See the installation docs for some information about where to download it for your computer. See the [[phpinfo]] page for details about the content of this page.<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
<br />
== System information needed for Installation Forum ==<br />
When posting questions to the installation forum, try to provide as much background information as possible about your moodle system. Use this template to copy and paste into your post:<br />
* Server Operating System name (version also if possible): <br />
* Browser name (version also if possible):<br />
* Moodle version:<br />
* Moodle install type? (New/Upgrade):<br />
* Moodle config.php attached?(Y/N):<br />
* Phpinfo attached? (Y/N):<br />
<br />
For the last two items, try to include the following in your post as an attachment:<br />
* A copy of your phpinfo output as shown in your browser (see the instructions above for an explanation of how to obtain this).<br />
* A copy of the Moodle configuration file. This is located in the directory moodle and is named config.php<br />
<br />
Copy and paste both of these into a single text file (using vi, Notepad, etc) and attach this to your post.<br />
<br />
If you cannot provide your phpinfo, try to copy & paste and complete these in your post:<br />
* Webserver (e.g. Apache/IIS) version:<br />
* Database server (e.g. MySQL, PostgreSQL) version:<br />
* PHP version:<br />
<br />
For installation on web hosting accounts: contact your support desk who should be able to tell you this information.<br />
<br />
: '''Security Warning''': Make sure you edit any files and delete any passwords before posting onto the forum.<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
<br />
==What & where are Moodle's configuration settings stored?==<br />
Configuration settings are stored in the config.php file stored in your moodle folder. This file is created during the installation process. If there is a problem and the installation cannot create the file, you can try creating it manually from the [[Configuration file]] docs. Please remember that manually editing the file is not recommended and may lead to blank pages, especially if there are additional spaces and/or lines after the final php closing tag "?>".<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==Running a health check==<br />
Moodle contains a script that will help identify common php and webserver configuration problems as well as configuration problems. It is a good idea to run this script to check if you are having post-installation problems. Use your browser to run this file:<br />
<br />
http://www.mymoodle.com/moodle/admin/health.php<br />
<br />
Change the above line if you have installed moodle in the webroot instead of a folder inside the webroot.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==Downloading previous releases of Moodle==<br />
* '''Generic Packages''': If your server does not meet the [[Installing_Moodle#Requirements | requirements]] for the current version of Moodle, you can download previous releases by using wget, lynx or curl with this URL:<br />
<nowiki>http://download.moodle.org/stable[version_number]</nowiki> <br />
:For example: to download Moodle version 1.5, use http://download.moodle.org/stable15. You'll see a directory tree with the files displayed. Click on the one you want and download as normal - if you require the latest update of the version, scroll to the end of the list and download the "moodle-latest" file, or alternatively use these URLs for zip or tgz downloads:<br />
<nowiki>http://download.moodle.org/stable[version_number]/moodle-latest-[version_number].zip</nowiki><br />
<nowiki>http://download.moodle.org/stable[version_number]/moodle-latest-[version_number].tgz</nowiki><br />
<br />
:Changes made in the version in the last month are listed in the "CHANGES" file in the directory listing. The files you download contain Moodle code and are not the Windows or Mac packages - so you need to have a webserver, a database server and PHP already installed. The earliest version available is Moodle 1.3.<br />
* '''Windows Packages''': To download previous releases of the Moodle packages for Windows, use this URL:<br />
<nowiki>http://download.moodle.org/windows/MoodleWindowsInstaller-latest-[version_number].zip</nowiki><br />
* '''Mac Packages''': To download previous releases of the Mac pacakges, use either of these URLs (depending on whether you need the Intel or PPC package):<br />
<nowiki>http://download.moodle.org/macosx/Moodle4Mac-Intel-[version_number].dmg</nowiki><br />
<nowiki>http://download.moodle.org/macosx/Moodle4Mac-PPC-[version_number}.dmg</nowiki><br />
* '''Using CVS''': You can also use CVS to download older releases and incremental releases of the Moodle generic packages, e.g. Moodle 1.5.4 - see the [[CVS_for_Administrators | CVS documentation]].<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
== How to enable and check PHP error logs==<br />
PHP can be set up to log errors in a variety of different ways: two of these involve the use of the php.ini file and the ini_set command. <br />
* '''Using the php.ini file''': The log settings are contained in the php.ini file stored on the server. If you don't know where that is, edit your Moodle ''config.php'' and add the following as the second line<br />
<br />
phpinfo();<br />
<br />
:then reload the web page. Look for the entry '''Configuration File (php.ini) Path'''.<br />
<br />
:When you have located php.ini open it in your favorite text editor. Find the '''Error handling and logging''' section of the php.ini file. Make sure that both '''display_errors = On''', '''display_startup_errors = On''' and '''log_errors = On''' are present and uncommented. Check the value of '''error_log''' - this tells you the location of the file errors are logged to. If it is commented out then errors will be sent to the web server error log file. Remember, if you make any changes to this file you will need to restart the web server (or just reboot the server).<br />
<br />
* '''Using ini_set commands''': If you are using Moodle 1.7 or higher, the previous steps are not enough. In those versions error logging parameters are dependant on certain administrative settings that you specify in the debugging section. The problem is that if you can't access the administrative pages, you can't set the debugging options. So the only way to modify them is by adding the following lines to your config.php file, just before the last line (the one containing a single'?>' only):<br />
<br />
ini_set ('display_errors', 'on');<br />
ini_set ('log_errors', 'on');<br />
ini_set ('display_startup_errors', 'on');<br />
ini_set ('error_reporting', E_ALL);<br />
<br />
:This will enable the same settings specified above even if Moodle sets them otherwise. <br />
:'''Important''': Remember to put them just before the last line of config.php.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==Any text I add with an apostrophe (') or a quote (") causes errors or comes up with a slash added==<br />
<br />
Problems caused by apostrophes are caused by incorrect "magic quotes" settings. Moodle requires the following settings in the php.ini file (which are usually the default):<br />
<br />
magic_quotes_gpc = On<br />
magic_quotes_runtime = Off<br />
<br />
Please see [[Installing Moodle]] for more details.<br />
<br />
If you are using [[Debian_GNU/Linux_installation|Debian]] then the problem might be in the version of PHP that you have installed. Have a look at this [http://tracker.moodle.org/browse/MDL-9691 bug report ] to see if it matches your situation.<br />
<br />
==Email copies are not being sent from my forums==<br />
<br />
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.<br />
<br />
Basically, you need to set up a process to regularly call the script <code><nowiki>http://yoursite/admin/cron.php</nowiki></code>. Please refer to the [[Cron|cron instructions]].<br />
<br />
Tips:<br />
* Try the default settings in ''Administration > Server > Email''. This generally works.<br />
*Make sure that ''allowuseremailcharset'' in ''Administration > Server > Email'' is set to No. Setting this to Yes can cause a problem in some versions of Moodle.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
<br />
==Error: database connection failed==<br />
<br />
If you get errors like "database connection failed" or "could not connect to the database you specified", here are some possible reasons and some possible solutions.<br />
<br />
* Your '''database server''' isn't installed or running. To check this for MySQL try typing the following command line<br />
$telnet database_host_name 3306<br />
:You should get a cryptic response which includes the version number of the MySQL server. <br />
* If you are attempting to run '''two instances of Moodle on different ports''', use the ip address of the host (not localhost) in the $CFG->dbhost setting, e.g. $CFG->dbhost = 127.0.0.1:3308.<br />
* You don't have the '''PHP mysql or postgresql extensions''' installed (please refer to FAQ re. whether PHP is installed).<br />
* You haven't created a '''Moodle database and assigned a user''' with the correct privileges to access it. <br />
* The '''Moodle database settings''' are incorrect. The database name, database user or database user password in your Moodle configuration file ''config.php'' are incorrect. Use phpMyAdmin to set up and check your MySQL installation.<br />
* Check that there are '''no apostrophes or non-alphabetic letters''' in your MySQL username or password.<br />
* You are using MySQL version 4.1 or higher but the PHP MySQL extension is pre-4.1 (check in your phpinfo output). In this case the '''default password hashing algorithm''' is incompatible with that available in the PHP mysql extension versions 4.x.x. Use these MySQL commands to change the passwords to the old format:<br />
<br />
mysql>SET PASSWORD FOR 'root'@'localhost' = OLD_PASSWORD('password');<br />
mysql>SET PASSWORD FOR 'moodleuser'@'localhost' = OLD_PASSWORD('password');<br />
<br />
:Also, consider upgrading your PHP MySQL extension. See [http://dev.mysql.com/doc/mysql/en/old-client.html this MySQL document] for further information on how to deal with this problem.<br />
* You are using Fedora core 3 or some other Linux system with '''SELinux installed''' and enabled. See the following URL for information on how to disable SELinux: http://fedora.redhat.com/projects/selinux/ If you don't want to disable SELinux, you have to allow httpd process to create network connections:<br />
<br />
setsebool httpd_can_network_connect true<br />
<br />
* Mac OSX users -- if you are running MySQL on a Mac OSX, try changing '''$CFG->dbhost''' from 'localhost' to '127.0.0.1'<br />
'''See also''': MySQL page on [http://dev.mysql.com/doc/refman/5.0/en/common-errors.html common errors] which lists several possible scenarios for connection failure, with advice on how to fix the problems.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==I can't log in - I just stay stuck on the login screen==<br />
<br />
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].<br />
<br />
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]].<br />
<br />
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>.<br />
<br />
If you are still having problems, read the [[Can_not_log_in | Cannot log in]] page.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==I can't log in with message "Please verify that the current setting of session.save_path is correct" ==<br />
<br />
This error occurs when PHP is having problems saving its session files. You may also see these other error messages displayed on the screen or in your log files:<br />
<br />
Warning: Unknown: open(some-path/sessions/sess_acbf942a7399db3489ffa910e35d5242, O_RDWR)<br />
failed: Permission denied (13) in Unknown on line 0<br />
<br />
Warning: Unknown(): open(some-path/sessions/sess_acbf942a7399db3489ffa910e35d5242, O_RDWR) <br />
failed: No space left on device (28) in Unknown on line 0<br />
<br />
Warning: Unknown: Failed to write session data (files). Please verify that the current <br />
setting of session.save_path is correct (some-path/sessions) in Unknown on line 0 <br />
<br />
To temporarily bypass these errors, '''use database sessions''' by editing your [[Configuration_file | moodle configuration file]] and adding this line:<br />
<br />
$CFG->dbsessions = true;<br />
<br />
Database sessions may overload your mysql database and are not ideal in a shared hosting environment, so if this solves the problem, you can start fixing the problem as follows:<br />
* Check '''access rights'''. The session.save_path should be accessible by the apache user. Try this command:<br />
<br />
chown -R apache:apache some-path/sessions<br />
<br />
:This assumes that 'apache' is the name of the user your webserver runs under - it could also be 'nobody'.<br />
* Check the '''permissions''' to the directory that PHP is trying to save to (session.save_path = some-path/sessions). Set the permissions initially to 0777 (everyone read, write, execute) with this command:<br />
<br />
chmod -R 0777 some-path/sessions<br />
<br />
:If this fixes the problem, reduce the permissions (700 is recommended).<br />
<br />
'''See also''': Session problems can be specific to your server environment. As an example, see [http://moodle.org/mod/forum/discuss.php?d=55925#254596 this forum discussion] about session problems with Lycos hosting.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==I log in but the login link doesn't change. I am logged in and can navigate freely.==<br />
<br />
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.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==I keep getting this error: A server error that affects your login session was detected.==<br />
<br />
Please refer to the Using Moodle forum discussion [http://moodle.org/mod/forum/discuss.php?d=73716 A server error that affects your login session was detected. Please login again or restart your browser.].<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==I keep getting this error: Failed opening required '/web/moodle/lib/setup.php'==<br />
<br />
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.<br />
<br />
Sometimes people only use the path from their home directory, or relative to the root of the web server directory.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==My pages show fatal errors such as : Parse error, call to undefined function: get_string()==<br />
<br />
If you see errors like:<br />
<br />
Parse error: parse error, unexpected T_VARIABLE in /path/to/moodle/config.php on line 94 <br />
Fatal error: Call to undefined function: get_string() in /path/to/moodle/mod/resource/lib.php<br />
on line 11<br />
<br />
then you have probably left out a semi-colon or closing quote from a line in ''config.php'' (previous to line 94).<br />
<br />
Another possibility is that you edited ''config.php'' in a program like Word and saved it as a HTML web page, instead of using a plain text editor like Notepad.<br />
<br />
Another thing to check, particularly if you are using 3rd party modules or plugins, is whether any of the php scripts use short open tags (<? ?>) instead of proper ones (<?php ?>). Short tags are bad for various reasons, so first contact the author of that extension to tell them about the problem. Then either replace short tags with conventional ones, or set this line in php.ini:<br />
<br />
short_open_tag = On<br />
<br />
You should never find short tags in core moodle code. If you do, please file a bug in the bug tracker.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==Serious Error! Could not set up the site!==<br />
<br />
Please refer to the Using Moodle forum discussion [http://moodle.org/mod/forum/discuss.php?d=32071 Serious Error! Could not set up the site!].<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==Uploaded files give "File not found"==<br />
<br />
For example: Not Found: The requested URL /moodle/file.php/2/myfile.jpg was not found on this server.<br />
<br />
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):<br />
<br />
'''AcceptPathInfo''' on<br />
<br />
Note, this will ONLY work for Apache versions 2.x.<br />
<br />
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.<br />
<br />
To use this alternative method, you should change the ''slasharguments'' variable. For moodle versions < 1.7, this is located in the Operating System section of ''Administration > Configuration > [[admin/config|Variables]]''. In later versions, this option is located in ''Site Administration > Server > HTTP''. You should now be able to access your uploaded files.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
<br />
==When I go to the admin page, I get told to make dirroot blank!==<br />
<br />
If you see errors like this:<br />
<br />
Please fix your settings in config.php: <br />
You have: $CFG->dirroot = "/home/users/fred/public_html/moodle"; <br />
but it should be: $CFG->dirroot = "";<br />
<br />
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'':<br />
<br />
if ($dirroot != $CFG->dirroot) {<br />
<br />
and change it to this:<br />
<br />
if (!empty($dirroot) and $dirroot != $CFG->dirroot) {<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==When trying to add a resource I receive error messages==<br />
<br />
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]].<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==Why are all my pages blank?==<br />
<br />
Check the dirroot variable in ''config.php''. You must use complete, absolute pathnames e.g.<br />
<br />
$CFG->dirroot = "d:\inetpub\sites\www.yoursite.com\web\moodle";<br />
<br />
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 enable PHP error displays, set these lines in your ''php.ini'' file and reload the web page.<br />
<br />
display_errors = On<br />
display_startup_errors = On<br />
<br />
To determine if MySQL support is your problem, insert this as the second line in your ''config.php'' file<br />
<br />
phpinfo();<br />
<br />
then reload the web page. Examine the output closely to see if MySQL is supported. If not look for a package you are missing.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
== Why is a particular page blank or incomplete? ==<br />
<br />
*'''Check your web server log files!!''' <br />
:If a particular page is blank or incomplete (it doesn't display the footer), before you do anything else [[Installation_FAQ#How_to_enable_and_check_PHP_error_logs | check your error logs]]. Having established that PHP error logging is working, reproduce the error. Immediately check the error log file right at the end. Hopefully you will see a PHP error message at or very near the end of the file. This may solve your problem directly or makes it a lot easier to diagnose the problem in the Moodle forums.<br />
<br />
*If you are '''upgrading to a new version of Moodle''', check that you do not have an old version of a non-standard block or module installed. Remove any such blocks or modules installed using the admin settings page and start the install process again. However, do also make sure that you have included all optional plugins that were required by your courses. <br />
<br />
*If you '''do not see any blocks listed''', turn editing on and remove any blocks that you have added to that page and try reloading.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
<br />
==Installation hangs when setting-up database tables==<br />
*Sometimes the installation will hang when setting up tables. This will be an abrupt hang with half the page displayed in the browser and/or other outputs removed, e.g. the “Scroll to continue” link is displayed but no “Continue” button is there. If this is the case, it is usually a mysql error and not a php error. Check that there is no limit placed on your mysql database, e.g. a "questions" limit.<br />
<br />
*If the install is on a webhost, adding the following line to the .htaccess file in the moodle directory has been known to solve the problem.<br />
AddType x-mapp-php5 .php<br />
<br />
*Try also renaming the .htaccess file so that it is disabled.<br />
<br />
*You may also want to look and see if you've customized any of your code. Look at the last successful table, and then look at the block, mod, or other code that is referenced by that table. For example, if your install hangs and continues to say that the forum tables were successful as the last message, look at /mod/forum/ for any custom code. If you have customized code, backup those files and replace with the correct files. You can then restart the install by renaming config.php or reinstalling your database from the backup. If your install is successful, you can make your code changes back into the stock Moodle code.<br />
<br />
*It may also be that the "memory_limit" in your php.ini is set too low. Please check your php.ini file and allocate the recommended amount (see [https://docs.moodle.org/en/Installing_Moodle#Requirements Moodle requirements]). For Moodle version 1.8 and above at least 40MB is recommended.<br />
<br />
*A work-around to this problem is to setup a working Moodle system on your local PC or server using the [http://download.moodle.org Moodle Packages]. Once you have a running Moodle, [https://docs.moodle.org/en/Upgrading_Moodle#Backup_important_data backup the database] and import to your webhost. Then backup the Moodle code itself (the "moodle" directory on your PC) and copy this to your webhost using (for example) FTP. Finally, edit the moodle/config.php file for the new settings that have to be changed for the webhost.<br />
<br />
*To avoid this problem when upgrading, prefer to upgrade incrementally. For example: upgrade from 1.6.* to 1.7.* and then to 1.8.* rather than straight from 1.6.* to 1.8.*<br />
<br />
'''Note''': When upgrading an existing database, the installation may appear to hang at the roles generation phase. This process can take a very long time - so please be patient.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==Why can't I upload a new image into my profile?==<br />
<br />
If you don't see anything on your user profile pages to let you upload user images then it's usually because GD is not enabled on your server. GD is a library that allows image processing.<br />
<br />
1. Make sure '''GD has been included in your PHP installation'''. You can check this by going into Administration >> Configuration >> [[Variables]] and looking for the gdversion setting. This setting is chosen automatically every time you visit that page. If it shows GD version 1 or version 2 then everything should be fine. Save that configuration page and go back to your user profile.<br />
<br />
2. If Moodle thinks GD is not installed, then you will need to '''install the GD library'''. <br />
*On Unix you may need to re-compile PHP with arguments something like this:<br />
<br />
./configure --with-apxs=/usr/local/apache/bin/apxs --with-xml --with-gd <br />
--with-jpeg-dir=/usr/local --with-png-dir=/usr --with-ttf --enable-gd-native-ttf <br />
--enable-magic-quotes --with-mysql --enable-sockets --enable-track-vars <br />
--enable-versioning --with-zlib<br />
<br />
* On Windows this is usually a matter of "turning on" the extension in PHP by editing your php.ini file. To do this remove the semicolon for the php_gd2.dll extension - check that this file is actually present in your php extensions folder first (search your php.ini for extension_dir to determine where this points to on your hard disk). You should then have a line that looks like this:<br />
extension=php_gd2.dll<br />
<br />
:Windows users should see the [[Installing AMP|installation instructions]] for further help. <br />
<br />
3. Remember to '''restart your webserver''' (if possible) and re-visit the Moodle configuration page after making any changes to PHP so it can pick up the correct version of GD.<br />
<br />
'''See also''': Using Moodle forum discussion [http://moodle.org/mod/forum/discuss.php?d=44271 Profile pictures] for additional information.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==Why do I keep getting error messages about "headers already sent"?==<br />
<br />
If you see errors like this:<br />
<br />
Warning: Cannot add header information - headers already sent by <br />
(output started at /webs/moodle/config.php:87) in /webs/moodle/lib/moodlelib.php <br />
on line 1322 <br />
<br />
Warning: Cannot add header information - headers already sent by <br />
(output started at /webs/moodle/config.php:87) in /webs/moodle/lib/moodlelib.php <br />
on line 1323 <br />
<br />
Warning: Cannot add header information - headers already sent by <br />
(output started at /webs/moodle/config.php:87) in /webs/moodle/login/index.php <br />
on line 54<br />
<br />
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.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
== Why doesn't my Moodle site display the time and date correctly? ==<br />
<br />
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.<br />
<br />
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)<br />
<br />
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.<br />
<br />
==I receive this error "500:Internal Server Error"==<br />
There are several possible causes for this error:<br />
<br />
1. '''Syntax error''': There is a syntax error in your .htaccess or httpd.conf files. The way in which directives are written [http://httpd.apache.org/docs/1.3/howto/htaccess.html#when differs] depending on which file you are using. You can test for configuration errors in your Apache files using the command:<br />
#apachectl configtest<br />
<br />
2. '''PHPsuexec''': Your server does not support .htaccess files, especially if it is running PHPsuexec, which is an Apache module used for increasing the security of a site on a hosted system. In this situation:<br />
<br />
- you may also see a 403: Forbidden error.<br />
<br />
- the webserver executes under your own username and all files have a maximum permissions level of 755. Check that this is set for your Moodle directory in your control panel or (if you have access to the shell) use this command:<br />
#chmod -R 755 moodle<br />
<br />
- use a PHP.INI file instead of a .htaccess in the directory where the Moodle PHP script is being executed. For example: if you are receiving a memory exhausted error when your server is executing the file moodle/admin/cron.php, use a PHP.INI file to change your memory_limit and copy it to the moodle/admin directory. Remember that PHP.INI files are per-directory, so you'll need to copy it to each sub-directory. The syntax used in a PHP.INI file is different to a .htaccess file and you need to take out php_value/php_flag at the beginning of the line and use an equals sign to assign a value, e.g.<br />
php_value memory_limit 128M <-- .htaccess<br />
memory_limit = 128M <-- php.ini equivalent <br />
<br />
3. '''Incompatible directive''': You may have a directive in your .htaccess or httpd.conf files which are not compatible with your web server version. Check your webserver documentation.<br />
<br />
==I receive this error "403: Forbidden" ==<br />
<br />
Check your webserver configuration. See also the section above I receive this error "500:Internal Server Error".<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
<br />
==How do I uninstall Moodle?==<br />
'''Moodle package installation''': If you have downloaded a Moodle package, simply uninstall using your system commands. On Windows PCs, you should access the Control Panel -> Add/Remove Programs. Select the package name and click Change or Remove Programs.<br />
<br />
'''Webhost/manual installation''': If you have installed Moodle manually or have installed onto a webhost, follow these steps:<br />
*Delete the moodle database using this mysql command (or delete using your mysql client, e.g. PHPMyAdmin):<br />
<pre>sql>DROP DATABASE moodle;</pre><br />
:In the above example replace 'moodle' with the name of the moodle database you created when installing.<br />
*Delete the moodledata directory. If you, or your users, have uploaded materials into this directory take a copy of these before deleting this directory.<br />
*Delete the moodle directory itself. This will delete all of the moodle PHP script files.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==How do I upgrade Moodle? Do I just overwrite the files?==<br />
Do not overwrite files, it may cause strange errors. You should read the [[Upgrade]] documentation before proceeding.<br />
<br />
==Migrating Moodle to a new site or server==<br />
Migrating Moodle means that you have to move the current installation to a new server, and so may have to change IP addresses or DNS entries. To do this you will need to change the $CFG->wwwroot value in the config.php on the new server. You will also have to change any absolute links stored in the database backup file (before restoring the file on the new server) either using the admin/replace.php script, your text editor or another "search and replace" tool, e.g. sed. For more details see the [[Moodle_migration | Moodle Migration]] page.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
<br />
==Fatal error allowed memory size exhausted. How do I increase my php memory limit?==<br />
You will sometimes see an error message something like this:<br />
Fatal error: Allowed memory size of 67108864 bytes exhausted <br />
(tried to allocate xx bytes) in /var/www/moodle/yyyy.php<br />
This error means that the php memory_limit value is not enough for the php script. The memory_limit value is the "allowed memory size" - 64M in the example above (67108864 bytes / 1024 = 65536 KB. 65536 KB / 1024 = 64 MB). You will need to increase the php memory_limit value until this message is not shown anymore. There are two methods of doing this.<br />
*On a hosted installation, add the following line to your .htaccess file (or create one in the moodle directory if it does not already exist):<br />
php_value memory_limit <value>M<br />
Example: php_value memory_limit 40M<br />
*If you have your own server with shell access, edit your php.ini file (make sure it's the correct one by checking in your phpinfo output) as follows:<br />
memory_limit <value>M<br />
Example: memory_limit 40M<br />
Remember that you need to restart your web server to make changes to php.ini effective. An alternative is to disable the memory_limit by using the command ''memory_limit 0''.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==Why does my new installation display correctly on the server, but when I view it from a different machine, styles and images are missing?==<br />
In the installation instructions, one of the suggested settings for 'webroot' is 'localhost'. This is fine if all you want to do is some local testing of your new Moodle installation. If, however, you want to view your new installation from another machine on the same local area network, or view your site on the internet, you will have to change this setting:<br />
*For local testing, 'localhost' is fine for the webroot ($CFG->wwwroot in config.php). <br />
*If you want to test your site from other machines on the same local area network (LAN), then you will have to use the private ip address of the serving machine, (e.g. 192.168.1.2/moodle) or the network name of the serving computer (e.g. network_name_of_serving_machine/moodle) as the web root. Depending on your LAN setup, it may be better to use the network name of the computer rather than its (private) ip address, because the ip address can and will change from time to time. If you don't want to use the network name, then you will have to speak to your network administrator and have them assign a permanent ip address to the serving machine.<br />
*Finally, if you want to test your new installation across the internet, you will have to use either a domain name or a permanent (public) ip address/moodle as your web root. To handle both types of access, see [https://docs.moodle.org/en/masquerading masquerading].<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==Maximum upload file size - how to change it?==<br />
There are several places to change the maximum file upload size. The first place to check is the Administration block. Security -> Site Policies -> and look for "Maximum Uploaded File Size". This is the "maxbyte" variable found in older versions of Moodle (under Admin > Variables). Teachers may also set the maximum file size by the [[Course_settings#Maximum_upload_size|course administration block]].<br />
<br />
The second place to check are the server files. The php.ini file has a limit which will override any other setting. (Hint: remember to restart your server for changes to take effect). For more help see:<br />
*[[Installing_Moodle#Recheck_PHP_settings]]<br />
*[[Installing_Moodle#Using_a_.htaccess_file_for_webserver_and_PHP_settings]]<br />
*[[Site_policies#Maximum_uploaded_file_size]]<br />
<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
<br />
==See also==<br />
[[Category:FAQ]]<br />
[[Category:Installation]]<br />
<br />
[[es:FAQ Instalación]]<br />
[[fr:FAQ d'installation]]<br />
[[nl:Installatie FAQ]]<br />
[[ja:インストールFAQ]]<br />
[[ru:Установка FAQ]]<br />
[[pl:Instalacja FAQ]]</div>Kawhttps://docs.moodle.org/20/en/index.php?title=Installation_FAQ&diff=35031Installation FAQ2008-04-22T06:19:12Z<p>Kaw: /* I receive this error "500:Internal Server Error" */ Update and reformatting</p>
<hr />
<div>{{FAQ}}<br />
==Table of Contents==<br />
__TOC__<br />
<br />
==PHP - is it installed and what version do I have?==<br />
<br />
Make a new file on your web site called ''info.php'', containing the following text, and call it from your browser:<br />
<br />
<?PHP phpinfo() ?><br />
<br />
If nothing happens then you don't have PHP installed or your webserver is not configured to handle .php files properly. See the installation docs for some information about where to download it for your computer. See the [[phpinfo]] page for details about the content of this page.<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
<br />
== System information needed for Installation Forum ==<br />
When posting questions to the installation forum, try to provide as much background information as possible about your moodle system. Use this template to copy and paste into your post:<br />
* Server Operating System name (version also if possible): <br />
* Browser name (version also if possible):<br />
* Moodle version:<br />
* Moodle install type? (New/Upgrade):<br />
* Moodle config.php attached?(Y/N):<br />
* Phpinfo attached? (Y/N):<br />
<br />
For the last two items, try to include the following in your post as an attachment:<br />
* A copy of your phpinfo output as shown in your browser (see the instructions above for an explanation of how to obtain this).<br />
* A copy of the Moodle configuration file. This is located in the directory moodle and is named config.php<br />
<br />
Copy and paste both of these into a single text file (using vi, Notepad, etc) and attach this to your post.<br />
<br />
If you cannot provide your phpinfo, try to copy & paste and complete these in your post:<br />
* Webserver (e.g. Apache/IIS) version:<br />
* Database server (e.g. MySQL, PostgreSQL) version:<br />
* PHP version:<br />
<br />
For installation on web hosting accounts: contact your support desk who should be able to tell you this information.<br />
<br />
: '''Security Warning''': Make sure you edit any files and delete any passwords before posting onto the forum.<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
<br />
==What & where are Moodle's configuration settings stored?==<br />
Configuration settings are stored in the config.php file stored in your moodle folder. This file is created during the installation process. If there is a problem and the installation cannot create the file, you can try creating it manually from the [[Configuration file]] docs. Please remember that manually editing the file is not recommended and may lead to blank pages, especially if there are additional spaces and/or lines after the final php closing tag "?>".<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==Running a health check==<br />
Moodle contains a script that will help identify common php and webserver configuration problems as well as configuration problems. It is a good idea to run this script to check if you are having post-installation problems. Use your browser to run this file:<br />
<br />
http://www.mymoodle.com/moodle/admin/health.php<br />
<br />
Change the above line if you have installed moodle in the webroot instead of a folder inside the webroot.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==Downloading previous releases of Moodle==<br />
* '''Generic Packages''': If your server does not meet the [[Installing_Moodle#Requirements | requirements]] for the current version of Moodle, you can download previous releases by using wget, lynx or curl with this URL:<br />
<nowiki>http://download.moodle.org/stable[version_number]</nowiki> <br />
:For example: to download Moodle version 1.5, use http://download.moodle.org/stable15. You'll see a directory tree with the files displayed. Click on the one you want and download as normal - if you require the latest update of the version, scroll to the end of the list and download the "moodle-latest" file, or alternatively use these URLs for zip or tgz downloads:<br />
<nowiki>http://download.moodle.org/stable[version_number]/moodle-latest-[version_number].zip</nowiki><br />
<nowiki>http://download.moodle.org/stable[version_number]/moodle-latest-[version_number].tgz</nowiki><br />
<br />
:Changes made in the version in the last month are listed in the "CHANGES" file in the directory listing. The files you download contain Moodle code and are not the Windows or Mac packages - so you need to have a webserver, a database server and PHP already installed. The earliest version available is Moodle 1.3.<br />
* '''Windows Packages''': To download previous releases of the Moodle packages for Windows, use this URL:<br />
<nowiki>http://download.moodle.org/windows/MoodleWindowsInstaller-latest-[version_number].zip</nowiki><br />
* '''Mac Packages''': To download previous releases of the Mac pacakges, use either of these URLs (depending on whether you need the Intel or PPC package):<br />
<nowiki>http://download.moodle.org/macosx/Moodle4Mac-Intel-[version_number].dmg</nowiki><br />
<nowiki>http://download.moodle.org/macosx/Moodle4Mac-PPC-[version_number}.dmg</nowiki><br />
* '''Using CVS''': You can also use CVS to download older releases and incremental releases of the Moodle generic packages, e.g. Moodle 1.5.4 - see the [[CVS_for_Administrators | CVS documentation]].<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
== How to enable and check PHP error logs==<br />
PHP can be set up to log errors in a variety of different ways: two of these involve the use of the php.ini file and the ini_set command. <br />
* '''Using the php.ini file''': The log settings are contained in the php.ini file stored on the server. If you don't know where that is, edit your Moodle ''config.php'' and add the following as the second line<br />
<br />
phpinfo();<br />
<br />
:then reload the web page. Look for the entry '''Configuration File (php.ini) Path'''.<br />
<br />
:When you have located php.ini open it in your favorite text editor. Find the '''Error handling and logging''' section of the php.ini file. Make sure that both '''display_errors = On''', '''display_startup_errors = On''' and '''log_errors = On''' are present and uncommented. Check the value of '''error_log''' - this tells you the location of the file errors are logged to. If it is commented out then errors will be sent to the web server error log file. Remember, if you make any changes to this file you will need to restart the web server (or just reboot the server).<br />
<br />
* '''Using ini_set commands''': If you are using Moodle 1.7 or higher, the previous steps are not enough. In those versions error logging parameters are dependant on certain administrative settings that you specify in the debugging section. The problem is that if you can't access the administrative pages, you can't set the debugging options. So the only way to modify them is by adding the following lines to your config.php file, just before the last line (the one containing a single'?>' only):<br />
<br />
ini_set ('display_errors', 'on');<br />
ini_set ('log_errors', 'on');<br />
ini_set ('display_startup_errors', 'on');<br />
ini_set ('error_reporting', E_ALL);<br />
<br />
:This will enable the same settings specified above even if Moodle sets them otherwise. <br />
:'''Important''': Remember to put them just before the last line of config.php.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==Any text I add with an apostrophe (') or a quote (") causes errors or comes up with a slash added==<br />
<br />
Problems caused by apostrophes are caused by incorrect "magic quotes" settings. Moodle requires the following settings in the php.ini file (which are usually the default):<br />
<br />
magic_quotes_gpc = On<br />
magic_quotes_runtime = Off<br />
<br />
Please see [[Installing Moodle]] for more details.<br />
<br />
If you are using [[Debian_GNU/Linux_installation|Debian]] then the problem might be in the version of PHP that you have installed. Have a look at this [http://tracker.moodle.org/browse/MDL-9691 bug report ] to see if it matches your situation.<br />
<br />
==Email copies are not being sent from my forums==<br />
<br />
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.<br />
<br />
Basically, you need to set up a process to regularly call the script <code><nowiki>http://yoursite/admin/cron.php</nowiki></code>. Please refer to the [[Cron|cron instructions]].<br />
<br />
Tips:<br />
* Try the default settings in ''Administration > Server > Email''. This generally works.<br />
*Make sure that ''allowuseremailcharset'' in ''Administration > Server > Email'' is set to No. Setting this to Yes can cause a problem in some versions of Moodle.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
<br />
==Error: database connection failed==<br />
<br />
If you get errors like "database connection failed" or "could not connect to the database you specified", here are some possible reasons and some possible solutions.<br />
<br />
* Your '''database server''' isn't installed or running. To check this for MySQL try typing the following command line<br />
$telnet database_host_name 3306<br />
:You should get a cryptic response which includes the version number of the MySQL server. <br />
* If you are attempting to run '''two instances of Moodle on different ports''', use the ip address of the host (not localhost) in the $CFG->dbhost setting, e.g. $CFG->dbhost = 127.0.0.1:3308.<br />
* You don't have the '''PHP mysql or postgresql extensions''' installed (please refer to FAQ re. whether PHP is installed).<br />
* You haven't created a '''Moodle database and assigned a user''' with the correct privileges to access it. <br />
* The '''Moodle database settings''' are incorrect. The database name, database user or database user password in your Moodle configuration file ''config.php'' are incorrect. Use phpMyAdmin to set up and check your MySQL installation.<br />
* Check that there are '''no apostrophes or non-alphabetic letters''' in your MySQL username or password.<br />
* You are using MySQL version 4.1 or higher but the PHP MySQL extension is pre-4.1 (check in your phpinfo output). In this case the '''default password hashing algorithm''' is incompatible with that available in the PHP mysql extension versions 4.x.x. Use these MySQL commands to change the passwords to the old format:<br />
<br />
mysql>SET PASSWORD FOR 'root'@'localhost' = OLD_PASSWORD('password');<br />
mysql>SET PASSWORD FOR 'moodleuser'@'localhost' = OLD_PASSWORD('password');<br />
<br />
:Also, consider upgrading your PHP MySQL extension. See [http://dev.mysql.com/doc/mysql/en/old-client.html this MySQL document] for further information on how to deal with this problem.<br />
* You are using Fedora core 3 or some other Linux system with '''SELinux installed''' and enabled. See the following URL for information on how to disable SELinux: http://fedora.redhat.com/projects/selinux/ If you don't want to disable SELinux, you have to allow httpd process to create network connections:<br />
<br />
setsebool httpd_can_network_connect true<br />
<br />
* Mac OSX users -- if you are running MySQL on a Mac OSX, try changing '''$CFG->dbhost''' from 'localhost' to '127.0.0.1'<br />
'''See also''': MySQL page on [http://dev.mysql.com/doc/refman/5.0/en/common-errors.html common errors] which lists several possible scenarios for connection failure, with advice on how to fix the problems.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==I can't log in - I just stay stuck on the login screen==<br />
<br />
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].<br />
<br />
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]].<br />
<br />
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>.<br />
<br />
If you are still having problems, read the [[Can_not_log_in | Cannot log in]] page.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==I can't log in with message "Please verify that the current setting of session.save_path is correct" ==<br />
<br />
This error occurs when PHP is having problems saving its session files. You may also see these other error messages displayed on the screen or in your log files:<br />
<br />
Warning: Unknown: open(some-path/sessions/sess_acbf942a7399db3489ffa910e35d5242, O_RDWR)<br />
failed: Permission denied (13) in Unknown on line 0<br />
<br />
Warning: Unknown(): open(some-path/sessions/sess_acbf942a7399db3489ffa910e35d5242, O_RDWR) <br />
failed: No space left on device (28) in Unknown on line 0<br />
<br />
Warning: Unknown: Failed to write session data (files). Please verify that the current <br />
setting of session.save_path is correct (some-path/sessions) in Unknown on line 0 <br />
<br />
To temporarily bypass these errors, '''use database sessions''' by editing your [[Configuration_file | moodle configuration file]] and adding this line:<br />
<br />
$CFG->dbsessions = true;<br />
<br />
Database sessions may overload your mysql database and are not ideal in a shared hosting environment, so if this solves the problem, you can start fixing the problem as follows:<br />
* Check '''access rights'''. The session.save_path should be accessible by the apache user. Try this command:<br />
<br />
chown -R apache:apache some-path/sessions<br />
<br />
:This assumes that 'apache' is the name of the user your webserver runs under - it could also be 'nobody'.<br />
* Check the '''permissions''' to the directory that PHP is trying to save to (session.save_path = some-path/sessions). Set the permissions initially to 0777 (everyone read, write, execute) with this command:<br />
<br />
chmod -R 0777 some-path/sessions<br />
<br />
:If this fixes the problem, reduce the permissions (700 is recommended).<br />
<br />
'''See also''': Session problems can be specific to your server environment. As an example, see [http://moodle.org/mod/forum/discuss.php?d=55925#254596 this forum discussion] about session problems with Lycos hosting.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==I log in but the login link doesn't change. I am logged in and can navigate freely.==<br />
<br />
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.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==I keep getting this error: A server error that affects your login session was detected.==<br />
<br />
Please refer to the Using Moodle forum discussion [http://moodle.org/mod/forum/discuss.php?d=73716 A server error that affects your login session was detected. Please login again or restart your browser.].<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==I keep getting this error: Failed opening required '/web/moodle/lib/setup.php'==<br />
<br />
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.<br />
<br />
Sometimes people only use the path from their home directory, or relative to the root of the web server directory.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==My pages show fatal errors such as : Parse error, call to undefined function: get_string()==<br />
<br />
If you see errors like:<br />
<br />
Parse error: parse error, unexpected T_VARIABLE in /path/to/moodle/config.php on line 94 <br />
Fatal error: Call to undefined function: get_string() in /path/to/moodle/mod/resource/lib.php<br />
on line 11<br />
<br />
then you have probably left out a semi-colon or closing quote from a line in ''config.php'' (previous to line 94).<br />
<br />
Another possibility is that you edited ''config.php'' in a program like Word and saved it as a HTML web page, instead of using a plain text editor like Notepad.<br />
<br />
Another thing to check, particularly if you are using 3rd party modules or plugins, is whether any of the php scripts use short open tags (<? ?>) instead of proper ones (<?php ?>). Short tags are bad for various reasons, so first contact the author of that extension to tell them about the problem. Then either replace short tags with conventional ones, or set this line in php.ini:<br />
<br />
short_open_tag = On<br />
<br />
You should never find short tags in core moodle code. If you do, please file a bug in the bug tracker.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==Serious Error! Could not set up the site!==<br />
<br />
Please refer to the Using Moodle forum discussion [http://moodle.org/mod/forum/discuss.php?d=32071 Serious Error! Could not set up the site!].<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==Uploaded files give "File not found"==<br />
<br />
For example: Not Found: The requested URL /moodle/file.php/2/myfile.jpg was not found on this server.<br />
<br />
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):<br />
<br />
'''AcceptPathInfo''' on<br />
<br />
Note, this will ONLY work for Apache versions 2.x.<br />
<br />
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.<br />
<br />
To use this alternative method, you should change the ''slasharguments'' variable. For moodle versions < 1.7, this is located in the Operating System section of ''Administration > Configuration > [[admin/config|Variables]]''. In later versions, this option is located in ''Site Administration > Server > HTTP''. You should now be able to access your uploaded files.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
<br />
==When I go to the admin page, I get told to make dirroot blank!==<br />
<br />
If you see errors like this:<br />
<br />
Please fix your settings in config.php: <br />
You have: $CFG->dirroot = "/home/users/fred/public_html/moodle"; <br />
but it should be: $CFG->dirroot = "";<br />
<br />
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'':<br />
<br />
if ($dirroot != $CFG->dirroot) {<br />
<br />
and change it to this:<br />
<br />
if (!empty($dirroot) and $dirroot != $CFG->dirroot) {<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==When trying to add a resource I receive error messages==<br />
<br />
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]].<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==Why are all my pages blank?==<br />
<br />
Check the dirroot variable in ''config.php''. You must use complete, absolute pathnames e.g.<br />
<br />
$CFG->dirroot = "d:\inetpub\sites\www.yoursite.com\web\moodle";<br />
<br />
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 enable PHP error displays, set these lines in your ''php.ini'' file and reload the web page.<br />
<br />
display_errors = On<br />
display_startup_errors = On<br />
<br />
To determine if MySQL support is your problem, insert this as the second line in your ''config.php'' file<br />
<br />
phpinfo();<br />
<br />
then reload the web page. Examine the output closely to see if MySQL is supported. If not look for a package you are missing.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
== Why is a particular page blank or incomplete? ==<br />
<br />
*'''Check your web server log files!!''' <br />
:If a particular page is blank or incomplete (it doesn't display the footer), before you do anything else [[Installation_FAQ#How_to_enable_and_check_PHP_error_logs | check your error logs]]. Having established that PHP error logging is working, reproduce the error. Immediately check the error log file right at the end. Hopefully you will see a PHP error message at or very near the end of the file. This may solve your problem directly or makes it a lot easier to diagnose the problem in the Moodle forums.<br />
<br />
*If you are '''upgrading to a new version of Moodle''', check that you do not have an old version of a non-standard block or module installed. Remove any such blocks or modules installed using the admin settings page and start the install process again. However, do also make sure that you have included all optional plugins that were required by your courses. <br />
<br />
*If you '''do not see any blocks listed''', turn editing on and remove any blocks that you have added to that page and try reloading.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
<br />
==Installation hangs when setting-up database tables==<br />
*Sometimes the installation will hang when setting up tables. This will be an abrupt hang with half the page displayed in the browser and/or other outputs removed, e.g. the “Scroll to continue” link is displayed but no “Continue” button is there. If this is the case, it is usually a mysql error and not a php error. Check that there is no limit placed on your mysql database, e.g. a "questions" limit.<br />
<br />
*If the install is on a webhost, adding the following line to the .htaccess file in the moodle directory has been known to solve the problem.<br />
AddType x-mapp-php5 .php<br />
<br />
*Try also renaming the .htaccess file so that it is disabled.<br />
<br />
*You may also want to look and see if you've customized any of your code. Look at the last successful table, and then look at the block, mod, or other code that is referenced by that table. For example, if your install hangs and continues to say that the forum tables were successful as the last message, look at /mod/forum/ for any custom code. If you have customized code, backup those files and replace with the correct files. You can then restart the install by renaming config.php or reinstalling your database from the backup. If your install is successful, you can make your code changes back into the stock Moodle code.<br />
<br />
*It may also be that the "memory_limit" in your php.ini is set too low. Please check your php.ini file and allocate the recommended amount (see [https://docs.moodle.org/en/Installing_Moodle#Requirements Moodle requirements]). For Moodle version 1.8 and above at least 40MB is recommended.<br />
<br />
*A work-around to this problem is to setup a working Moodle system on your local PC or server using the [http://download.moodle.org Moodle Packages]. Once you have a running Moodle, [https://docs.moodle.org/en/Upgrading_Moodle#Backup_important_data backup the database] and import to your webhost. Then backup the Moodle code itself (the "moodle" directory on your PC) and copy this to your webhost using (for example) FTP. Finally, edit the moodle/config.php file for the new settings that have to be changed for the webhost.<br />
<br />
*To avoid this problem when upgrading, prefer to upgrade incrementally. For example: upgrade from 1.6.* to 1.7.* and then to 1.8.* rather than straight from 1.6.* to 1.8.*<br />
<br />
'''Note''': When upgrading an existing database, the installation may appear to hang at the roles generation phase. This process can take a very long time - so please be patient.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==Why can't I upload a new image into my profile?==<br />
<br />
If you don't see anything on your user profile pages to let you upload user images then it's usually because GD is not enabled on your server. GD is a library that allows image processing.<br />
<br />
1. Make sure '''GD has been included in your PHP installation'''. You can check this by going into Administration >> Configuration >> [[Variables]] and looking for the gdversion setting. This setting is chosen automatically every time you visit that page. If it shows GD version 1 or version 2 then everything should be fine. Save that configuration page and go back to your user profile.<br />
<br />
2. If Moodle thinks GD is not installed, then you will need to '''install the GD library'''. <br />
*On Unix you may need to re-compile PHP with arguments something like this:<br />
<br />
./configure --with-apxs=/usr/local/apache/bin/apxs --with-xml --with-gd <br />
--with-jpeg-dir=/usr/local --with-png-dir=/usr --with-ttf --enable-gd-native-ttf <br />
--enable-magic-quotes --with-mysql --enable-sockets --enable-track-vars <br />
--enable-versioning --with-zlib<br />
<br />
* On Windows this is usually a matter of "turning on" the extension in PHP by editing your php.ini file. To do this remove the semicolon for the php_gd2.dll extension - check that this file is actually present in your php extensions folder first (search your php.ini for extension_dir to determine where this points to on your hard disk). You should then have a line that looks like this:<br />
extension=php_gd2.dll<br />
<br />
:Windows users should see the [[Installing AMP|installation instructions]] for further help. <br />
<br />
3. Remember to '''restart your webserver''' (if possible) and re-visit the Moodle configuration page after making any changes to PHP so it can pick up the correct version of GD.<br />
<br />
'''See also''': Using Moodle forum discussion [http://moodle.org/mod/forum/discuss.php?d=44271 Profile pictures] for additional information.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==Why do I keep getting error messages about "headers already sent"?==<br />
<br />
If you see errors like this:<br />
<br />
Warning: Cannot add header information - headers already sent by <br />
(output started at /webs/moodle/config.php:87) in /webs/moodle/lib/moodlelib.php <br />
on line 1322 <br />
<br />
Warning: Cannot add header information - headers already sent by <br />
(output started at /webs/moodle/config.php:87) in /webs/moodle/lib/moodlelib.php <br />
on line 1323 <br />
<br />
Warning: Cannot add header information - headers already sent by <br />
(output started at /webs/moodle/config.php:87) in /webs/moodle/login/index.php <br />
on line 54<br />
<br />
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.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
== Why doesn't my Moodle site display the time and date correctly? ==<br />
<br />
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.<br />
<br />
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)<br />
<br />
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.<br />
<br />
==I receive this error "500:Internal Server Error"==<br />
There are several possible causes for this error:<br />
<br />
1. '''Syntax error''': There is a syntax error in your .htaccess or httpd.conf files. The way in which directives are written [http://httpd.apache.org/docs/1.3/howto/htaccess.html#when differs] depending on which file you are using. You can test for configuration errors in your Apache files using the command:<br />
#apachectl configtest<br />
<br />
2. '''PHPsuexec''': Your server does not support .htaccess files, especially if it is running PHPsuexec, which is an Apache module used for increasing the security of a site on a hosted system. In this situation:<br />
<br />
- you may also see a 403: Forbidden error.<br />
<br />
- the webserver executes under your own username and all files have a maximum permissions level of 755. Check that this is set for your Moodle directory in your control panel or (if you have access to the shell) use this command:<br />
#chmod -R 755 moodle<br />
<br />
- use a PHP.INI file instead of a .htaccess in the directory where the Moodle PHP script is being executed. For example: if you are receiving a memory exhausted error when your server is executing the file moodle/admin/cron.php, use a PHP.INI file to change your memory_limit and copy it to the moodle/admin directory. Remember that PHP.INI files are per-directory, so you'll need to copy it to each sub-directory. The syntax used in a PHP.INI file is different to a .htaccess file and you need to take out php_value/php_flag at the beginning of the line and use an equals sign to assign a value, e.g.<br />
php_value memory_limit 128M <-- .htaccess<br />
memory_limit = 128M <-- php.ini equivalent <br />
<br />
3. '''Incompatible directive''': You may have a directive in your .htaccess or httpd.conf files which are not compatible with your web server version. Check your webserver documentation.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
<br />
==How do I uninstall Moodle?==<br />
'''Moodle package installation''': If you have downloaded a Moodle package, simply uninstall using your system commands. On Windows PCs, you should access the Control Panel -> Add/Remove Programs. Select the package name and click Change or Remove Programs.<br />
<br />
'''Webhost/manual installation''': If you have installed Moodle manually or have installed onto a webhost, follow these steps:<br />
*Delete the moodle database using this mysql command (or delete using your mysql client, e.g. PHPMyAdmin):<br />
<pre>sql>DROP DATABASE moodle;</pre><br />
:In the above example replace 'moodle' with the name of the moodle database you created when installing.<br />
*Delete the moodledata directory. If you, or your users, have uploaded materials into this directory take a copy of these before deleting this directory.<br />
*Delete the moodle directory itself. This will delete all of the moodle PHP script files.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==How do I upgrade Moodle? Do I just overwrite the files?==<br />
Do not overwrite files, it may cause strange errors. You should read the [[Upgrade]] documentation before proceeding.<br />
<br />
==Migrating Moodle to a new site or server==<br />
Migrating Moodle means that you have to move the current installation to a new server, and so may have to change IP addresses or DNS entries. To do this you will need to change the $CFG->wwwroot value in the config.php on the new server. You will also have to change any absolute links stored in the database backup file (before restoring the file on the new server) either using the admin/replace.php script, your text editor or another "search and replace" tool, e.g. sed. For more details see the [[Moodle_migration | Moodle Migration]] page.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
<br />
==Fatal error allowed memory size exhausted. How do I increase my php memory limit?==<br />
You will sometimes see an error message something like this:<br />
Fatal error: Allowed memory size of 67108864 bytes exhausted <br />
(tried to allocate xx bytes) in /var/www/moodle/yyyy.php<br />
This error means that the php memory_limit value is not enough for the php script. The memory_limit value is the "allowed memory size" - 64M in the example above (67108864 bytes / 1024 = 65536 KB. 65536 KB / 1024 = 64 MB). You will need to increase the php memory_limit value until this message is not shown anymore. There are two methods of doing this.<br />
*On a hosted installation, add the following line to your .htaccess file (or create one in the moodle directory if it does not already exist):<br />
php_value memory_limit <value>M<br />
Example: php_value memory_limit 40M<br />
*If you have your own server with shell access, edit your php.ini file (make sure it's the correct one by checking in your phpinfo output) as follows:<br />
memory_limit <value>M<br />
Example: memory_limit 40M<br />
Remember that you need to restart your web server to make changes to php.ini effective. An alternative is to disable the memory_limit by using the command ''memory_limit 0''.<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==Why does my new installation display correctly on the server, but when I view it from a different machine, styles and images are missing?==<br />
In the installation instructions, one of the suggested settings for 'webroot' is 'localhost'. This is fine if all you want to do is some local testing of your new Moodle installation. If, however, you want to view your new installation from another machine on the same local area network, or view your site on the internet, you will have to change this setting:<br />
*For local testing, 'localhost' is fine for the webroot ($CFG->wwwroot in config.php). <br />
*If you want to test your site from other machines on the same local area network (LAN), then you will have to use the private ip address of the serving machine, (e.g. 192.168.1.2/moodle) or the network name of the serving computer (e.g. network_name_of_serving_machine/moodle) as the web root. Depending on your LAN setup, it may be better to use the network name of the computer rather than its (private) ip address, because the ip address can and will change from time to time. If you don't want to use the network name, then you will have to speak to your network administrator and have them assign a permanent ip address to the serving machine.<br />
*Finally, if you want to test your new installation across the internet, you will have to use either a domain name or a permanent (public) ip address/moodle as your web root. To handle both types of access, see [https://docs.moodle.org/en/masquerading masquerading].<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
==Maximum upload file size - how to change it?==<br />
There are several places to change the maximum file upload size. The first place to check is the Administration block. Security -> Site Policies -> and look for "Maximum Uploaded File Size". This is the "maxbyte" variable found in older versions of Moodle (under Admin > Variables). Teachers may also set the maximum file size by the [[Course_settings#Maximum_upload_size|course administration block]].<br />
<br />
The second place to check are the server files. The php.ini file has a limit which will override any other setting. (Hint: remember to restart your server for changes to take effect). For more help see:<br />
*[[Installing_Moodle#Recheck_PHP_settings]]<br />
*[[Installing_Moodle#Using_a_.htaccess_file_for_webserver_and_PHP_settings]]<br />
*[[Site_policies#Maximum_uploaded_file_size]]<br />
<br />
<br />
[[Installation_FAQ#Table_of_Contents|Table of Contents]]<br />
<br />
==See also==<br />
[[Category:FAQ]]<br />
[[Category:Installation]]<br />
<br />
[[es:FAQ Instalación]]<br />
[[fr:FAQ d'installation]]<br />
[[nl:Installatie FAQ]]<br />
[[ja:インストールFAQ]]<br />
[[ru:Установка FAQ]]<br />
[[pl:Instalacja FAQ]]</div>Kawhttps://docs.moodle.org/20/en/index.php?title=Upgrading&diff=34949Upgrading2008-04-20T12:08:03Z<p>Kaw: /* 3. Your database */ Added MySQL Admin in 1.9</p>
<hr />
<div>Moodle is designed to upgrade cleanly from one version to the next. Please refer to [[Upgrading to Moodle 1.6]], [[Upgrading to Moodle 1.7]], [[Upgrading to Moodle 1.8]] or [[Upgrading to Moodle 1.9]] for particular considerations related to the upgraded version. <br />
<br />
Changes that have been made to the original code, such as installing a contributed module (non-standard module) or a site edit of a php file, may not upgrade. This includes modifications to standard themes, that will be overwritten during an upgrade.<br />
__TOC__<br />
When upgrading a Moodle installation you should follow these steps:<br />
<br />
==Check the requirements==<br />
Spend some time re-reading the [[Installing Moodle | installation documentation]] and documentation for the new version. Check the system requirements for the version you are upgrading to in ''Administration > Server > [[Environment]]''.<br />
<br />
== Backup important data ==<br />
<br />
Although it is not strictly necessary, it is always a good idea to make a backup of any production system before a major upgrade, just in case you need to revert back to the older version for some reason. In fact, it's a good idea to automate your server to backup your Moodle installation daily, so that you can skip this step.<br />
<br />
There are three areas that need backing up:<br />
<br />
=== 1. The Moodle software directory itself ===<br />
<br />
Make a separate copy of these files before the upgrade, so that you can retrieve your config.php and any modules you have added like themes, languages etc<br />
<br />
=== 2. Your data directory ===<br />
<br />
This is where uploaded content resides (such as course resources and student assignments) so it is very important to have a backup of these files anyway. Sometimes upgrades may move or rename directories within your data directory.<br />
<br />
=== 3. Your database ===<br />
<br />
Most Moodle upgrades will alter the database tables, adding or changing fields. Each database has different ways to backup. One way of backing up a MySQL database is to 'dump' it to a single SQL file. The following example shows Unix commands to dump the database called "moodle":<br />
<br />
mysqldump -u username -p -C -Q -e -a moodle > moodle-backup-2007-04-01.sql<br />
(The "-a" switch is deprecated and should be replaced by "--create-options")<br />
<br />
Substitute your database user account for username. The -p flag will prompt you for the password for the username specified by -u.<br />
<br />
If your database host is different from the host you want to execute the backup command (usually the web server), you have to specify it with the -h option to mysqldump:<br />
<br />
mysqldump -u username -p -h databasehost -C -Q -e -a moodle > moodle-backup-2007-04-01.sql <br />
<br />
You can also use the "Export" feature in Moodle's optional "MySQL Admin" web interface to do the same thing on all platforms. In Moodle v1.9 and greater, this is located in '''Site Administration''' -> '''Server''' -> '''Database'''. This interface can also be downloaded from http://download.moodle.org/modules/integrations.php. It is an integration of PHPMyAdmin for the Moodle administration interface.<br />
<br />
== Install the new Moodle software ==<br />
<br />
=== Using a downloaded archive ===<br />
<br />
@Do not overwrite an old installation unless you know what you are doing ... sometimes old files can cause problems in new installations. The best way is to rename the current Moodle directory to something else, then unpack the new Moodle archive into the old location.<br />
<br />
Linux<br />
mv moodle moodle.backup<br />
tar xvzf moodle-1.1.tgz<br />
<br />
Next, copy across your config.php, any other plugins such as custom themes, and your .htaccess file if you created one:<br />
<br />
cp moodle.backup/config.php moodle<br />
cp -pr moodle.backup/theme/mytheme moodle/theme/mytheme<br />
<br />
=== Using CVS ===<br />
<br />
You can use CVS for updating or upgrading your Moodle.<br />
First you need to do a CVS checkout in your (empty) Moodle root directory.<br />
<br />
You can use any of our [[CVS_for_Administrators#CVS_Servers|CVS Mirror servers]]. Just replace '''SERVER.cvs.moodle.org''' in the instructions below with the name of the mirror server you chose!.<br />
<br />
'''For Linux servers'''<br />
<br />
To do a CVS checkout of Moodle, you first have to logon to the Moodle CVS server.<br />
<br />
<nowiki>cvs -d:pserver:anonymous@SERVER.cvs.moodle.org:/cvsroot/moodle login</nowiki><br />
No password for anonymous, so just hit the Enter button.<br />
<br />
Go to the directory where you want the Moodle root to come and type<br />
<br />
<nowiki>cvs -z3 -d:pserver:anonymous@SERVER.cvs.moodle.org:/cvsroot/moodle co -r MOODLE_18_STABLE moodle</nowiki> <br />
(where MOODLE_18_STABLE is the desired version)<br />
<br />
To update, just go into the Moodle root directory and update to the new files:<br />
<br />
cvs update -dP<br />
To update to a new version type in the following and change 18 to whatever newest version upgrade number is<br />
cvs -Q update -dP -r MOODLE_18_STABLE<br />
<br />
Make sure you use the "d" parameter to create new directories if necessary, and the "P" parameter to prune empty directories.<br />
<br />
'''For Windows servers'''<br />
<br />
You can use Tortoise CVS to do the initial checkout and the updates.<br />
<br />
If you have been editing Moodle files, watch the messages very closely for possible conflicts. All your customised themes and non-standard plugins will be untouched.<br />
<br />
Don't forget to visit the admin page after the CVS update process has completed.<br />
<br />
== Finishing the upgrade ==<br />
<br />
The last step is to trigger the upgrade processes within Moodle.<br />
<br />
To do this just visit the admin page of your installation e.g. ''<nowiki>http://example.com/moodle/admin</nowiki>''<br />
<br />
It doesn't matter if you are logged in as admin or not. If you are upgrading from some older versions you would not be able to login before the upgrade anyway.<br />
<br />
Moodle will automatically detect the new version and perform all the database or filesystem upgrades that are necessary. If there is anything it can't do itself (very rare) then you will see messages telling you what you need to do.<br />
<br />
Assuming all goes well (no error messages) then you can start using your new version of Moodle and enjoy the new features!<br />
<br />
Please note that if you are running a large scale of moodle site (e.g. have more tha 10,000+ courses and 40,000+ users), make sure that you do your own performance profiling testing before you upgrade to Moodle 1.8.x, as there are still quite a few outstanding (unresolved) performance issues in 1.8.x for large user base installations.<br />
<br />
== Verify the upgrade (optional) ==<br />
<br />
If you wish to confirm that the database definitions in the upgraded database match the definitions of a new, clean install (which they should) you might like to look at [[Verify Database Schema]].<br />
<br />
==See also==<br />
<br />
*Using Moodle [http://moodle.org/mod/forum/view.php?id=28 Installation problems] forum<br />
*[[Upgrading to Moodle 1.6]]<br />
*[[Installing Moodle]]<br />
*[[Installation FAQ]]<br />
*[http://otaru-jc.ac.jp/hagley/howtoupgrademoodlewithcpanel.swf How to upgrade Moodle with cpanel tutorial]<br />
*[http://youtube.com/watch?v=ufAmf_jm_p8 How to backup a whole Moodle site video]<br />
*Using Moodle forum discussions: [http://moodle.org/mod/forum/discuss.php?d=26731&parent=125858 Using cvs], [http://moodle.org/mod/forum/discuss.php?d=56915 Upgrading from 1.5.2 to 1.7], [http://moodle.org/mod/forum/discuss.php?d=56991 Upgrade nightmares.... any help appreciated], [http://moodle.org/mod/forum/discuss.php?d=62463 After upgrading i get "Your site may not be secure." msg]<br />
<br />
[[Category:Installation]]<br />
<br />
[[es:Actualización de moodle]]<br />
[[fr:Mise à jour]]<br />
[[ja:アップグレード]]<br />
[[nl:Upgraden]]<br />
[[zh:升级]]<br />
[[pl:Aktualizacja]]</div>Kawhttps://docs.moodle.org/20/en/index.php?title=Administrator_documentation&diff=34918Administrator documentation2008-04-17T14:33:35Z<p>Kaw: /* System-specific Instructions & Packages */ Added Vista installation link</p>
<hr />
<div>The purpose of this page is to list useful links by general topics for administrators.<br />
<br />
== Installation & Upgrading ==<br />
<br />
*[[Installation Quickstart]] for an overview of the installation steps<br />
*[[Installing Moodle]] for detailed installation instructions<br />
*[[Installation FAQ]]<br />
*[[Installing AMP|Installing Apache, MySQL and PHP]]<br />
*[[Upgrading|Upgrading Moodle]]<br />
<br />
== System-specific Instructions & Packages ==<br />
<br />
* [[SUSE Linux Server 10|Automated Installation Guide for SUSE Linux Enterprise Server 10]] operating system<br />
* [[RedHat Linux installation|Step by Step Installation Guide for RedHat]] operating system<br />
* [[Debian GNU/Linux installation|Step by Step Installation Guide for Debian GNU/Linux]] operating system<br />
* [[Step-by-step Install Guide for Ubuntu]]<br />
* [[Windows installation|Complete Install Packages for Windows XP and instructions for Windows NT/2000/2003 servers]]<br />
* [[Installing Moodle on Windows Vista]]<br />
* [[Complete Install Packages for Mac OS X | Complete Install Packages for Mac OS X 10.3/10.4/10.5]]<br />
* [[Step-by-step Guide for Installing Moodle on Mac OS X 10.4 Client|Step by Step Installation on a Mac OS X 10.4 Client using the internal web server]]<br />
* [[Step by Step Installation on a Mac OS X 10.5 Server]]<br />
* [[1and1_MySQL_installation | Installation on 1and1 web hosting]]<br />
* [[OLPC XS installation|Step by Step Installation Guide for the One Laptop per Child XS Server (Beta)]]<br />
<br />
==Security, Performance and Roles==<br />
<br />
*[[Security]] contains important security procedures for a production site<br />
*[[Performance | Performance and optimization]] for ideas on improving the speed of your installation<br />
*[[Manage roles | Managing roles]] For Moodle 1.7 and later.<br />
*[[suhosin]] is an advanced protection system for PHP installation. It was designed to protect servers and users from known and unknown flaws in PHP applications and the PHP core.<br />
<br />
== FAQs ==<br />
<br />
*[[Installation FAQ]]<br />
*[[Administration FAQ]]<br />
*[[Backup FAQ]]<br />
<br />
== Configuration Settings ==<br />
*[[Site administration block]] contains configuration setting links<br />
*[[Notification page]] used to update versions<br />
*[[Variables]]<br />
*[[Site settings]]<br />
*[[Themes]]<br />
*[[Language]]<br />
*[[Activity modules administration]]<br />
*[[Blocks administration]]<br />
*[[Filters]]<br />
*[[Backup settings]]<br />
*[[HTML editor settings]]<br />
*[[Calendar settings]]<br />
*[[Maintenance mode]]<br />
<br />
* See also: [[Location of admin settings in 1.7|Comparison between configuration settings in Moodle 1.6 & 1.7]]<br />
<br />
==User Management==<br />
<br />
*[[Authentication]]<br />
*[[Edit user accounts]] <br />
*[[Add new user|Add a new user]] - on a site<br />
*[[Flat file|Upload users]] - from a file to a site<br />
*[[Enrolment plugins]]<br />
*[[Roles and capabilities|Assigning user a role]] - typical assignments include:<br />
**[[Students|Enrol students in a course]]<br />
**[[Courses (administrator)|Assign teachers]] - to a course<br />
**[[Assign creators|Assign course creators]] - in a site<br />
**[[Assign administrators]] - in a site<br />
<br />
==Other==<br />
<br />
*[[Courses (administrator)|Courses]] and [[Course formats|course formats]]<br />
*[[Reports (administrator)]] and [[Logs]]<br />
*[[Site files]]<br />
*[[Moodle database|Database]]<br />
*[[Environment]]<br />
*[[Moodle Network]] and Moodle Community Hub<br />
*[[Streaming Media]]<br />
*[[Case studies (administrator)]]<br />
*[[Anti-virus]]<br />
*[[System Monitoring and Server Statistic Software]]<br />
<br />
==See also==<br />
<br />
*[[:Category:Administrator | Index of all Administrator-related pages]]<br />
*[[Integrations]]<br />
*[[CVS for Administrators]]<br />
*[[Email processing]]<br />
*[[Search engine optimization]]<br />
*[[Messaging]]<br />
*[[Migration]]<br />
*[[Metacourses]]<br />
*[[Block layout]]<br />
*[[Customizing Moodle]]<br />
*[[Administrator do's and don'ts]]<br />
*[http://download.moodle.org/docs/using_moodle/ch16_server_admin.pdf Using Moodle Chapter 16: Moodle Administration]<br />
<br />
[[Category: Administrator]]<br />
[[cs:Rukověť správce]]<br />
[[es:Documentación para Administradores]]<br />
[[eu:Kudeatzaileentzako dokumentazioa]]<br />
[[fr:Documentation administrateur]]<br />
[[ja:管理者ドキュメント]]<br />
[[ko:관리자 문서]]<br />
[[nl:Documentatie voor beheerders]]<br />
[[pt:Documentação para administradores]]<br />
[[ru:Администраторам]]<br />
[[zh:管理员文档]]<br />
[[pl:Administrator documentation]]</div>Kawhttps://docs.moodle.org/20/en/index.php?title=PHP_info&diff=34522PHP info2008-04-03T21:56:49Z<p>Kaw: /* Displaying phpinfo */ Completed contents</p>
<hr />
<div>Location: ''Administration > Server > PHP info''<br />
<br />
The phpinfo display contains information about the configuration of your PHP installation. This is useful for checking:<br />
* that your PHP installation meets Moodle's system requirements.<br />
* that you have installed the required modules needed for Moodle to work, e.g. the LDAP module for LDAP authentication.<br />
<br />
==Displaying phpinfo==<br />
To view the phpinfo information:<br />
* In Moodle version 1.7 or greater, choose Site Administration -> Server -> PHP info.<br />
* Create a file called info.php using your text editor, containing this single line:<br />
<br />
<?php phpinfo(); ?><br />
<br />
* Upload this file into your moodle folder on your PC or server.<br />
* Now open this file in your browser. For example <nowiki>http://127.0.0.1/info.php</nowiki>.<br />
<br />
==Sample output==<br />
This is a sample output displayed:<br />
<br />
<table border="0" cellpadding="3" width="600"><br />
<tr class="h"><td><br />
[http://www.php.net/ http://www.php.net]<br />
=PHP Version 4.3.3=<br />
</td></tr><br />
</table><br/><br />
<table border="0" cellpadding="3" width="600"><br />
<tr><td class="e">System </td><td class="v">Windows NT MYLAPTOP0106 5.1 build 2600 </td></tr><br />
<tr><td class="e">Build Date </td><td class="v">Aug 24 2003 22:01:16 </td></tr><br />
<tr><td class="e">Server API </td><td class="v">Apache </td></tr><br />
<tr><td class="e">Virtual Directory Support </td><td class="v">enabled </td></tr><br />
<tr><td class="e">Configuration File (php.ini) Path </td><td class="v">C:\WINDOWS\php.ini </td></tr><br />
<tr><td class="e">PHP API </td><td>20020918 </td></tr><br />
<tr><td class="e">PHP Extension </td><td>20020429 </td></tr><br />
<tr><td class="e">Zend Extension </td><td>20021010 </td></tr><br />
<tr><td class="e">Debug Build </td><td>no </td></tr><br />
<tr><td class="e">Thread Safety </td><td>enabled </td></tr><br />
<tr><td class="e">Registered PHP Streams </td><td>php, http, ftp, compress.zlib</td></tr><br />
</table><br />
<br />
...<br />
This output goes on for about 5 pages.<br />
<br />
[[es:phpinfo]]<br />
[[pt:phpinfo]]<br />
[[pl:phpinfo]]<br />
<br />
[[Category:Developer|Phpinfo]]<br />
[[Category:Administrator]]</div>Kawhttps://docs.moodle.org/20/en/index.php?title=Installing_Moodle&diff=34471Installing Moodle2008-04-03T08:58:44Z<p>Kaw: /* Set up cron */ Clarification</p>
<hr />
<div>'''Firstly don't panic! :-)'''<br />
<br />
This guide explains how to install Moodle for the first time. For some of these steps it goes into a lot of detail to try and cover the majority of possible web server setups, so this page may look long and complicated. Don't panic, once you know how to do it you can install Moodle in minutes!<br />
<br />
If you have problems please read this page carefully - most common issues are answered in here. If you still have trouble, you can seek help from the Moodle community via [http://moodle.org/course/view.php?id=5 moodle.org Using Moodle].<br />
<br />
Another option is to contact a [http://moodle.com/hosting/ Moodle Partner providing Moodle hosting] who can completely maintain Moodle for you, so that you can ignore all this and get straight into educating! A Moodle partner is the preferred option but if you decide to choose a hosting company that has cpanel then [http://otaru-jc.ac.jp/hagley/settingupmoodleonhostingwithcpanel.swf this tutorial will guide you] through the process of choosing a host and setting up moodle via cpanel. <br />
<br />
'''Warning:''' some hosting companies offer one-click moodle install options, which whilst sometimes effective, usually use old (sometimes years old) versions of moodle and sometimes simply don't work. If one of these goes wrong, your best bet is often to start from scratch following the instructions here yourself. Its almost certainly quicker.<br />
<br />
If you want to run Moodle on your own computer and this page looks a bit daunting, then please see our guides: [[Installing AMP |Installing Apache, MySQL and PHP(AMP)]] or [[Complete install packages| how to install one of Moodle's complete packages]]. They provide alternative instructions to install all this on most popular platforms.<br />
==Table of Contents==<br />
__TOC__<br />
<br />
==Requirements==<br />
<br />
Moodle is primarily developed in Linux using [[Apache]], [[MySQL]] and [[PHP]] (also sometimes known as the LAMP platform), but is also regularly tested with Windows XP/2000/2003 (WAMP), Solaris 10 (Sparc and x64), Mac OS X and Netware 6 operating systems. Support for PostgreSQL, Oracle and Microsoft SQL Server is also available.<br />
<br />
'''Blank page problem while installing Moodle on Windows Vista may occur; following these steps: [[Installing Moodle on Windows Vista]] might help.<br />
<br />
'''Note if you are using a hosted account''': Most web hosts support all of these requirements by default. You should contact your web host's support desk to check that this is the case '''before''' signing-up with them. It is especially important to ask about any PHP memory limits or MySQL question limits. If your prospective host does not provide a service which meets these requirements, or you are already signed up with them, ask them why and consider taking your business elsewhere if they do not change.<br />
<br />
The requirements for Moodle are as follows:<br />
<br />
'''Hardware''' (unless you are using a hosted server). <br />
* Disk space: 160MB free (min). You will require more free space to store your teaching materials.<br />
* Memory: 256MB (min), 1GB (recommended). The general rule of thumb is that Moodle can support 50 ''concurrent'' users for every 1GB of RAM, but this will vary depending on your specific hardware and software combination. <br />
'''Software'''<br />
* Web server software. Most people use [[Apache]], but Moodle should work fine under any web server that supports [[PHP]], such as [[IIS]] on Windows platforms. PHP does impose requirements on versions of web servers, however these are complex and the general advice is to use the newest version possible of your chosen web server. <br />
* PHP scripting language. (Please note that there have been issues installing Moodle with [http://www.php-accelerator.co.uk PHP-Accelerator]). There are currently two versions (or branches) of PHP available: PHP4 and PHP5 and the version requirements are listed below.<br />
** For Moodle version 1.4 or later: PHP4 (version 4.1.0 or later) or PHP5 (version 5.1.0 or later) are supported.<br />
** For Moodle version 1.6 or later: the PHP4 (version 4.3.0 or later) or PHP5 (version 5.1.0 or later) are supported. <br />
** Future Moodle versions 2.0 or later will not support PHP4 and will require PHP5 (version 5.2.0 or later).<br />
** PHP Settings<br />
::Check these settings in your php.ini or .htaccess file (if you're using Apache). For settings which use ON/OFF as their values, you can substitute 1 for ON and 0 for OFF if you prefer. <br />
*** ''safe_mode'' needs to be OFF.<br />
*** ''memory_limit'' should be at least 16M (32M is recommended for Moodle 1.7 and 40M for Moodle 1.8 or later). Large sites may need more than 128M. PHP 5.2.x requires higher memory_limit values than previous versions of PHP. 64bit operating systems require even more memory.<br />
*** ''session.save_handler'' needs to be set to FILES.<br />
*** ''magic_quotes_gpc'' needs to be ON. This is preferred but not necessary.<br />
*** ''magic_quotes_runtime'' needs to be OFF.<br />
*** ''file_uploads'' needs to be ON.<br />
*** ''session.auto_start'' needs to be OFF.<br />
*** ''session.bug_compat_warn'' needs to be OFF.<br />
::<br />
** PHP Extensions and libraries<br />
*** The mbstring extension is recommended for Moodle 1.6 or later.<br />
*** The iconv extension is recommended for Moodle 1.6 or later.<br />
*** [http://www.libgd.org/ GD library] and the [http://www.freetype.org/ FreeType 2] library and extensions are needed to be able to look at the dynamic graphs that the logs pages make.<br />
*** The mysql extension is required if you are using the MySQL database. Note that in some Linux distributions (notably Red Hat) this is an optional installation.<br />
*** The pgsql extension is required if you are using the PostgreSQL database.<br />
*** The zlib extension is required for zip/unzip functionality.<br />
*** The curl extension is recommended for Moodle 1.8 or later.<br />
*** The tokenizer extension is recommended for Moodle 1.8 or later.<br />
*** The curl and openssl extensions are required for the Moodle network functionality (Moodle 1.8 or later).<br />
*** Other PHP extensions may be required to support optional Moodle functionality, especially external authentication and/or enrolment (e.g. LDAP extension for LDAP authentication and the sockets extension for Chat server).<br />
* A working database server: [[MySQL]] or [[PostgreSQL]] are completely supported and recommended for use with any version of Moodle. Support for Microsoft SQL Server and Oracle has been added in Moodle 1.7. MySQL is ''the'' choice for many people because it is very popular, but there are some [[Arguments in favour of PostgreSQL|arguments in favour of PostgreSQL]], especially if you are planning a large deployment. <br />
** For Moodle 1.5 or later, MySQL (version 3.23 or later) or PostgreSQL (7.4 or later). <br />
** For Moodle 1.6 or later, MySQL (version 4.1.12 or later) or PostgreSQL (7.4 or later).<br />
** For Moodle 1.7 or later, MySQL (version 4.1.12 or later), PostgreSQL (7.4 or later) or Microsoft SQL Server 2005 (version 9 or [http://moodle.org/mod/forum/discuss.php?d=59284 SQL Server Express 2005])<br />
: MySQL Notes: For Moodle 1.6 or later, If you use latin languages only you can use MySQL 4.1.12. If you are using non-latin languages you require MySQL 4.1.16 or later. Currently the MySQL setting "strict mode" must be OFF (set to "" or "MYSQL40") in the MySQL configuration file. <br />
: PostgreSQL Notes: The minimum version of PostgreSQL is 7.4 and Moodle is widely used with 8.0 and 8.1.<br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<br />
== How many users? ==<br />
<br />
In addition to the hardware and software requirements, you will also need to think about the capacity of your Moodle installation in terms of the number of users it can handle. There are two numbers to plan for:<br />
<br />
* '''Browsing users''': the maximum number of users able to browse your Moodle site. This is the number of computers in your organization or on your course (whichever is greater).<br />
* '''Concurrent database users''': the maximum number of concurrent database users (needed for Moodle activities such as quizzes). This is the number of users who will be using Moodle at the same time. In an educational institution, use your timetable/roster to obtain this figure.<br />
<br />
Once you know these figures for your users, you can start work out if your Moodle installation can support this capacity. The exact number of users depends on your hardware/software/network combination. Usually the amount of memory installed (RAM) is the deciding factor but a faster overall processor speed will also help in reducing waiting times for pages to load. <br />
<br />
The general rule of thumb for a single server is that the approx max concurrent users = RAM (GB) * 50 and the approx max browsing users = Approx max concurrent users * 5. As an example, a university with 500 total computers on campus and 100 concurrent users at any time will need approx 2GB of RAM on the one server to support the number of concurrent users.<br />
<br />
'''Note if you are using a hosted account''': Ask your provider what limits are placed on the number of concurrent database connections and the processor load. This will give a good estimate of the number of users your Moodle install can manage.<br />
<br />
'''Note:''' As of August 31, 2007, the moodle 1.8.2+ codes are still not suitable for large installation, especially if you have large number (e.g. 20,000+) of courses. The main reason is the codes related to ROLES are still not fully optimized with database queries and still need some work. If you are planning to use 1.8.x codes for a larger institution, please make sure that you have sufficient time to do your own testing and performance profiling.<br />
<br />
[Update] This performance issue has been improved quite a bit in the most recent 1.8.3+ version (see this thread discussion: http://moodle.org/mod/forum/discuss.php?d=83281). However, you should still plan with caution if you are planning to use Moodle 1.8.x code base for larger installation.<br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<br />
== Download and copy files into place ==<br />
<br />
There are two ways to get Moodle, either as a compressed package or via CVS. <br />
* There are two types of compressed packages on the [http://download.moodle.org/ download page: http://download.moodle.org/], the standard distribution with Moodle only files and the [[Complete install packages|complete install]], which contains programs to operate Moodle in a web environment. <br />
* To use CVS, helpful instructions are available at the [[CVS_for_Administrators | CVS for Administrators]] page. The full [http://cvs.moodle.org/moodle/ Moodle CVS repository] is also available for browsing. <br />
<br />
After downloading, unpack the archive using either <br />
tar -zxvf [filename]<br />
or<br />
unzip [filename]<br />
as appropriate. <br />
<br />
If using CVS, run the CVS Checkout command.<br />
<br />
You will now be left with a directory called "moodle", containing a number of files and folders.<br />
<br />
You can either place the whole folder in your web server documents directory, in which case the site will be located at '''<nowiki>http://yourwebserver.com/moodle</nowiki>''', or you can copy all the contents straight into the main web server documents directory, in which case the site will be simply '''<nowiki>http://yourwebserver.com</nowiki>'''.<br />
<br />
If you are downloading Moodle to your local computer and then uploading it to your web site, it is usually better to upload the whole archive as one file, and then do the unpacking on the server. Even web hosting interfaces like cPanel allow you to uncompress archives in the "File Manager".<br />
<br />
=== Structure of moodle directory ===<br />
<br />
You can safely skip this section, but here is a quick summary of the contents of the Moodle folder, to help get you oriented:<br />
<br />
:''config.php'' - contains basic settings. This file does not come with Moodle - you will create it.<br />
:''install.php'' - the script you will run to create config.php<br />
:''version.php'' - defines the current version of Moodle code<br />
:''index.php'' - the front page of the site<br />
:''admin/'' - code to administrate the whole server<br />
:''auth/'' - plugin modules to authenticate users<br />
:''blocks/'' - plugin modules for the little side blocks on many pages<br />
:''calendar/'' - all the code for managing and displaying calendars<br />
:''course/'' - code to display and manage courses<br />
:''doc/'' - help documentation for Moodle (eg this page)<br />
:''files/'' - code to display and manage uploaded files<br />
:''lang/'' - texts in different languages, one directory per language<br />
:''lib/'' - libraries of core Moodle code<br />
:''login/'' - code to handle login and account creation<br />
:''mod/'' - all the main Moodle course modules are in here<br />
:''pix/'' - generic site graphics<br />
:''theme/'' - theme packs/skins to change the look of the site.<br />
:''user/'' - code to display and manage users<br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<br />
== Setting-up your system==<br />
To ensure that Moodle will install successfully, you need to check that the web server settings are correct, then create a blank database for Moodle to use and finally create a directory on your hard disk for Moodle to save your materials and other files you upload into your courses.<br />
<br />
=== Check web server settings ===<br />
<br />
*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. Mine usually looks like this:<br />
<br />
'''DirectoryIndex''' index.php index.html index.htm<br />
<br />
:Just make sure index.php is in the list (and preferably towards the start of the list, for efficiency).<br />
<br />
*Secondly, '''if you are using Apache 2''', then you should turn on the ''AcceptPathInfo'' variable, which allows scripts to be passed arguments like <nowiki>http://server/file.php/arg1/arg2</nowiki>. 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.<br />
<br />
'''AcceptPathInfo''' on<br />
<br />
=== Recheck PHP settings ===<br />
Moodle requires a number of PHP settings to be active for it to work. These were given in the Requirements section and '''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, so it is useful to double-check that the settings are correct. These are defined in PHP's configuration file (usually called '''php.ini''') or in the Apache '''.htaccess''' file:<br />
<br />
safe_mode = 0 (necessary)<br />
memory_limit = 40M (varies: minimum 16M, 32M Moodle v1.7, 40M Moodle v1.8, 128M large sites)<br />
session.save_handler = files (unless you are using another handler, e.g. mm) <br />
magic_quotes_gpc = 1 (preferred but not necessary)<br />
magic_quotes_runtime = 0 (necessary)<br />
file_uploads = 1<br />
session.auto_start = 0<br />
session.bug_compat_warn = 0<br />
<br />
You may also want to set other, optional php.ini file settings while you are already editing it. For instance, you may want to reset the maximum upload size of file attachments, which usually defaults to 2M(egabytes). For instance, to set these to 16 Megabytes:<br />
<br />
post_max_size = 16M<br />
upload_max_filesize = 16M<br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<br />
=== Using a .htaccess file for webserver and PHP settings ===<br />
<br />
Use the above if you can directly edit your server's files, but if you are setting-up Moodle on a webhost, or 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. This only works on Apache servers and only when Overrides have been allowed in the main Apache configuration. Moodle is supplied with a htaccess file which you can use, or you can create your own file manually.<br />
<br />
* '''Use the default htaccess file'''. The easiest thing to do is just copy the sample file from moodle/lib/htaccess and edit it to suit your needs. It contains further instructions. For example, in a Unix shell:<br />
<br />
cd moodle<br />
cp moodle/lib/htaccess .htaccess<br />
<br />
* '''Create your own file'''. Alternatively you can create your own file called '''.htaccess''' in Moodle's main directory that contains lines like the following. <br />
<br />
DirectoryIndex index.php index.html index.htm<br />
php_value memory_limit 40M (adjust to your version of Moodle)<br />
php_flag magic_quotes_gpc 1<br />
php_flag magic_quotes_runtime 0<br />
php_flag file_uploads 1<br />
php_flag session.auto_start 0<br />
php_flag session.bug_compat_warn 0<br />
<br />
:If you have Apache version 2 installed, add these lines:<br />
<br />
<IfDefine APACHE2><br />
AcceptPathInfo on<br />
</IfDefine><br />
<br />
:Otherwise add this single line:<br />
<br />
AcceptPathInfo on<br />
<br />
:Optionally, you can also do things like define the maximum size for uploaded files, etc by adding these lines:<br />
<br />
LimitRequestBody 0<br />
php_value upload_max_filesize 2M<br />
php_value post_max_size 2M<br />
<br />
:The value given in these lines is 2M. You may want to change this at a later date to allow uploading of larger files.<br />
<br />
'''Note''': Use a .htaccess file only [http://httpd.apache.org/docs/1.3/howto/htaccess.html#when as a last resort] as it can have an impact on the performance of your Moodle site and cause pages to load slowly on your browser.<br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<br />
=== Creating an empty database ===<br />
<br />
You need to create an empty database (eg "''moodle''") in your database system along with a special user (eg "moodleuser") that has access to that database (and that database only). You could use the "root" user if you wanted to for a test server, but this is not recommended for a production system: if hackers manage to discover the password then your whole database system would be at risk, rather than just one database.<br />
<br />
::'''Warning''': Bear in mind that, as of Moodle version 1.5.x, Moodle doesn't work with MySQL 5.x's strict mode setting (STRICT_TRANS_TABLES and/or STRICT_ALL_TABLES) -- see [http://moodle.org/mod/forum/discuss.php?d=58552 forum discussion]. So if you are using MySQL 5.x, edit MySQL's configuration file (called "my.ini" in Windows and "my.cnf" on Unix/Linux) and comment out that option or set it to <code>sql-mode=<nowiki>''</nowiki></code>. You have to restart MySQL after changing this setting. <br><br> If you do not have access to your server, use PHPMyAdmin (or another MySQL client) and enter the command <code>SET @@global.sql_mode=<nowiki>''</nowiki>;</code> (be sure to use single quotes, and don't forget the semicolon).<br />
<br />
<table style=background-color:lightCyan border=1 cellpadding=5 cellspacing=0 ><tr><td><br />
====Using a hosted server====<br />
If you are using a webhost, they will probably have a control panel web interface for you to create your database.<br />
<br />
The '''[http://www.cpanel.com/ cPanel]''' system is one of the most popular of these. <br />
To create a database using cPanel:<br />
<br />
# Click on the '''MySQL Databases''' icon.<br />
# Type '''moodle''' in the New Database field and click '''Create Database'''.<br />
# Type a ''username'' and ''password'' (not one you use elsewhere) in the respective fields and click '''Create User'''.<br>Note that the ''username'' and ''database'' names may be prefixed by your cPanel account name and an underscore, and truncated to 16 characters. When entering this information into the Moodle installer - use the full names.<br />
# Now use the '''Add Users to Databases''' button and give this new user account '''ALL''' rights to the new database.<br />
<br />
Continue with [[Installing_Moodle#CreatDataDir |Creating the data directory]]<br />
<br />
</table><br />
<br />
====Using the command line====<br />
<br />
If you have access to Unix or Windows command lines then you can do the same sort of thing by typing commands. You should do this using the MySQL Client program as follows (commands which you type-in are shown in bold):<br />
<br />
- Start the MySQL Client program:<br />
#'''mysql -u root -p'''<br />
Enter password:<br />
Welcome to the MySQL monitor. Commands end with ; or \g.<br />
Your MySQL connection id is 2 to server version: 5.0.22-log<br />
<br />
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.<br />
<br />
mysql><br />
<br />
- The prompt changes to "mysql>" to indicate that you are now working in the MySQL Client program. When working in MySQL, all commands which you type-in must end in a semi-colon. (If you hit the Enter key without the final semi-colon, you'll get the line continuation symbol '->'; this is your second chance to type the semi-colon and hit Enter.) <br />
<br />
- Begin by checking for any existing databases called "moodle" - if there are any you should change the name in all the commands which follow:<br />
mysql> '''SHOW DATABASES;'''<br />
+-------------------------+<br />
| Database |<br />
+-------------------------+<br />
| information_schema |<br />
| mysql |<br />
| test |<br />
+-------------------------+<br />
3 rows in set (0.03 sec)<br />
<br />
- Create a database to store the Moodle tables. We'll call this "moodle", as there are none with that name already in the above list, but change it if you need to.<br />
mysql> '''CREATE DATABASE moodle;'''<br />
Query OK, 1 row affected (0.00 sec)<br />
<br />
- Change the default character set and collation of the "moodle" database to UTF8. Leave this out if you are installing Moodle 1.5 or earlier):<br />
mysql> '''ALTER DATABASE moodle DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;'''<br />
Query OK, 1 row affected (0.00 sec)<br />
<br />
- Create a username and password to access the database "moodle" and grant database access permissions. We'll call the user "moodleuser" and set the password as "yourpassword". It's a good idea to change these for your installation however most people keep the username as "moodleuser". Remember the username and password you have set, as you'll need it in the configuration screens later. This is a long command so has been split over several lines by pressing the Return key.<br />
mysql> '''GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,'''<br />
-> '''DROP,INDEX,ALTER ON moodle.*'''<br />
-> '''TO moodleuser@localhost IDENTIFIED BY 'yourpassword';'''<br />
Query OK, 0 rows affected (0.01 sec)<br />
<br />
:'''Security Warnings''': Never leave the password as the one shown here. Make sure you have a strong password (a mixture of letters and numbers, upper and lower case). Avoid granting "ALL" permissions on the database.<br />
: '''Note''': For MySQL 4.0.1 or earlier, you don't need the CREATE TEMPORARY TABLES permission. <br />
<br />
- Exit the MySQL Client program:<br />
mysql> '''QUIT'''<br />
Bye<br />
#<br />
<br />
- Reload the grant tables using the mysqladmin program:<br />
#'''mysqladmin -u root -p reload'''<br />
Enter password:<br />
#<br />
<br />
And some example command lines for PostgreSQL:<br />
<br />
# su - postgres<br />
> psql -c "create user moodleuser createdb;" template1<br />
> psql -c "create database moodle <font color="red">with encoding 'unicode'</font>;" -U moodleuser template1<br />
> psql -c "alter user moodleuser nocreatedb;" template1<br />
> psql -c "alter user moodleuser with encrypted password 'yourpassword';" template1<br />
> su - root<br />
# /etc/init.d/postgresql reload<br />
<br />
If the Postgres create database command above (>psql -c "create database moodle...") gives an error message you may want to try:<br />
psql -c "create database moodle with template=template1 encoding = 'unicode' owner = moodleuser <br> location = '/var/mydata';"<br />
<br />
If the create database command asks you for a password, run the line containing 'encrypted password' first before proceeding.<br />
<br />
'''See also''':<br />
* Step-by-step instructions on [https://docs.moodle.org/en/Step-by-step_Install_Guide_for_Ubuntu installation for Ubuntu(Debian)]<br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<div id=CreatDataDir ><br />
<br />
=== Creating the data directory ===<br />
<br />
Moodle will also need some space on your server's hard disk to store uploaded files, such as course documents and user pictures. The Moodle installer tries hard to create the '''moodledata''' directory for you but if it fails then you will have to create a directory for this purpose manually.<br />
<br />
'''Security warning''': For security purposes, it's best that this directory is NOT accessible directly via the web. The easiest way to do this is to simply locate it OUTSIDE the web directory, but if you must have it in the web directory (and you are using Apache) then protect it by creating a file in the data directory called '''.htaccess''', containing these lines:<br />
<br />
order deny,allow<br />
deny from all<br />
<br />
'''Ownership & Permissions''': To make sure that Moodle can save uploaded files in this directory, check that the web server software has permission to read, write and execute in this directory. On Unix machines, this means setting the owner of the directory to be something like "nobody" or "apache", and then giving that user read, write and execute permissions. As an example, to change the owner to "nobody" you could use:<br />
<br />
chown -R nobody:apache moodledata<br />
<br />
To change the permissions so that the owner has read,write and execute permissions, use something like this:<br />
<br />
chmod -R 0770 moodledata<br />
<br />
'''Note''': If you are receiving permission denied messages, try ''chmod -R 0770 moodledata'' and then adjust the settings so that they are more secure. A more secure setting is ''chmod -R 0750 moodledata''. According to the comments in config-dist.php, "On hosting systems you might need to make sure that your group has no permissions at all while others have full permissions." To do this you could use ''chmod -R 707 moodledata''. See also the [[Security | security page]].<br />
<br />
Remember that by default moodle will issue a warning about moodle data directories created inside the web directory, but otherwise this directory can be located where you wish. You can later move or change the location of this directory, but if you do, be sure to edit the setting in the '''config.php''' file that sets this; e.g. if moodledata is under a directory called data, then it would look like this:<br />
<br />
$CFG->dataroot = '/data/moodledata';<br />
<br />
<table style=background-color:lightCyan border=1 cellpadding=5 cellspacing=0 ><tr><td><br />
<br />
'''CPanel and webhosts'''<br />
<br />
On cPanel systems you can use the "File Manager" to find the folder, click on it, then choose "Change Permissions". On many shared hosting servers, you will probably need to restrict all file access to your "group" (to prevent other webhost customers from looking at or changing your files), but provide full read/write access to everyone else (which will allow the web server to access your files). Speak to your server administrator if you are having trouble setting this up securely. In particular it will not be possible to create a usable data directory on sites that use a PHP feature known as "'''Safe Mode'''".<br />
</table><br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<br />
== Run the installer script to create config.php ==<br />
<br />
To run the installer script (install.php), just try to access your Moodle main URL using a web browser, or access '''<nowiki>http://yourserver/install.php</nowiki>''' directly.<br />
<br />
(The Installer will try to set a session cookie. If you get a popup warning in your browser make sure you accept that cookie!)<br />
<br />
Moodle will detect that configuration is necessary and will lead you through some screens to help you create a new configuration file called '''config.php'''. At the end of the process Moodle will try and write the file into the right location, otherwise you can press a button to download it from the installer and then upload '''config.php''' into the main Moodle directory on the server.<br />
<br />
Along the way the installer will test your server environment and give you suggestions about how to fix any problems. For most common issues these suggestions should be sufficient, but if you get stuck, check in the Installation Forum for more help.<br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<br />
== Go to the admin page to continue configuration ==<br />
<br />
Once the basic config.php has been correctly created in the previous step, trying to access the front page of your site will take you to the "admin" page for the rest of the configuration.<br />
<br />
The first time you access this admin page, you will be presented with a GPL "shrink wrap" agreement with which you must agree before you can continue with the setup.<br />
<br />
Now Moodle will start setting up your database and creating tables to store data. Firstly, the main database tables are created. You should see a number of SQL statements followed by status messages that look like this:<br />
<br />
CREATE TABLE course (<br />
id int(10) unsigned NOT NULL auto_increment,<br />
category int(10) unsigned NOT NULL default '0',<br />
password varchar(50) NOT NULL default <nowiki>''</nowiki>,<br />
fullname varchar(254) NOT NULL default <nowiki>''</nowiki>,<br />
shortname varchar(15) NOT NULL default <nowiki>''</nowiki>,<br />
summary text NOT NULL,<br />
format tinyint(4) NOT NULL default '1',<br />
teacher varchar(100) NOT NULL default 'Teacher',<br />
startdate int(10) unsigned NOT NULL default '0',<br />
enddate int(10) unsigned NOT NULL default '0',<br />
timemodified int(10) unsigned NOT NULL default '0',<br />
PRIMARY KEY (id)<br />
) TYPE=MyISAM;<br />
<br />
<font color="green">SUCCESS</font><br />
<br />
...and so on, followed by: <font color="green">Main databases set up successfully.</font><br />
<br />
If you don't see these, then there must have been some problem with the database or the configuration settings you defined in config.php. Check that PHP isn't in a restricted "Safe Mode" (commercial web hosts sometimes have safe mode turned on). You can check PHP variables by creating a little file containing '''<?php phpinfo() ?>''' and looking at it through a browser. Check all these and try this page again.<br />
<br />
Scroll down the very bottom of the page and press the "Continue" link.<br />
<br />
You should now see a form where you can define more configuration variables for your installation, such as the default language, SMTP hosts and so on. Don't worry too much about getting everything right just now - you can always come back and edit these later on using the admin interface. The defaults are designed to be useful and secure for most sites. Scroll down to the bottom and click "Save changes".<br />
<br />
If (and only if) you find yourself getting stuck on this page, unable to continue, then your server probably has what I call the "buggy referrer" problem. This is easy to fix: just turn off the "secureforms" setting, then try to continue again.<br />
<br />
Next you will see more pages that print lots of status messages as they set up all the tables required by the various Moodle module. As before, they should all be <font color="green">green</font>.<br />
<br />
Scroll down the very bottom of the page and press the "Continue" link.<br />
<br />
The next page is a form where you can define parameters for your Moodle site and the front page, such as the name, format, description and so on. Fill this out (you can always come back and change these later) and then press "Save changes".<br />
<br />
Finally, you will then be asked to create a top-level administration user for future access to the admin pages. Fill out the details with your own name, email etc and then click "Save changes". Not all the fields are required, but if you miss any important fields you'll be re-prompted for them.<br />
<br />
'''Make sure you remember the username and password you chose for the administration user account, as they will be necessary to access the administration page in future.'''<br />
<br />
(If for any reason your install is interrupted, or there is a system error of some kind that prevents you from logging in using the admin account, you can usually log in using the default username of "'''admin'''", with password "'''admin'''".)<br />
<br />
Once successful, you will be returned to the home page of your new site! Note the administration links that appear down the left hand side of the page (these items also appear on a separate Admin page) - these items are only visible to you because you are logged in as the admin user. All your further administration of Moodle can now be done using this menu, such as:<br />
<br />
* creating and deleting courses<br />
* creating and editing user accounts<br />
* administering teacher accounts<br />
* changing site-wide settings like themes etc<br />
<br />
But you are not done installing yet! There is one very important thing still to do (see the next section on cron).<br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<br />
== Set up cron ==<br />
<br />
Moodle's background tasks (e.g. sending out forum emails and performing course backups) are performed by a script which you can set to execute at specific times of the day. This is known as a cron script. Please refer to the [[Cron|Cron instructions]].<br />
<br />
== Set up backups ==<br />
<br />
Please refer to the [[Backup settings| backup instructions]].<br />
<br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<br />
== Create a new course ==<br />
<br />
Now that Moodle is running properly, you can try creating a new course to play with.<br />
<br />
Select "Create a new course" from the Admin page (or the admin links on the home page).<br />
<br />
Fill out the form, paying special attention to the course format. You don't have to worry about the details too much at this stage, as everything can be changed later by the teacher. Note that the yellow help icons are everywhere to provide contextual help on any aspect.<br />
<br />
Press "Save changes", and you will be taken to a new form where you can assign teachers to the course. You can only add existing user accounts from this form - if you want to create a new teacher account then either ask the teacher to create one for themselves (see the login page), or create one for them using the "Add a new user" on the Admin page.<br />
<br />
Once done, the course is ready to customize, and is accessible via the "Courses" link on the home page.<br />
<br />
==See also==<br />
<br />
* [[Installation FAQ]]<br />
*[[Complete install packages]] might be an easier first time installs on some systems<br />
* [[Installing Apache, MySQL and PHP]] - Open source programs that can run Moodle on the web or on a desktop<br />
* [[Upgrading Moodle]]<br />
* Using Moodle [http://moodle.org/mod/forum/discuss.php?d=42688 Selecting a web host for Moodle] forum discussion<br />
* [[masquerading|Masquerading]] - Running Moodle behind a masquerading/NAT firewall<br />
<br />
[[Category:Installation]]<br />
<br />
[[cs:Instalace]]<br />
[[de:Installieren von Moodle]]<br />
[[es:Instalación de moodle]]<br />
[[fr:Installation de Moodle]]<br />
[[ja:Moodleのインストール]]<br />
[[nl:Installatiegids]]<br />
[[pl:Instalacja Moodle]]<br />
[[pt:Instalação do Moodle]]<br />
[[ru:Установка Moodle]]<br />
[[sk:Inštalácia]]<br />
[[zh:安装Moodlezh:]]</div>Kawhttps://docs.moodle.org/20/en/index.php?title=Logs_report&diff=34448Logs report2008-04-02T22:09:39Z<p>Kaw: /* Administrator log reports */ Typo</p>
<hr />
<div>There are many different types of logs and reports available in Moodle. Teacher and administrator report logs are very similar. Teachers can not see information outside of a course. <br />
<br />
==Overview==<br />
A log can be thought of as a list of information, some might call it a table. Each line or record in the log usually contains a timestamp plus one or more fields that holds information about activity at that instant. A report presents the content of the log in some sort of uniform format. Different reports can use the same log. For example different reports might have different sort orders and sub groupings. Filters selectively reduce or focus the information shown in the report. In Moodle, a log report is a process where the administrator or teacher can customize a one time report about activity. <br />
<br />
In short, there are other MoodleDoc pages that deal with very specific reports.<br />
<br />
==Teacher log reports==<br />
[[Image:Report Icon link.JPG]] show activity within the course. It allows tutors to see what resources are being used and when. For example a teacher can check that an individual student has viewed the resource they claim to have read, and how long. Individual user reports generate some basic graphical views of this information. <br />
<br />
The drop-down menus are used to set filters. The teacher can view the log records at course level, user level and/or activity level on a specific day or all days.<br />
<br />
For course management these logs can help determine what types of resource are the most popular, including those that receive no interest whatsoever. This can help plan resource selection for future courses. Viewing individual activity reports can help you monitor student activity and identify learning styles.<br />
*[[Logs]] brief description<br />
*[[Reports]] Shows how to use 1.6 course log reports for teachers<br />
<br />
==Administrator log reports==<br />
[[Image:Logs icon link.JPG]]These are available to someone with site administrative rights and are found in the [[Administration block]]. There are filters for user, course, and activity types. There is predefined log report which shows all activity in the last hour on the site. <br />
{{Moodle 1.7}}<br />
*In version 1.7 "logs" have become a [[Image:Report Icon link.JPG]] category.<br />
log reports<br />
<br />
== See also ==<br />
*[[Reports]] Shows how to use 1.6 course log reports for teachers and administrators<br />
*[[Backup log]]<br />
<br />
[[Category:Teacher]]<br />
[[Category:Report]]</div>Kawhttps://docs.moodle.org/20/en/index.php?title=Complete_install_packages&diff=34346Complete install packages2008-03-31T12:04:37Z<p>Kaw: /* First steps */ Typo</p>
<hr />
<div>Complete install packages are available from [http://download.moodle.org/ Moodle Downloads], located on a tab for each of the operating systems. The packages are designed for new installations on a server or standalone computer. Please note the standard distributions only contain the Moodle code.<br />
<br />
This document provides instructions for using the Windows packages. Separate instructions are available for [[Complete Install Packages for Mac OS X|Mac OS X packages]].<br />
<br />
For installation on a Windows 2000 or Windows 2003 server it is good practice to perform a manual install (see the manual installation section in [[Windows_installation|Windows Installation]]). <br />
<br />
After installing the Windows package, note that there are other downloads (e.g. additional modules and plugins) that may involve more customization of configuration files.<br />
<br />
The complete install packages allow Moodle to be installed, along with the prerequisites that includes a web server, database and scripting language (Apache, MySQL and PHP in this case). Several versions of the complete install package are available. The instructions on the download page provide guidance on which version is likely to be most suitable.<br />
<br />
Note: The latest complete install package version components, may not be backwardly compatible. Always check version compatibility of each component if you intend to develop materials on a later version of Moodle than the version installed on your "main" Moodle site. In short, complete install packages are designed for first time install on a "clean" machine. <br />
<br />
==System requirements==<br />
+ 256 MB RAM (minimum), 512 MB RAM (recommended)<br />
+ 160 MB free Fixed Disk (more space will be needed depending on user uploads)<br />
+ Windows 98/ME (minimum)<br />
+ Windows NT/2000/XP (recommended)<br />
<br />
==Install complete package ==<br />
As noted above the complete install package is a zip file that contains Moodle and programs to create a webserver called Apache, MySQL and PHP.<br />
<br />
===First steps===<br />
Step 1: [http://download.moodle.org/windows Download Windows] packed-zip file from Moodle.<br />
<br />
Step 2: Unpack the file you downloaded to a drive or partition of your choice and let the default create C:\moodle or W:\moodle or something like this. It is a good practice at this point to rename the C:\moodle to something like C:\Web or C:\Xampplite or even C:\Moodle19 . There will be a folder under this called \moodle. <br />
<br />
Step 3: Start the "setup_xampp.bat" in the top folder. This will configure Xammplite. Note: XAMPP makes no entries in the windows registry and no settings for the system variables. <br />
<br />
Step 4: Now you are ready to start your webserver. Use the Xampp_start file which you should find in the top directory (for example C:\Xampplite). Once the Xampp_start program is open, don't close it, use Xampp_stop for that purpose. Xampp start and stop program(s) control both Apache and MySQL programs that operate the webserver. <br />
*Alternatively you can individually start and stop Apache and MySQL with their bat files found in the top folder such as C:\xampplite . <br />
<br />
Step 5: Start your browser and type <nowiki> http://127.0.0.1 or http://localhost </nowiki>in the address bar. You will either start your first time Moodle installation or if it is already install enter your homepage.<br />
<br />
===Start the Moodle installation===<br />
<br />
*In your web browser, type the path to the folder containing the Moodle files in te address bar – in this example it’s <nowiki>http://localhost/moodle, in the above example it would be http://localhost</nowiki>.<br />
<br />
<br />
*The initial install page is displayed.<br />
<br />
[[image:Xampp24.gif|thumb|center|665px]]<br />
<br />
*Choose your preferred language (English is used in this example) and click the “Next” button.<br />
<br />
*A diagnostic report is displayed – hopefully it will look like this, if not you may need to address some issues.<br />
<br />
[[image:Xampp25.gif|thumb|center|546px]]<br />
<br />
<br />
*Click the “Next” button to continue.<br />
<br />
*The paths for your Moodle installation are shown – accept the ones that are shown on your screen.<br />
<br />
[[image:Xampp26.gif|thumb|center|527px]]<br />
<br />
<br />
*Click the “Next” button to continue.<br />
<br />
*What you enter in the "Host Server" field depends on what you intend to use the new Moodle installation for. <br />
If you are just going to use it for local testing, then use 'localhost'. <br />
If you are going to test the new installation on a LAN, and will be accessing it from other machines on that LAN, then put the private IP address or network name of the serving machine, followed by a forward slash and moodle: Host Server - 192.168.1.1/moodle<br />
If you are going to test the installation on the internet, then you will need to put the public ip address followed by a forward slash and moodle: your_ip_address/moodle or you can put your domain name here instead.<br />
<br />
*In the next fields, we enter the database settings. The fields are populated with some suggested values.<br />
<br />
*We strongly recommend you place a user name and password in this screen. (Don't forget them).<br />
<br />
*DO NOT USE THE “ROOT” USER WITHOUT A PASSWORD FOR PRODUCTION INSTALLATIONS AS THIS CREATES A SECURITY VULNERABILITY<br />
[[image:Xampp27.gif|thumb|center|535px]]<br />
<br />
<br />
*When the fields have been populated, click the “Next” button to continue.<br />
<br />
*Provided the Moodle folder is writable, a message confirming the configuration has been completed will be displayed.<br />
<br />
[[image:Xampp29.gif|thumb|center|549px]]<br />
<br />
*Click the “ Continue” button to proceed.<br />
<br />
The Moodle copyright / licence notices are displayed.<br />
<br />
[[image:Xampp30.gif|thumb|center|723px]]<br />
<br />
<br />
*Click the “Yes” button to continue. In most cases this will be followed by a series of screens that have a continue button on the bottom. In Moodle 1.8 look for the "Unattended" checkoff box. This will press the continue button at the bottom of the screen for you. This process stops with Admin user profile settings which needs to be filled out, then goes to the site setting page.<br />
<br />
===Congratulations - Moodle has been installed===<br />
This finishes the installation of a complete package. Type http://localhost in your browser and Moodle will open. <br />
<br />
Your next task will be to configure Moodle. See [[Administrator_documentation#Configuration]] or [[Administrator_documentation]]. Don't worry, it is easy to change any of the settings once Moodle is running.<br />
<br />
== Security matters (A MUST READ!)==<br />
<br />
As mentioned before, XAMPP is not meant for production use but only for developers <br />
in a development environment. The way XAMPP is configured is to be open as possible <br />
and allowing the developer anything he/she wants. For development environments this <br />
is great but in a production environment it could be fatal. Here a list of missing security <br />
in XAMPP:<br />
<br />
The MySQL administrator (root) has no password.<br />
The MySQL daemon is accessible via network.<br />
phpMyAdmin is accessible via network.<br />
Examples are accessible via network.<br />
<br />
To fix most of the security weaknesses simply call the following URL:<br />
<br />
http://localhost/security/<br />
<br />
The root password for MySQL + phpMyAdmin and also a XAMPP directory protection can be established here.<br />
<br />
Note that on the Windows installer package, some (all?) of these issues have been fixed already by default and the above link does not work.<br />
<br />
If in doubt, more info is [http://www.apachefriends.org/en/faq-xampp-windows.html here]<br />
<br />
== Apache and MySQL tweaks ==<br />
=== Installing Apache and MySQL as services===<br />
(This is only for NT4 | Windows 2000 | Windows XP operating systems)<br />
<br />
\xampplite\apache\apache_installservice.bat =<br />
==> Install Apache 2 as service <br />
<br />
\xampplite\apache\apache_uninstallservice.bat =<br />
==> Uninstall Apache 2 as service <br />
<br />
\xampplite\mysql\mysql_installservice.bat =<br />
==> Install MySQL as service <br />
<br />
\xampplite\mysql\mysql_uninstallservice.bat =<br />
==> Uninstall MySQL as service <br />
<br />
==> After all Service (un)installations, please restart your system!<br />
<br />
<br />
===Apache Notes===<br />
<br />
You should use the apache_start and apache_stop bat files to start and stop apache from running.<br />
<br />
===Troubleshooting===<br />
<br />
If you find that Apache is very flaky, with the page often not loading properly or even at all (especially on localhost), try adding these lines to the end of C:\your_moodle_installer_directory\apache\conf\httpd.conf <br />
<br />
EnableSendfile Off<br />
EnableMMAP Off<br />
Win32DisableAcceptEx<br />
<br />
===MySQL notes===<br />
<br />
(1) The MySQL server can be started by double-clicking (executing)<br />
mysql_start.bat. This file can be found in the same folder you installed<br />
xampp in, most likely this will be C:\xampplite\.<br />
The exact path to this file is X:\xampplite\mysql_start.bat, where<br />
"X" indicates the letter of the drive you unpacked xampp into.<br />
This batch file starts the MySQL server in console mode. The first <br />
intialization might take a few minutes.<br />
<br />
Do not close the DOS window or you'll crash the server!<br />
To stop the server, please use mysql_shutdown.bat, which is located in the same<br />
directory.<br />
<br />
(2) To use the MySQL Daemon with "innodb" for better performance, <br />
please edit the "my" (or "my.cnf") file in the /xampplite/mysql/bin <br />
directory or for services the c:\my.cnf for windows NT/2000/XP. <br />
In there, activate the "innodb_data_file_path=ibdata1:30M"<br />
statement. Attention, "innodb" is not recommended for 95/98/ME.<br />
<br />
To use MySQL as Service for NT/2000/XP, simply copy the "my" <br />
/ "my.cnf" file to C:\my, or C:\my.cnf. Please note that this <br />
file has to be placed in C:\ (root), other locations are not permitted. Then<br />
execute the "mysql_installservice.bat" in the mysql folder. <br />
<br />
<br />
(3) MySQL starts with standard values for the user id and the password. The preset<br />
user id is "root", the password is "" (= no password). To access MySQL via PHP<br />
with the preset values, you'll have to use the following syntax:<br />
mysql_connect("localhost","root","");<br />
If you want to set a password for MySQL access, please use of mysqladmin.<br />
To set the passwort "secret" for the user "root", type the following:<br />
\xampplite\mysql\bin\mysqladmin -u root password secret<br />
<br />
After changing the password you'll have to reconfigure phpMyAdmin to use the<br />
new password, otherwise it won't be able to access the databases. To do that,<br />
open the file config.inc.php in \xampplite\phpmyadmin\ and edit the<br />
following lines: <br />
<br />
$cfg['Servers'][$i]['user'] = 'root'; // MySQL user<br />
$cfg['Servers'][$i]['auth_type'] = 'http'; // HTTP authentificate<br />
<br />
So first the 'root' password is queried by the MySQL server, before phpMyAdmin <br />
may access.<br />
<br />
<br />
<br />
Have a lot of fun! Viel Spaß! Bonne Chance!<br />
<br />
==See also==<br />
*[[Administrator_documentation]] for links that help configure Moodle.<br />
*[[Installation guide - Moodle for Windows on a USB Memory Stick]]<br />
*Return to [[Windows installation]]<br />
*[[Windows 1 computer many servers |Multiple web servers, on 1 computer]] similar to windows installation page, with some tips<br />
*[https://docs.moodle.org/en/Windows_installation_using_XAMPP#Troubleshooting Troubleshooting]if you are running Skype. <br />
*[[Installing_AMP]] lots of XAMPP stuff. XAMPP stands for XP, Apache, MySQL,PHP and Perl. XAMPPlite does not include Perl. MAMP stands for Mac, Apache, MySQL and PHP. <br />
*[[Complete Install Packages for Mac OS X]] <br />
<br />
<br />
[[es:Paquetes_para_Instalaci%C3%B3n_Completa]]<br />
[[pl:Kompletne pakiety instalacyjne]]<br />
<br />
[[Category:Administrator]]<br />
[[Category:Installation]]</div>Kawhttps://docs.moodle.org/20/en/index.php?title=Installing_Moodle&diff=34345Installing Moodle2008-03-31T11:59:45Z<p>Kaw: /* Using a .htaccess file for webserver and PHP settings */ Combined settings</p>
<hr />
<div>'''Firstly don't panic! :-)'''<br />
<br />
This guide explains how to install Moodle for the first time. For some of these steps it goes into a lot of detail to try and cover the majority of possible web server setups, so this page may look long and complicated. Don't panic, once you know how to do it you can install Moodle in minutes!<br />
<br />
If you have problems please read this page carefully - most common issues are answered in here. If you still have trouble, you can seek help from the Moodle community via [http://moodle.org/course/view.php?id=5 moodle.org Using Moodle].<br />
<br />
Another option is to contact a [http://moodle.com/hosting/ Moodle Partner providing Moodle hosting] who can completely maintain Moodle for you, so that you can ignore all this and get straight into educating! A Moodle partner is the preferred option but if you decide to choose a hosting company that has cpanel then [http://otaru-jc.ac.jp/hagley/settingupmoodleonhostingwithcpanel.swf this tutorial will guide you] through the process of choosing a host and setting up moodle via cpanel. <br />
<br />
'''Warning:''' some hosting companies offer one-click moodle install options, which whilst sometimes effective, usually use old (sometimes years old) versions of moodle and sometimes simply don't work. If one of these goes wrong, your best bet is often to start from scratch following the instructions here yourself. Its almost certainly quicker.<br />
<br />
If you want to run Moodle on your own computer and this page looks a bit daunting, then please see our guides: [[Installing AMP |Installing Apache, MySQL and PHP(AMP)]] or [[Complete install packages| how to install one of Moodle's complete packages]]. They provide alternative instructions to install all this on most popular platforms.<br />
==Table of Contents==<br />
__TOC__<br />
<br />
==Requirements==<br />
<br />
Moodle is primarily developed in Linux using [[Apache]], [[MySQL]] and [[PHP]] (also sometimes known as the LAMP platform), but is also regularly tested with Windows XP/2000/2003 (WAMP), Solaris 10 (Sparc and x64), Mac OS X and Netware 6 operating systems. Support for PostgreSQL, Oracle and Microsoft SQL Server is also available.<br />
<br />
'''Blank page problem while installing Moodle on Windows Vista may occur; following these steps: [[Installing Moodle on Windows Vista]] might help.<br />
<br />
'''Note if you are using a hosted account''': Most web hosts support all of these requirements by default. You should contact your web host's support desk to check that this is the case '''before''' signing-up with them. It is especially important to ask about any PHP memory limits or MySQL question limits. If your prospective host does not provide a service which meets these requirements, or you are already signed up with them, ask them why and consider taking your business elsewhere if they do not change.<br />
<br />
The requirements for Moodle are as follows:<br />
<br />
'''Hardware''' (unless you are using a hosted server). <br />
* Disk space: 160MB free (min). You will require more free space to store your teaching materials.<br />
* Memory: 256MB (min), 1GB (recommended). The general rule of thumb is that Moodle can support 50 ''concurrent'' users for every 1GB of RAM, but this will vary depending on your specific hardware and software combination. <br />
'''Software'''<br />
* Web server software. Most people use [[Apache]], but Moodle should work fine under any web server that supports [[PHP]], such as [[IIS]] on Windows platforms. PHP does impose requirements on versions of web servers, however these are complex and the general advice is to use the newest version possible of your chosen web server. <br />
* PHP scripting language. (Please note that there have been issues installing Moodle with [http://www.php-accelerator.co.uk PHP-Accelerator]). There are currently two versions (or branches) of PHP available: PHP4 and PHP5 and the version requirements are listed below.<br />
** For Moodle version 1.4 or later: PHP4 (version 4.1.0 or later) or PHP5 (version 5.1.0 or later) are supported.<br />
** For Moodle version 1.6 or later: the PHP4 (version 4.3.0 or later) or PHP5 (version 5.1.0 or later) are supported. <br />
** Future Moodle versions 2.0 or later will not support PHP4 and will require PHP5 (version 5.2.0 or later).<br />
** PHP Settings<br />
::Check these settings in your php.ini or .htaccess file (if you're using Apache). For settings which use ON/OFF as their values, you can substitute 1 for ON and 0 for OFF if you prefer. <br />
*** ''safe_mode'' needs to be OFF.<br />
*** ''memory_limit'' should be at least 16M (32M is recommended for Moodle 1.7 and 40M for Moodle 1.8 or later). Large sites may need more than 128M. PHP 5.2.x requires higher memory_limit values than previous versions of PHP. 64bit operating systems require even more memory.<br />
*** ''session.save_handler'' needs to be set to FILES.<br />
*** ''magic_quotes_gpc'' needs to be ON. This is preferred but not necessary.<br />
*** ''magic_quotes_runtime'' needs to be OFF.<br />
*** ''file_uploads'' needs to be ON.<br />
*** ''session.auto_start'' needs to be OFF.<br />
*** ''session.bug_compat_warn'' needs to be OFF.<br />
::<br />
** PHP Extensions and libraries<br />
*** The mbstring extension is recommended for Moodle 1.6 or later.<br />
*** The iconv extension is recommended for Moodle 1.6 or later.<br />
*** [http://www.libgd.org/ GD library] and the [http://www.freetype.org/ FreeType 2] library and extensions are needed to be able to look at the dynamic graphs that the logs pages make.<br />
*** The mysql extension is required if you are using the MySQL database. Note that in some Linux distributions (notably Red Hat) this is an optional installation.<br />
*** The pgsql extension is required if you are using the PostgreSQL database.<br />
*** The zlib extension is required for zip/unzip functionality.<br />
*** The curl extension is recommended for Moodle 1.8 or later.<br />
*** The tokenizer extension is recommended for Moodle 1.8 or later.<br />
*** The curl and openssl extensions are required for the Moodle network functionality (Moodle 1.8 or later).<br />
*** Other PHP extensions may be required to support optional Moodle functionality, especially external authentication and/or enrolment (e.g. LDAP extension for LDAP authentication and the sockets extension for Chat server).<br />
* A working database server: [[MySQL]] or [[PostgreSQL]] are completely supported and recommended for use with any version of Moodle. Support for Microsoft SQL Server and Oracle has been added in Moodle 1.7. MySQL is ''the'' choice for many people because it is very popular, but there are some [[Arguments in favour of PostgreSQL|arguments in favour of PostgreSQL]], especially if you are planning a large deployment. <br />
** For Moodle 1.5 or later, MySQL (version 3.23 or later) or PostgreSQL (7.4 or later). <br />
** For Moodle 1.6 or later, MySQL (version 4.1.12 or later) or PostgreSQL (7.4 or later).<br />
** For Moodle 1.7 or later, MySQL (version 4.1.12 or later), PostgreSQL (7.4 or later) or Microsoft SQL Server 2005 (version 9 or [http://moodle.org/mod/forum/discuss.php?d=59284 SQL Server Express 2005])<br />
: MySQL Notes: For Moodle 1.6 or later, If you use latin languages only you can use MySQL 4.1.12. If you are using non-latin languages you require MySQL 4.1.16 or later. Currently the MySQL setting "strict mode" must be OFF (set to "" or "MYSQL40") in the MySQL configuration file. <br />
: PostgreSQL Notes: The minimum version of PostgreSQL is 7.4 and Moodle is widely used with 8.0 and 8.1.<br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<br />
== How many users? ==<br />
<br />
In addition to the hardware and software requirements, you will also need to think about the capacity of your Moodle installation in terms of the number of users it can handle. There are two numbers to plan for:<br />
<br />
* '''Browsing users''': the maximum number of users able to browse your Moodle site. This is the number of computers in your organization or on your course (whichever is greater).<br />
* '''Concurrent database users''': the maximum number of concurrent database users (needed for Moodle activities such as quizzes). This is the number of users who will be using Moodle at the same time. In an educational institution, use your timetable/roster to obtain this figure.<br />
<br />
Once you know these figures for your users, you can start work out if your Moodle installation can support this capacity. The exact number of users depends on your hardware/software/network combination. Usually the amount of memory installed (RAM) is the deciding factor but a faster overall processor speed will also help in reducing waiting times for pages to load. <br />
<br />
The general rule of thumb for a single server is that the approx max concurrent users = RAM (GB) * 50 and the approx max browsing users = Approx max concurrent users * 5. As an example, a university with 500 total computers on campus and 100 concurrent users at any time will need approx 2GB of RAM on the one server to support the number of concurrent users.<br />
<br />
'''Note if you are using a hosted account''': Ask your provider what limits are placed on the number of concurrent database connections and the processor load. This will give a good estimate of the number of users your Moodle install can manage.<br />
<br />
'''Note:''' As of August 31, 2007, the moodle 1.8.2+ codes are still not suitable for large installation, especially if you have large number (e.g. 20,000+) of courses. The main reason is the codes related to ROLES are still not fully optimized with database queries and still need some work. If you are planning to use 1.8.x codes for a larger institution, please make sure that you have sufficient time to do your own testing and performance profiling.<br />
<br />
[Update] This performance issue has been improved quite a bit in the most recent 1.8.3+ version (see this thread discussion: http://moodle.org/mod/forum/discuss.php?d=83281). However, you should still plan with caution if you are planning to use Moodle 1.8.x code base for larger installation.<br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<br />
== Download and copy files into place ==<br />
<br />
There are two ways to get Moodle, either as a compressed package or via CVS. <br />
* There are two types of compressed packages on the [http://download.moodle.org/ download page: http://download.moodle.org/], the standard distribution with Moodle only files and the [[Complete install packages|complete install]], which contains programs to operate Moodle in a web environment. <br />
* To use CVS, helpful instructions are available at the [[CVS_for_Administrators | CVS for Administrators]] page. The full [http://cvs.moodle.org/moodle/ Moodle CVS repository] is also available for browsing. <br />
<br />
After downloading, unpack the archive using either <br />
tar -zxvf [filename]<br />
or<br />
unzip [filename]<br />
as appropriate. <br />
<br />
If using CVS, run the CVS Checkout command.<br />
<br />
You will now be left with a directory called "moodle", containing a number of files and folders.<br />
<br />
You can either place the whole folder in your web server documents directory, in which case the site will be located at '''<nowiki>http://yourwebserver.com/moodle</nowiki>''', or you can copy all the contents straight into the main web server documents directory, in which case the site will be simply '''<nowiki>http://yourwebserver.com</nowiki>'''.<br />
<br />
If you are downloading Moodle to your local computer and then uploading it to your web site, it is usually better to upload the whole archive as one file, and then do the unpacking on the server. Even web hosting interfaces like cPanel allow you to uncompress archives in the "File Manager".<br />
<br />
=== Structure of moodle directory ===<br />
<br />
You can safely skip this section, but here is a quick summary of the contents of the Moodle folder, to help get you oriented:<br />
<br />
:''config.php'' - contains basic settings. This file does not come with Moodle - you will create it.<br />
:''install.php'' - the script you will run to create config.php<br />
:''version.php'' - defines the current version of Moodle code<br />
:''index.php'' - the front page of the site<br />
:''admin/'' - code to administrate the whole server<br />
:''auth/'' - plugin modules to authenticate users<br />
:''blocks/'' - plugin modules for the little side blocks on many pages<br />
:''calendar/'' - all the code for managing and displaying calendars<br />
:''course/'' - code to display and manage courses<br />
:''doc/'' - help documentation for Moodle (eg this page)<br />
:''files/'' - code to display and manage uploaded files<br />
:''lang/'' - texts in different languages, one directory per language<br />
:''lib/'' - libraries of core Moodle code<br />
:''login/'' - code to handle login and account creation<br />
:''mod/'' - all the main Moodle course modules are in here<br />
:''pix/'' - generic site graphics<br />
:''theme/'' - theme packs/skins to change the look of the site.<br />
:''user/'' - code to display and manage users<br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<br />
== Setting-up your system==<br />
To ensure that Moodle will install successfully, you need to check that the web server settings are correct, then create a blank database for Moodle to use and finally create a directory on your hard disk for Moodle to save your materials and other files you upload into your courses.<br />
<br />
=== Check web server settings ===<br />
<br />
*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. Mine usually looks like this:<br />
<br />
'''DirectoryIndex''' index.php index.html index.htm<br />
<br />
:Just make sure index.php is in the list (and preferably towards the start of the list, for efficiency).<br />
<br />
*Secondly, '''if you are using Apache 2''', then you should turn on the ''AcceptPathInfo'' variable, which allows scripts to be passed arguments like <nowiki>http://server/file.php/arg1/arg2</nowiki>. 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.<br />
<br />
'''AcceptPathInfo''' on<br />
<br />
=== Recheck PHP settings ===<br />
Moodle requires a number of PHP settings to be active for it to work. These were given in the Requirements section and '''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, so it is useful to double-check that the settings are correct. These are defined in PHP's configuration file (usually called '''php.ini''') or in the Apache '''.htaccess''' file:<br />
<br />
safe_mode = 0 (necessary)<br />
memory_limit = 40M (varies: minimum 16M, 32M Moodle v1.7, 40M Moodle v1.8, 128M large sites)<br />
session.save_handler = files (unless you are using another handler, e.g. mm) <br />
magic_quotes_gpc = 1 (preferred but not necessary)<br />
magic_quotes_runtime = 0 (necessary)<br />
file_uploads = 1<br />
session.auto_start = 0<br />
session.bug_compat_warn = 0<br />
<br />
You may also want to set other, optional php.ini file settings while you are already editing it. For instance, you may want to reset the maximum upload size of file attachments, which usually defaults to 2M(egabytes). For instance, to set these to 16 Megabytes:<br />
<br />
post_max_size = 16M<br />
upload_max_filesize = 16M<br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<br />
=== Using a .htaccess file for webserver and PHP settings ===<br />
<br />
Use the above if you can directly edit your server's files, but if you are setting-up Moodle on a webhost, or 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. This only works on Apache servers and only when Overrides have been allowed in the main Apache configuration. Moodle is supplied with a htaccess file which you can use, or you can create your own file manually.<br />
<br />
* '''Use the default htaccess file'''. The easiest thing to do is just copy the sample file from moodle/lib/htaccess and edit it to suit your needs. It contains further instructions. For example, in a Unix shell:<br />
<br />
cd moodle<br />
cp moodle/lib/htaccess .htaccess<br />
<br />
* '''Create your own file'''. Alternatively you can create your own file called '''.htaccess''' in Moodle's main directory that contains lines like the following. <br />
<br />
DirectoryIndex index.php index.html index.htm<br />
php_value memory_limit 40M (adjust to your version of Moodle)<br />
php_flag magic_quotes_gpc 1<br />
php_flag magic_quotes_runtime 0<br />
php_flag file_uploads 1<br />
php_flag session.auto_start 0<br />
php_flag session.bug_compat_warn 0<br />
<br />
:If you have Apache version 2 installed, add these lines:<br />
<br />
<IfDefine APACHE2><br />
AcceptPathInfo on<br />
</IfDefine><br />
<br />
:Otherwise add this single line:<br />
<br />
AcceptPathInfo on<br />
<br />
:Optionally, you can also do things like define the maximum size for uploaded files, etc by adding these lines:<br />
<br />
LimitRequestBody 0<br />
php_value upload_max_filesize 2M<br />
php_value post_max_size 2M<br />
<br />
:The value given in these lines is 2M. You may want to change this at a later date to allow uploading of larger files.<br />
<br />
'''Note''': Use a .htaccess file only [http://httpd.apache.org/docs/1.3/howto/htaccess.html#when as a last resort] as it can have an impact on the performance of your Moodle site and cause pages to load slowly on your browser.<br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<br />
=== Creating an empty database ===<br />
<br />
You need to create an empty database (eg "''moodle''") in your database system along with a special user (eg "moodleuser") that has access to that database (and that database only). You could use the "root" user if you wanted to for a test server, but this is not recommended for a production system: if hackers manage to discover the password then your whole database system would be at risk, rather than just one database.<br />
<br />
::'''Warning''': Bear in mind that, as of Moodle version 1.5.x, Moodle doesn't work with MySQL 5.x's strict mode setting (STRICT_TRANS_TABLES and/or STRICT_ALL_TABLES) -- see [http://moodle.org/mod/forum/discuss.php?d=58552 forum discussion]. So if you are using MySQL 5.x, edit MySQL's configuration file (called "my.ini" in Windows and "my.cnf" on Unix/Linux) and comment out that option or set it to <code>sql-mode=<nowiki>''</nowiki></code>. You have to restart MySQL after changing this setting. <br><br> If you do not have access to your server, use PHPMyAdmin (or another MySQL client) and enter the command <code>SET @@global.sql_mode=<nowiki>''</nowiki>;</code> (be sure to use single quotes, and don't forget the semicolon).<br />
<br />
<table style=background-color:lightCyan border=1 cellpadding=5 cellspacing=0 ><tr><td><br />
====Using a hosted server====<br />
If you are using a webhost, they will probably have a control panel web interface for you to create your database.<br />
<br />
The '''[http://www.cpanel.com/ cPanel]''' system is one of the most popular of these. <br />
To create a database using cPanel:<br />
<br />
# Click on the '''MySQL Databases''' icon.<br />
# Type '''moodle''' in the New Database field and click '''Create Database'''.<br />
# Type a ''username'' and ''password'' (not one you use elsewhere) in the respective fields and click '''Create User'''.<br>Note that the ''username'' and ''database'' names may be prefixed by your cPanel account name and an underscore, and truncated to 16 characters. When entering this information into the Moodle installer - use the full names.<br />
# Now use the '''Add Users to Databases''' button and give this new user account '''ALL''' rights to the new database.<br />
<br />
Continue with [[Installing_Moodle#CreatDataDir |Creating the data directory]]<br />
<br />
</table><br />
<br />
====Using the command line====<br />
<br />
If you have access to Unix or Windows command lines then you can do the same sort of thing by typing commands. You should do this using the MySQL Client program as follows (commands which you type-in are shown in bold):<br />
<br />
- Start the MySQL Client program:<br />
#'''mysql -u root -p'''<br />
Enter password:<br />
Welcome to the MySQL monitor. Commands end with ; or \g.<br />
Your MySQL connection id is 2 to server version: 5.0.22-log<br />
<br />
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.<br />
<br />
mysql><br />
<br />
- The prompt changes to "mysql>" to indicate that you are now working in the MySQL Client program. When working in MySQL, all commands which you type-in must end in a semi-colon. (If you hit the Enter key without the final semi-colon, you'll get the line continuation symbol '->'; this is your second chance to type the semi-colon and hit Enter.) <br />
<br />
- Begin by checking for any existing databases called "moodle" - if there are any you should change the name in all the commands which follow:<br />
mysql> '''SHOW DATABASES;'''<br />
+-------------------------+<br />
| Database |<br />
+-------------------------+<br />
| information_schema |<br />
| mysql |<br />
| test |<br />
+-------------------------+<br />
3 rows in set (0.03 sec)<br />
<br />
- Create a database to store the Moodle tables. We'll call this "moodle", as there are none with that name already in the above list, but change it if you need to.<br />
mysql> '''CREATE DATABASE moodle;'''<br />
Query OK, 1 row affected (0.00 sec)<br />
<br />
- Change the default character set and collation of the "moodle" database to UTF8. Leave this out if you are installing Moodle 1.5 or earlier):<br />
mysql> '''ALTER DATABASE moodle DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;'''<br />
Query OK, 1 row affected (0.00 sec)<br />
<br />
- Create a username and password to access the database "moodle" and grant database access permissions. We'll call the user "moodleuser" and set the password as "yourpassword". It's a good idea to change these for your installation however most people keep the username as "moodleuser". Remember the username and password you have set, as you'll need it in the configuration screens later. This is a long command so has been split over several lines by pressing the Return key.<br />
mysql> '''GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,'''<br />
-> '''DROP,INDEX,ALTER ON moodle.*'''<br />
-> '''TO moodleuser@localhost IDENTIFIED BY 'yourpassword';'''<br />
Query OK, 0 rows affected (0.01 sec)<br />
<br />
:'''Security Warnings''': Never leave the password as the one shown here. Make sure you have a strong password (a mixture of letters and numbers, upper and lower case). Avoid granting "ALL" permissions on the database.<br />
: '''Note''': For MySQL 4.0.1 or earlier, you don't need the CREATE TEMPORARY TABLES permission. <br />
<br />
- Exit the MySQL Client program:<br />
mysql> '''QUIT'''<br />
Bye<br />
#<br />
<br />
- Reload the grant tables using the mysqladmin program:<br />
#'''mysqladmin -u root -p reload'''<br />
Enter password:<br />
#<br />
<br />
And some example command lines for PostgreSQL:<br />
<br />
# su - postgres<br />
> psql -c "create user moodleuser createdb;" template1<br />
> psql -c "create database moodle <font color="red">with encoding 'unicode'</font>;" -U moodleuser template1<br />
> psql -c "alter user moodleuser nocreatedb;" template1<br />
> psql -c "alter user moodleuser with encrypted password 'yourpassword';" template1<br />
> su - root<br />
# /etc/init.d/postgresql reload<br />
<br />
If the Postgres create database command above (>psql -c "create database moodle...") gives an error message you may want to try:<br />
psql -c "create database moodle with template=template1 encoding = 'unicode' owner = moodleuser <br> location = '/var/mydata';"<br />
<br />
If the create database command asks you for a password, run the line containing 'encrypted password' first before proceeding.<br />
<br />
'''See also''':<br />
* Step-by-step instructions on [https://docs.moodle.org/en/Step-by-step_Install_Guide_for_Ubuntu installation for Ubuntu(Debian)]<br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<div id=CreatDataDir ><br />
<br />
=== Creating the data directory ===<br />
<br />
Moodle will also need some space on your server's hard disk to store uploaded files, such as course documents and user pictures. The Moodle installer tries hard to create the '''moodledata''' directory for you but if it fails then you will have to create a directory for this purpose manually.<br />
<br />
'''Security warning''': For security purposes, it's best that this directory is NOT accessible directly via the web. The easiest way to do this is to simply locate it OUTSIDE the web directory, but if you must have it in the web directory (and you are using Apache) then protect it by creating a file in the data directory called '''.htaccess''', containing these lines:<br />
<br />
order deny,allow<br />
deny from all<br />
<br />
'''Ownership & Permissions''': To make sure that Moodle can save uploaded files in this directory, check that the web server software has permission to read, write and execute in this directory. On Unix machines, this means setting the owner of the directory to be something like "nobody" or "apache", and then giving that user read, write and execute permissions. As an example, to change the owner to "nobody" you could use:<br />
<br />
chown -R nobody:apache moodledata<br />
<br />
To change the permissions so that the owner has read,write and execute permissions, use something like this:<br />
<br />
chmod -R 0770 moodledata<br />
<br />
'''Note''': If you are receiving permission denied messages, try ''chmod -R 0770 moodledata'' and then adjust the settings so that they are more secure. A more secure setting is ''chmod -R 0750 moodledata''. According to the comments in config-dist.php, "On hosting systems you might need to make sure that your group has no permissions at all while others have full permissions." To do this you could use ''chmod -R 707 moodledata''. See also the [[Security | security page]].<br />
<br />
Remember that by default moodle will issue a warning about moodle data directories created inside the web directory, but otherwise this directory can be located where you wish. You can later move or change the location of this directory, but if you do, be sure to edit the setting in the '''config.php''' file that sets this; e.g. if moodledata is under a directory called data, then it would look like this:<br />
<br />
$CFG->dataroot = '/data/moodledata';<br />
<br />
<table style=background-color:lightCyan border=1 cellpadding=5 cellspacing=0 ><tr><td><br />
<br />
'''CPanel and webhosts'''<br />
<br />
On cPanel systems you can use the "File Manager" to find the folder, click on it, then choose "Change Permissions". On many shared hosting servers, you will probably need to restrict all file access to your "group" (to prevent other webhost customers from looking at or changing your files), but provide full read/write access to everyone else (which will allow the web server to access your files). Speak to your server administrator if you are having trouble setting this up securely. In particular it will not be possible to create a usable data directory on sites that use a PHP feature known as "'''Safe Mode'''".<br />
</table><br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<br />
== Run the installer script to create config.php ==<br />
<br />
To run the installer script (install.php), just try to access your Moodle main URL using a web browser, or access '''<nowiki>http://yourserver/install.php</nowiki>''' directly.<br />
<br />
(The Installer will try to set a session cookie. If you get a popup warning in your browser make sure you accept that cookie!)<br />
<br />
Moodle will detect that configuration is necessary and will lead you through some screens to help you create a new configuration file called '''config.php'''. At the end of the process Moodle will try and write the file into the right location, otherwise you can press a button to download it from the installer and then upload '''config.php''' into the main Moodle directory on the server.<br />
<br />
Along the way the installer will test your server environment and give you suggestions about how to fix any problems. For most common issues these suggestions should be sufficient, but if you get stuck, check in the Installation Forum for more help.<br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<br />
== Go to the admin page to continue configuration ==<br />
<br />
Once the basic config.php has been correctly created in the previous step, trying to access the front page of your site will take you to the "admin" page for the rest of the configuration.<br />
<br />
The first time you access this admin page, you will be presented with a GPL "shrink wrap" agreement with which you must agree before you can continue with the setup.<br />
<br />
Now Moodle will start setting up your database and creating tables to store data. Firstly, the main database tables are created. You should see a number of SQL statements followed by status messages that look like this:<br />
<br />
CREATE TABLE course (<br />
id int(10) unsigned NOT NULL auto_increment,<br />
category int(10) unsigned NOT NULL default '0',<br />
password varchar(50) NOT NULL default <nowiki>''</nowiki>,<br />
fullname varchar(254) NOT NULL default <nowiki>''</nowiki>,<br />
shortname varchar(15) NOT NULL default <nowiki>''</nowiki>,<br />
summary text NOT NULL,<br />
format tinyint(4) NOT NULL default '1',<br />
teacher varchar(100) NOT NULL default 'Teacher',<br />
startdate int(10) unsigned NOT NULL default '0',<br />
enddate int(10) unsigned NOT NULL default '0',<br />
timemodified int(10) unsigned NOT NULL default '0',<br />
PRIMARY KEY (id)<br />
) TYPE=MyISAM;<br />
<br />
<font color="green">SUCCESS</font><br />
<br />
...and so on, followed by: <font color="green">Main databases set up successfully.</font><br />
<br />
If you don't see these, then there must have been some problem with the database or the configuration settings you defined in config.php. Check that PHP isn't in a restricted "Safe Mode" (commercial web hosts sometimes have safe mode turned on). You can check PHP variables by creating a little file containing '''<?php phpinfo() ?>''' and looking at it through a browser. Check all these and try this page again.<br />
<br />
Scroll down the very bottom of the page and press the "Continue" link.<br />
<br />
You should now see a form where you can define more configuration variables for your installation, such as the default language, SMTP hosts and so on. Don't worry too much about getting everything right just now - you can always come back and edit these later on using the admin interface. The defaults are designed to be useful and secure for most sites. Scroll down to the bottom and click "Save changes".<br />
<br />
If (and only if) you find yourself getting stuck on this page, unable to continue, then your server probably has what I call the "buggy referrer" problem. This is easy to fix: just turn off the "secureforms" setting, then try to continue again.<br />
<br />
Next you will see more pages that print lots of status messages as they set up all the tables required by the various Moodle module. As before, they should all be <font color="green">green</font>.<br />
<br />
Scroll down the very bottom of the page and press the "Continue" link.<br />
<br />
The next page is a form where you can define parameters for your Moodle site and the front page, such as the name, format, description and so on. Fill this out (you can always come back and change these later) and then press "Save changes".<br />
<br />
Finally, you will then be asked to create a top-level administration user for future access to the admin pages. Fill out the details with your own name, email etc and then click "Save changes". Not all the fields are required, but if you miss any important fields you'll be re-prompted for them.<br />
<br />
'''Make sure you remember the username and password you chose for the administration user account, as they will be necessary to access the administration page in future.'''<br />
<br />
(If for any reason your install is interrupted, or there is a system error of some kind that prevents you from logging in using the admin account, you can usually log in using the default username of "'''admin'''", with password "'''admin'''".)<br />
<br />
Once successful, you will be returned to the home page of your new site! Note the administration links that appear down the left hand side of the page (these items also appear on a separate Admin page) - these items are only visible to you because you are logged in as the admin user. All your further administration of Moodle can now be done using this menu, such as:<br />
<br />
* creating and deleting courses<br />
* creating and editing user accounts<br />
* administering teacher accounts<br />
* changing site-wide settings like themes etc<br />
<br />
But you are not done installing yet! There is one very important thing still to do (see the next section on cron).<br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<br />
== Set up cron ==<br />
<br />
Please refer to the [[Cron|Cron instructions]].<br />
<br />
== Set up backups ==<br />
<br />
Please refer to the [[Backup settings| backup instructions]].<br />
<br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<br />
== Create a new course ==<br />
<br />
Now that Moodle is running properly, you can try creating a new course to play with.<br />
<br />
Select "Create a new course" from the Admin page (or the admin links on the home page).<br />
<br />
Fill out the form, paying special attention to the course format. You don't have to worry about the details too much at this stage, as everything can be changed later by the teacher. Note that the yellow help icons are everywhere to provide contextual help on any aspect.<br />
<br />
Press "Save changes", and you will be taken to a new form where you can assign teachers to the course. You can only add existing user accounts from this form - if you want to create a new teacher account then either ask the teacher to create one for themselves (see the login page), or create one for them using the "Add a new user" on the Admin page.<br />
<br />
Once done, the course is ready to customize, and is accessible via the "Courses" link on the home page.<br />
<br />
==See also==<br />
<br />
* [[Installation FAQ]]<br />
*[[Complete install packages]] might be an easier first time installs on some systems<br />
* [[Installing Apache, MySQL and PHP]] - Open source programs that can run Moodle on the web or on a desktop<br />
* [[Upgrading Moodle]]<br />
* Using Moodle [http://moodle.org/mod/forum/discuss.php?d=42688 Selecting a web host for Moodle] forum discussion<br />
* [[masquerading|Masquerading]] - Running Moodle behind a masquerading/NAT firewall<br />
<br />
[[Category:Installation]]<br />
<br />
[[cs:Instalace]]<br />
[[de:Installieren von Moodle]]<br />
[[es:Instalación de moodle]]<br />
[[fr:Installation de Moodle]]<br />
[[ja:Moodleのインストール]]<br />
[[nl:Installatiegids]]<br />
[[pl:Instalacja Moodle]]<br />
[[pt:Instalação do Moodle]]<br />
[[ru:Установка Moodle]]<br />
[[sk:Inštalácia]]<br />
[[zh:安装Moodlezh:]]</div>Kawhttps://docs.moodle.org/20/en/index.php?title=Installing_Moodle&diff=34344Installing Moodle2008-03-31T11:39:48Z<p>Kaw: /* Check PHP settings */ Combined settings</p>
<hr />
<div>'''Firstly don't panic! :-)'''<br />
<br />
This guide explains how to install Moodle for the first time. For some of these steps it goes into a lot of detail to try and cover the majority of possible web server setups, so this page may look long and complicated. Don't panic, once you know how to do it you can install Moodle in minutes!<br />
<br />
If you have problems please read this page carefully - most common issues are answered in here. If you still have trouble, you can seek help from the Moodle community via [http://moodle.org/course/view.php?id=5 moodle.org Using Moodle].<br />
<br />
Another option is to contact a [http://moodle.com/hosting/ Moodle Partner providing Moodle hosting] who can completely maintain Moodle for you, so that you can ignore all this and get straight into educating! A Moodle partner is the preferred option but if you decide to choose a hosting company that has cpanel then [http://otaru-jc.ac.jp/hagley/settingupmoodleonhostingwithcpanel.swf this tutorial will guide you] through the process of choosing a host and setting up moodle via cpanel. <br />
<br />
'''Warning:''' some hosting companies offer one-click moodle install options, which whilst sometimes effective, usually use old (sometimes years old) versions of moodle and sometimes simply don't work. If one of these goes wrong, your best bet is often to start from scratch following the instructions here yourself. Its almost certainly quicker.<br />
<br />
If you want to run Moodle on your own computer and this page looks a bit daunting, then please see our guides: [[Installing AMP |Installing Apache, MySQL and PHP(AMP)]] or [[Complete install packages| how to install one of Moodle's complete packages]]. They provide alternative instructions to install all this on most popular platforms.<br />
==Table of Contents==<br />
__TOC__<br />
<br />
==Requirements==<br />
<br />
Moodle is primarily developed in Linux using [[Apache]], [[MySQL]] and [[PHP]] (also sometimes known as the LAMP platform), but is also regularly tested with Windows XP/2000/2003 (WAMP), Solaris 10 (Sparc and x64), Mac OS X and Netware 6 operating systems. Support for PostgreSQL, Oracle and Microsoft SQL Server is also available.<br />
<br />
'''Blank page problem while installing Moodle on Windows Vista may occur; following these steps: [[Installing Moodle on Windows Vista]] might help.<br />
<br />
'''Note if you are using a hosted account''': Most web hosts support all of these requirements by default. You should contact your web host's support desk to check that this is the case '''before''' signing-up with them. It is especially important to ask about any PHP memory limits or MySQL question limits. If your prospective host does not provide a service which meets these requirements, or you are already signed up with them, ask them why and consider taking your business elsewhere if they do not change.<br />
<br />
The requirements for Moodle are as follows:<br />
<br />
'''Hardware''' (unless you are using a hosted server). <br />
* Disk space: 160MB free (min). You will require more free space to store your teaching materials.<br />
* Memory: 256MB (min), 1GB (recommended). The general rule of thumb is that Moodle can support 50 ''concurrent'' users for every 1GB of RAM, but this will vary depending on your specific hardware and software combination. <br />
'''Software'''<br />
* Web server software. Most people use [[Apache]], but Moodle should work fine under any web server that supports [[PHP]], such as [[IIS]] on Windows platforms. PHP does impose requirements on versions of web servers, however these are complex and the general advice is to use the newest version possible of your chosen web server. <br />
* PHP scripting language. (Please note that there have been issues installing Moodle with [http://www.php-accelerator.co.uk PHP-Accelerator]). There are currently two versions (or branches) of PHP available: PHP4 and PHP5 and the version requirements are listed below.<br />
** For Moodle version 1.4 or later: PHP4 (version 4.1.0 or later) or PHP5 (version 5.1.0 or later) are supported.<br />
** For Moodle version 1.6 or later: the PHP4 (version 4.3.0 or later) or PHP5 (version 5.1.0 or later) are supported. <br />
** Future Moodle versions 2.0 or later will not support PHP4 and will require PHP5 (version 5.2.0 or later).<br />
** PHP Settings<br />
::Check these settings in your php.ini or .htaccess file (if you're using Apache). For settings which use ON/OFF as their values, you can substitute 1 for ON and 0 for OFF if you prefer. <br />
*** ''safe_mode'' needs to be OFF.<br />
*** ''memory_limit'' should be at least 16M (32M is recommended for Moodle 1.7 and 40M for Moodle 1.8 or later). Large sites may need more than 128M. PHP 5.2.x requires higher memory_limit values than previous versions of PHP. 64bit operating systems require even more memory.<br />
*** ''session.save_handler'' needs to be set to FILES.<br />
*** ''magic_quotes_gpc'' needs to be ON. This is preferred but not necessary.<br />
*** ''magic_quotes_runtime'' needs to be OFF.<br />
*** ''file_uploads'' needs to be ON.<br />
*** ''session.auto_start'' needs to be OFF.<br />
*** ''session.bug_compat_warn'' needs to be OFF.<br />
::<br />
** PHP Extensions and libraries<br />
*** The mbstring extension is recommended for Moodle 1.6 or later.<br />
*** The iconv extension is recommended for Moodle 1.6 or later.<br />
*** [http://www.libgd.org/ GD library] and the [http://www.freetype.org/ FreeType 2] library and extensions are needed to be able to look at the dynamic graphs that the logs pages make.<br />
*** The mysql extension is required if you are using the MySQL database. Note that in some Linux distributions (notably Red Hat) this is an optional installation.<br />
*** The pgsql extension is required if you are using the PostgreSQL database.<br />
*** The zlib extension is required for zip/unzip functionality.<br />
*** The curl extension is recommended for Moodle 1.8 or later.<br />
*** The tokenizer extension is recommended for Moodle 1.8 or later.<br />
*** The curl and openssl extensions are required for the Moodle network functionality (Moodle 1.8 or later).<br />
*** Other PHP extensions may be required to support optional Moodle functionality, especially external authentication and/or enrolment (e.g. LDAP extension for LDAP authentication and the sockets extension for Chat server).<br />
* A working database server: [[MySQL]] or [[PostgreSQL]] are completely supported and recommended for use with any version of Moodle. Support for Microsoft SQL Server and Oracle has been added in Moodle 1.7. MySQL is ''the'' choice for many people because it is very popular, but there are some [[Arguments in favour of PostgreSQL|arguments in favour of PostgreSQL]], especially if you are planning a large deployment. <br />
** For Moodle 1.5 or later, MySQL (version 3.23 or later) or PostgreSQL (7.4 or later). <br />
** For Moodle 1.6 or later, MySQL (version 4.1.12 or later) or PostgreSQL (7.4 or later).<br />
** For Moodle 1.7 or later, MySQL (version 4.1.12 or later), PostgreSQL (7.4 or later) or Microsoft SQL Server 2005 (version 9 or [http://moodle.org/mod/forum/discuss.php?d=59284 SQL Server Express 2005])<br />
: MySQL Notes: For Moodle 1.6 or later, If you use latin languages only you can use MySQL 4.1.12. If you are using non-latin languages you require MySQL 4.1.16 or later. Currently the MySQL setting "strict mode" must be OFF (set to "" or "MYSQL40") in the MySQL configuration file. <br />
: PostgreSQL Notes: The minimum version of PostgreSQL is 7.4 and Moodle is widely used with 8.0 and 8.1.<br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<br />
== How many users? ==<br />
<br />
In addition to the hardware and software requirements, you will also need to think about the capacity of your Moodle installation in terms of the number of users it can handle. There are two numbers to plan for:<br />
<br />
* '''Browsing users''': the maximum number of users able to browse your Moodle site. This is the number of computers in your organization or on your course (whichever is greater).<br />
* '''Concurrent database users''': the maximum number of concurrent database users (needed for Moodle activities such as quizzes). This is the number of users who will be using Moodle at the same time. In an educational institution, use your timetable/roster to obtain this figure.<br />
<br />
Once you know these figures for your users, you can start work out if your Moodle installation can support this capacity. The exact number of users depends on your hardware/software/network combination. Usually the amount of memory installed (RAM) is the deciding factor but a faster overall processor speed will also help in reducing waiting times for pages to load. <br />
<br />
The general rule of thumb for a single server is that the approx max concurrent users = RAM (GB) * 50 and the approx max browsing users = Approx max concurrent users * 5. As an example, a university with 500 total computers on campus and 100 concurrent users at any time will need approx 2GB of RAM on the one server to support the number of concurrent users.<br />
<br />
'''Note if you are using a hosted account''': Ask your provider what limits are placed on the number of concurrent database connections and the processor load. This will give a good estimate of the number of users your Moodle install can manage.<br />
<br />
'''Note:''' As of August 31, 2007, the moodle 1.8.2+ codes are still not suitable for large installation, especially if you have large number (e.g. 20,000+) of courses. The main reason is the codes related to ROLES are still not fully optimized with database queries and still need some work. If you are planning to use 1.8.x codes for a larger institution, please make sure that you have sufficient time to do your own testing and performance profiling.<br />
<br />
[Update] This performance issue has been improved quite a bit in the most recent 1.8.3+ version (see this thread discussion: http://moodle.org/mod/forum/discuss.php?d=83281). However, you should still plan with caution if you are planning to use Moodle 1.8.x code base for larger installation.<br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<br />
== Download and copy files into place ==<br />
<br />
There are two ways to get Moodle, either as a compressed package or via CVS. <br />
* There are two types of compressed packages on the [http://download.moodle.org/ download page: http://download.moodle.org/], the standard distribution with Moodle only files and the [[Complete install packages|complete install]], which contains programs to operate Moodle in a web environment. <br />
* To use CVS, helpful instructions are available at the [[CVS_for_Administrators | CVS for Administrators]] page. The full [http://cvs.moodle.org/moodle/ Moodle CVS repository] is also available for browsing. <br />
<br />
After downloading, unpack the archive using either <br />
tar -zxvf [filename]<br />
or<br />
unzip [filename]<br />
as appropriate. <br />
<br />
If using CVS, run the CVS Checkout command.<br />
<br />
You will now be left with a directory called "moodle", containing a number of files and folders.<br />
<br />
You can either place the whole folder in your web server documents directory, in which case the site will be located at '''<nowiki>http://yourwebserver.com/moodle</nowiki>''', or you can copy all the contents straight into the main web server documents directory, in which case the site will be simply '''<nowiki>http://yourwebserver.com</nowiki>'''.<br />
<br />
If you are downloading Moodle to your local computer and then uploading it to your web site, it is usually better to upload the whole archive as one file, and then do the unpacking on the server. Even web hosting interfaces like cPanel allow you to uncompress archives in the "File Manager".<br />
<br />
=== Structure of moodle directory ===<br />
<br />
You can safely skip this section, but here is a quick summary of the contents of the Moodle folder, to help get you oriented:<br />
<br />
:''config.php'' - contains basic settings. This file does not come with Moodle - you will create it.<br />
:''install.php'' - the script you will run to create config.php<br />
:''version.php'' - defines the current version of Moodle code<br />
:''index.php'' - the front page of the site<br />
:''admin/'' - code to administrate the whole server<br />
:''auth/'' - plugin modules to authenticate users<br />
:''blocks/'' - plugin modules for the little side blocks on many pages<br />
:''calendar/'' - all the code for managing and displaying calendars<br />
:''course/'' - code to display and manage courses<br />
:''doc/'' - help documentation for Moodle (eg this page)<br />
:''files/'' - code to display and manage uploaded files<br />
:''lang/'' - texts in different languages, one directory per language<br />
:''lib/'' - libraries of core Moodle code<br />
:''login/'' - code to handle login and account creation<br />
:''mod/'' - all the main Moodle course modules are in here<br />
:''pix/'' - generic site graphics<br />
:''theme/'' - theme packs/skins to change the look of the site.<br />
:''user/'' - code to display and manage users<br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<br />
== Setting-up your system==<br />
To ensure that Moodle will install successfully, you need to check that the web server settings are correct, then create a blank database for Moodle to use and finally create a directory on your hard disk for Moodle to save your materials and other files you upload into your courses.<br />
<br />
=== Check web server settings ===<br />
<br />
*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. Mine usually looks like this:<br />
<br />
'''DirectoryIndex''' index.php index.html index.htm<br />
<br />
:Just make sure index.php is in the list (and preferably towards the start of the list, for efficiency).<br />
<br />
*Secondly, '''if you are using Apache 2''', then you should turn on the ''AcceptPathInfo'' variable, which allows scripts to be passed arguments like <nowiki>http://server/file.php/arg1/arg2</nowiki>. 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.<br />
<br />
'''AcceptPathInfo''' on<br />
<br />
=== Recheck PHP settings ===<br />
Moodle requires a number of PHP settings to be active for it to work. These were given in the Requirements section and '''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, so it is useful to double-check that the settings are correct. These are defined in PHP's configuration file (usually called '''php.ini''') or in the Apache '''.htaccess''' file:<br />
<br />
safe_mode = 0 (necessary)<br />
memory_limit = 40M (varies: minimum 16M, 32M Moodle v1.7, 40M Moodle v1.8, 128M large sites)<br />
session.save_handler = files (unless you are using another handler, e.g. mm) <br />
magic_quotes_gpc = 1 (preferred but not necessary)<br />
magic_quotes_runtime = 0 (necessary)<br />
file_uploads = 1<br />
session.auto_start = 0<br />
session.bug_compat_warn = 0<br />
<br />
You may also want to set other, optional php.ini file settings while you are already editing it. For instance, you may want to reset the maximum upload size of file attachments, which usually defaults to 2M(egabytes). For instance, to set these to 16 Megabytes:<br />
<br />
post_max_size = 16M<br />
upload_max_filesize = 16M<br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<br />
=== Using a .htaccess file for webserver and PHP settings ===<br />
<br />
Use the above if you can directly edit your server's files, but if you are setting-up Moodle on a webhost, or 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. This only works on Apache servers and only when Overrides have been allowed in the main Apache configuration.<br />
<br />
* Create a file called '''.htaccess''' in Moodle's main directory that contains lines like the following. <br />
<br />
DirectoryIndex index.php index.html index.htm<br />
php_flag magic_quotes_gpc 1<br />
php_flag magic_quotes_runtime 0<br />
php_flag file_uploads 1<br />
php_flag session.auto_start 0<br />
php_flag session.bug_compat_warn 0<br />
<br />
:If you have Apache version 2 installed, add these lines:<br />
<br />
<IfDefine APACHE2><br />
AcceptPathInfo on<br />
</IfDefine><br />
<br />
:Otherwise add this single line:<br />
<br />
AcceptPathInfo on<br />
<br />
* Optionally, you can also do things like define the maximum size for uploaded files, etc by adding these lines:<br />
<br />
LimitRequestBody 0<br />
php_value upload_max_filesize 2M<br />
php_value post_max_size 2M<br />
<br />
* 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:<br />
<br />
cp lib/htaccess .htaccess<br />
<br />
'''Note''': Use a .htaccess file only [http://httpd.apache.org/docs/1.3/howto/htaccess.html#when as a last resort] as it can have an impact on the performance of your Moodle site and cause pages to load slowly on your browser.<br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<br />
=== Creating an empty database ===<br />
<br />
You need to create an empty database (eg "''moodle''") in your database system along with a special user (eg "moodleuser") that has access to that database (and that database only). You could use the "root" user if you wanted to for a test server, but this is not recommended for a production system: if hackers manage to discover the password then your whole database system would be at risk, rather than just one database.<br />
<br />
::'''Warning''': Bear in mind that, as of Moodle version 1.5.x, Moodle doesn't work with MySQL 5.x's strict mode setting (STRICT_TRANS_TABLES and/or STRICT_ALL_TABLES) -- see [http://moodle.org/mod/forum/discuss.php?d=58552 forum discussion]. So if you are using MySQL 5.x, edit MySQL's configuration file (called "my.ini" in Windows and "my.cnf" on Unix/Linux) and comment out that option or set it to <code>sql-mode=<nowiki>''</nowiki></code>. You have to restart MySQL after changing this setting. <br><br> If you do not have access to your server, use PHPMyAdmin (or another MySQL client) and enter the command <code>SET @@global.sql_mode=<nowiki>''</nowiki>;</code> (be sure to use single quotes, and don't forget the semicolon).<br />
<br />
<table style=background-color:lightCyan border=1 cellpadding=5 cellspacing=0 ><tr><td><br />
====Using a hosted server====<br />
If you are using a webhost, they will probably have a control panel web interface for you to create your database.<br />
<br />
The '''[http://www.cpanel.com/ cPanel]''' system is one of the most popular of these. <br />
To create a database using cPanel:<br />
<br />
# Click on the '''MySQL Databases''' icon.<br />
# Type '''moodle''' in the New Database field and click '''Create Database'''.<br />
# Type a ''username'' and ''password'' (not one you use elsewhere) in the respective fields and click '''Create User'''.<br>Note that the ''username'' and ''database'' names may be prefixed by your cPanel account name and an underscore, and truncated to 16 characters. When entering this information into the Moodle installer - use the full names.<br />
# Now use the '''Add Users to Databases''' button and give this new user account '''ALL''' rights to the new database.<br />
<br />
Continue with [[Installing_Moodle#CreatDataDir |Creating the data directory]]<br />
<br />
</table><br />
<br />
====Using the command line====<br />
<br />
If you have access to Unix or Windows command lines then you can do the same sort of thing by typing commands. You should do this using the MySQL Client program as follows (commands which you type-in are shown in bold):<br />
<br />
- Start the MySQL Client program:<br />
#'''mysql -u root -p'''<br />
Enter password:<br />
Welcome to the MySQL monitor. Commands end with ; or \g.<br />
Your MySQL connection id is 2 to server version: 5.0.22-log<br />
<br />
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.<br />
<br />
mysql><br />
<br />
- The prompt changes to "mysql>" to indicate that you are now working in the MySQL Client program. When working in MySQL, all commands which you type-in must end in a semi-colon. (If you hit the Enter key without the final semi-colon, you'll get the line continuation symbol '->'; this is your second chance to type the semi-colon and hit Enter.) <br />
<br />
- Begin by checking for any existing databases called "moodle" - if there are any you should change the name in all the commands which follow:<br />
mysql> '''SHOW DATABASES;'''<br />
+-------------------------+<br />
| Database |<br />
+-------------------------+<br />
| information_schema |<br />
| mysql |<br />
| test |<br />
+-------------------------+<br />
3 rows in set (0.03 sec)<br />
<br />
- Create a database to store the Moodle tables. We'll call this "moodle", as there are none with that name already in the above list, but change it if you need to.<br />
mysql> '''CREATE DATABASE moodle;'''<br />
Query OK, 1 row affected (0.00 sec)<br />
<br />
- Change the default character set and collation of the "moodle" database to UTF8. Leave this out if you are installing Moodle 1.5 or earlier):<br />
mysql> '''ALTER DATABASE moodle DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;'''<br />
Query OK, 1 row affected (0.00 sec)<br />
<br />
- Create a username and password to access the database "moodle" and grant database access permissions. We'll call the user "moodleuser" and set the password as "yourpassword". It's a good idea to change these for your installation however most people keep the username as "moodleuser". Remember the username and password you have set, as you'll need it in the configuration screens later. This is a long command so has been split over several lines by pressing the Return key.<br />
mysql> '''GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,'''<br />
-> '''DROP,INDEX,ALTER ON moodle.*'''<br />
-> '''TO moodleuser@localhost IDENTIFIED BY 'yourpassword';'''<br />
Query OK, 0 rows affected (0.01 sec)<br />
<br />
:'''Security Warnings''': Never leave the password as the one shown here. Make sure you have a strong password (a mixture of letters and numbers, upper and lower case). Avoid granting "ALL" permissions on the database.<br />
: '''Note''': For MySQL 4.0.1 or earlier, you don't need the CREATE TEMPORARY TABLES permission. <br />
<br />
- Exit the MySQL Client program:<br />
mysql> '''QUIT'''<br />
Bye<br />
#<br />
<br />
- Reload the grant tables using the mysqladmin program:<br />
#'''mysqladmin -u root -p reload'''<br />
Enter password:<br />
#<br />
<br />
And some example command lines for PostgreSQL:<br />
<br />
# su - postgres<br />
> psql -c "create user moodleuser createdb;" template1<br />
> psql -c "create database moodle <font color="red">with encoding 'unicode'</font>;" -U moodleuser template1<br />
> psql -c "alter user moodleuser nocreatedb;" template1<br />
> psql -c "alter user moodleuser with encrypted password 'yourpassword';" template1<br />
> su - root<br />
# /etc/init.d/postgresql reload<br />
<br />
If the Postgres create database command above (>psql -c "create database moodle...") gives an error message you may want to try:<br />
psql -c "create database moodle with template=template1 encoding = 'unicode' owner = moodleuser <br> location = '/var/mydata';"<br />
<br />
If the create database command asks you for a password, run the line containing 'encrypted password' first before proceeding.<br />
<br />
'''See also''':<br />
* Step-by-step instructions on [https://docs.moodle.org/en/Step-by-step_Install_Guide_for_Ubuntu installation for Ubuntu(Debian)]<br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<div id=CreatDataDir ><br />
<br />
=== Creating the data directory ===<br />
<br />
Moodle will also need some space on your server's hard disk to store uploaded files, such as course documents and user pictures. The Moodle installer tries hard to create the '''moodledata''' directory for you but if it fails then you will have to create a directory for this purpose manually.<br />
<br />
'''Security warning''': For security purposes, it's best that this directory is NOT accessible directly via the web. The easiest way to do this is to simply locate it OUTSIDE the web directory, but if you must have it in the web directory (and you are using Apache) then protect it by creating a file in the data directory called '''.htaccess''', containing these lines:<br />
<br />
order deny,allow<br />
deny from all<br />
<br />
'''Ownership & Permissions''': To make sure that Moodle can save uploaded files in this directory, check that the web server software has permission to read, write and execute in this directory. On Unix machines, this means setting the owner of the directory to be something like "nobody" or "apache", and then giving that user read, write and execute permissions. As an example, to change the owner to "nobody" you could use:<br />
<br />
chown -R nobody:apache moodledata<br />
<br />
To change the permissions so that the owner has read,write and execute permissions, use something like this:<br />
<br />
chmod -R 0770 moodledata<br />
<br />
'''Note''': If you are receiving permission denied messages, try ''chmod -R 0770 moodledata'' and then adjust the settings so that they are more secure. A more secure setting is ''chmod -R 0750 moodledata''. According to the comments in config-dist.php, "On hosting systems you might need to make sure that your group has no permissions at all while others have full permissions." To do this you could use ''chmod -R 707 moodledata''. See also the [[Security | security page]].<br />
<br />
Remember that by default moodle will issue a warning about moodle data directories created inside the web directory, but otherwise this directory can be located where you wish. You can later move or change the location of this directory, but if you do, be sure to edit the setting in the '''config.php''' file that sets this; e.g. if moodledata is under a directory called data, then it would look like this:<br />
<br />
$CFG->dataroot = '/data/moodledata';<br />
<br />
<table style=background-color:lightCyan border=1 cellpadding=5 cellspacing=0 ><tr><td><br />
<br />
'''CPanel and webhosts'''<br />
<br />
On cPanel systems you can use the "File Manager" to find the folder, click on it, then choose "Change Permissions". On many shared hosting servers, you will probably need to restrict all file access to your "group" (to prevent other webhost customers from looking at or changing your files), but provide full read/write access to everyone else (which will allow the web server to access your files). Speak to your server administrator if you are having trouble setting this up securely. In particular it will not be possible to create a usable data directory on sites that use a PHP feature known as "'''Safe Mode'''".<br />
</table><br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<br />
== Run the installer script to create config.php ==<br />
<br />
To run the installer script (install.php), just try to access your Moodle main URL using a web browser, or access '''<nowiki>http://yourserver/install.php</nowiki>''' directly.<br />
<br />
(The Installer will try to set a session cookie. If you get a popup warning in your browser make sure you accept that cookie!)<br />
<br />
Moodle will detect that configuration is necessary and will lead you through some screens to help you create a new configuration file called '''config.php'''. At the end of the process Moodle will try and write the file into the right location, otherwise you can press a button to download it from the installer and then upload '''config.php''' into the main Moodle directory on the server.<br />
<br />
Along the way the installer will test your server environment and give you suggestions about how to fix any problems. For most common issues these suggestions should be sufficient, but if you get stuck, check in the Installation Forum for more help.<br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<br />
== Go to the admin page to continue configuration ==<br />
<br />
Once the basic config.php has been correctly created in the previous step, trying to access the front page of your site will take you to the "admin" page for the rest of the configuration.<br />
<br />
The first time you access this admin page, you will be presented with a GPL "shrink wrap" agreement with which you must agree before you can continue with the setup.<br />
<br />
Now Moodle will start setting up your database and creating tables to store data. Firstly, the main database tables are created. You should see a number of SQL statements followed by status messages that look like this:<br />
<br />
CREATE TABLE course (<br />
id int(10) unsigned NOT NULL auto_increment,<br />
category int(10) unsigned NOT NULL default '0',<br />
password varchar(50) NOT NULL default <nowiki>''</nowiki>,<br />
fullname varchar(254) NOT NULL default <nowiki>''</nowiki>,<br />
shortname varchar(15) NOT NULL default <nowiki>''</nowiki>,<br />
summary text NOT NULL,<br />
format tinyint(4) NOT NULL default '1',<br />
teacher varchar(100) NOT NULL default 'Teacher',<br />
startdate int(10) unsigned NOT NULL default '0',<br />
enddate int(10) unsigned NOT NULL default '0',<br />
timemodified int(10) unsigned NOT NULL default '0',<br />
PRIMARY KEY (id)<br />
) TYPE=MyISAM;<br />
<br />
<font color="green">SUCCESS</font><br />
<br />
...and so on, followed by: <font color="green">Main databases set up successfully.</font><br />
<br />
If you don't see these, then there must have been some problem with the database or the configuration settings you defined in config.php. Check that PHP isn't in a restricted "Safe Mode" (commercial web hosts sometimes have safe mode turned on). You can check PHP variables by creating a little file containing '''<?php phpinfo() ?>''' and looking at it through a browser. Check all these and try this page again.<br />
<br />
Scroll down the very bottom of the page and press the "Continue" link.<br />
<br />
You should now see a form where you can define more configuration variables for your installation, such as the default language, SMTP hosts and so on. Don't worry too much about getting everything right just now - you can always come back and edit these later on using the admin interface. The defaults are designed to be useful and secure for most sites. Scroll down to the bottom and click "Save changes".<br />
<br />
If (and only if) you find yourself getting stuck on this page, unable to continue, then your server probably has what I call the "buggy referrer" problem. This is easy to fix: just turn off the "secureforms" setting, then try to continue again.<br />
<br />
Next you will see more pages that print lots of status messages as they set up all the tables required by the various Moodle module. As before, they should all be <font color="green">green</font>.<br />
<br />
Scroll down the very bottom of the page and press the "Continue" link.<br />
<br />
The next page is a form where you can define parameters for your Moodle site and the front page, such as the name, format, description and so on. Fill this out (you can always come back and change these later) and then press "Save changes".<br />
<br />
Finally, you will then be asked to create a top-level administration user for future access to the admin pages. Fill out the details with your own name, email etc and then click "Save changes". Not all the fields are required, but if you miss any important fields you'll be re-prompted for them.<br />
<br />
'''Make sure you remember the username and password you chose for the administration user account, as they will be necessary to access the administration page in future.'''<br />
<br />
(If for any reason your install is interrupted, or there is a system error of some kind that prevents you from logging in using the admin account, you can usually log in using the default username of "'''admin'''", with password "'''admin'''".)<br />
<br />
Once successful, you will be returned to the home page of your new site! Note the administration links that appear down the left hand side of the page (these items also appear on a separate Admin page) - these items are only visible to you because you are logged in as the admin user. All your further administration of Moodle can now be done using this menu, such as:<br />
<br />
* creating and deleting courses<br />
* creating and editing user accounts<br />
* administering teacher accounts<br />
* changing site-wide settings like themes etc<br />
<br />
But you are not done installing yet! There is one very important thing still to do (see the next section on cron).<br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<br />
== Set up cron ==<br />
<br />
Please refer to the [[Cron|Cron instructions]].<br />
<br />
== Set up backups ==<br />
<br />
Please refer to the [[Backup settings| backup instructions]].<br />
<br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<br />
== Create a new course ==<br />
<br />
Now that Moodle is running properly, you can try creating a new course to play with.<br />
<br />
Select "Create a new course" from the Admin page (or the admin links on the home page).<br />
<br />
Fill out the form, paying special attention to the course format. You don't have to worry about the details too much at this stage, as everything can be changed later by the teacher. Note that the yellow help icons are everywhere to provide contextual help on any aspect.<br />
<br />
Press "Save changes", and you will be taken to a new form where you can assign teachers to the course. You can only add existing user accounts from this form - if you want to create a new teacher account then either ask the teacher to create one for themselves (see the login page), or create one for them using the "Add a new user" on the Admin page.<br />
<br />
Once done, the course is ready to customize, and is accessible via the "Courses" link on the home page.<br />
<br />
==See also==<br />
<br />
* [[Installation FAQ]]<br />
*[[Complete install packages]] might be an easier first time installs on some systems<br />
* [[Installing Apache, MySQL and PHP]] - Open source programs that can run Moodle on the web or on a desktop<br />
* [[Upgrading Moodle]]<br />
* Using Moodle [http://moodle.org/mod/forum/discuss.php?d=42688 Selecting a web host for Moodle] forum discussion<br />
* [[masquerading|Masquerading]] - Running Moodle behind a masquerading/NAT firewall<br />
<br />
[[Category:Installation]]<br />
<br />
[[cs:Instalace]]<br />
[[de:Installieren von Moodle]]<br />
[[es:Instalación de moodle]]<br />
[[fr:Installation de Moodle]]<br />
[[ja:Moodleのインストール]]<br />
[[nl:Installatiegids]]<br />
[[pl:Instalacja Moodle]]<br />
[[pt:Instalação do Moodle]]<br />
[[ru:Установка Moodle]]<br />
[[sk:Inštalácia]]<br />
[[zh:安装Moodlezh:]]</div>Kawhttps://docs.moodle.org/20/en/index.php?title=Installing_Moodle&diff=34343Installing Moodle2008-03-31T11:32:39Z<p>Kaw: /* Requirements */ Combined php.ini settings</p>
<hr />
<div>'''Firstly don't panic! :-)'''<br />
<br />
This guide explains how to install Moodle for the first time. For some of these steps it goes into a lot of detail to try and cover the majority of possible web server setups, so this page may look long and complicated. Don't panic, once you know how to do it you can install Moodle in minutes!<br />
<br />
If you have problems please read this page carefully - most common issues are answered in here. If you still have trouble, you can seek help from the Moodle community via [http://moodle.org/course/view.php?id=5 moodle.org Using Moodle].<br />
<br />
Another option is to contact a [http://moodle.com/hosting/ Moodle Partner providing Moodle hosting] who can completely maintain Moodle for you, so that you can ignore all this and get straight into educating! A Moodle partner is the preferred option but if you decide to choose a hosting company that has cpanel then [http://otaru-jc.ac.jp/hagley/settingupmoodleonhostingwithcpanel.swf this tutorial will guide you] through the process of choosing a host and setting up moodle via cpanel. <br />
<br />
'''Warning:''' some hosting companies offer one-click moodle install options, which whilst sometimes effective, usually use old (sometimes years old) versions of moodle and sometimes simply don't work. If one of these goes wrong, your best bet is often to start from scratch following the instructions here yourself. Its almost certainly quicker.<br />
<br />
If you want to run Moodle on your own computer and this page looks a bit daunting, then please see our guides: [[Installing AMP |Installing Apache, MySQL and PHP(AMP)]] or [[Complete install packages| how to install one of Moodle's complete packages]]. They provide alternative instructions to install all this on most popular platforms.<br />
==Table of Contents==<br />
__TOC__<br />
<br />
==Requirements==<br />
<br />
Moodle is primarily developed in Linux using [[Apache]], [[MySQL]] and [[PHP]] (also sometimes known as the LAMP platform), but is also regularly tested with Windows XP/2000/2003 (WAMP), Solaris 10 (Sparc and x64), Mac OS X and Netware 6 operating systems. Support for PostgreSQL, Oracle and Microsoft SQL Server is also available.<br />
<br />
'''Blank page problem while installing Moodle on Windows Vista may occur; following these steps: [[Installing Moodle on Windows Vista]] might help.<br />
<br />
'''Note if you are using a hosted account''': Most web hosts support all of these requirements by default. You should contact your web host's support desk to check that this is the case '''before''' signing-up with them. It is especially important to ask about any PHP memory limits or MySQL question limits. If your prospective host does not provide a service which meets these requirements, or you are already signed up with them, ask them why and consider taking your business elsewhere if they do not change.<br />
<br />
The requirements for Moodle are as follows:<br />
<br />
'''Hardware''' (unless you are using a hosted server). <br />
* Disk space: 160MB free (min). You will require more free space to store your teaching materials.<br />
* Memory: 256MB (min), 1GB (recommended). The general rule of thumb is that Moodle can support 50 ''concurrent'' users for every 1GB of RAM, but this will vary depending on your specific hardware and software combination. <br />
'''Software'''<br />
* Web server software. Most people use [[Apache]], but Moodle should work fine under any web server that supports [[PHP]], such as [[IIS]] on Windows platforms. PHP does impose requirements on versions of web servers, however these are complex and the general advice is to use the newest version possible of your chosen web server. <br />
* PHP scripting language. (Please note that there have been issues installing Moodle with [http://www.php-accelerator.co.uk PHP-Accelerator]). There are currently two versions (or branches) of PHP available: PHP4 and PHP5 and the version requirements are listed below.<br />
** For Moodle version 1.4 or later: PHP4 (version 4.1.0 or later) or PHP5 (version 5.1.0 or later) are supported.<br />
** For Moodle version 1.6 or later: the PHP4 (version 4.3.0 or later) or PHP5 (version 5.1.0 or later) are supported. <br />
** Future Moodle versions 2.0 or later will not support PHP4 and will require PHP5 (version 5.2.0 or later).<br />
** PHP Settings<br />
::Check these settings in your php.ini or .htaccess file (if you're using Apache). For settings which use ON/OFF as their values, you can substitute 1 for ON and 0 for OFF if you prefer. <br />
*** ''safe_mode'' needs to be OFF.<br />
*** ''memory_limit'' should be at least 16M (32M is recommended for Moodle 1.7 and 40M for Moodle 1.8 or later). Large sites may need more than 128M. PHP 5.2.x requires higher memory_limit values than previous versions of PHP. 64bit operating systems require even more memory.<br />
*** ''session.save_handler'' needs to be set to FILES.<br />
*** ''magic_quotes_gpc'' needs to be ON. This is preferred but not necessary.<br />
*** ''magic_quotes_runtime'' needs to be OFF.<br />
*** ''file_uploads'' needs to be ON.<br />
*** ''session.auto_start'' needs to be OFF.<br />
*** ''session.bug_compat_warn'' needs to be OFF.<br />
::<br />
** PHP Extensions and libraries<br />
*** The mbstring extension is recommended for Moodle 1.6 or later.<br />
*** The iconv extension is recommended for Moodle 1.6 or later.<br />
*** [http://www.libgd.org/ GD library] and the [http://www.freetype.org/ FreeType 2] library and extensions are needed to be able to look at the dynamic graphs that the logs pages make.<br />
*** The mysql extension is required if you are using the MySQL database. Note that in some Linux distributions (notably Red Hat) this is an optional installation.<br />
*** The pgsql extension is required if you are using the PostgreSQL database.<br />
*** The zlib extension is required for zip/unzip functionality.<br />
*** The curl extension is recommended for Moodle 1.8 or later.<br />
*** The tokenizer extension is recommended for Moodle 1.8 or later.<br />
*** The curl and openssl extensions are required for the Moodle network functionality (Moodle 1.8 or later).<br />
*** Other PHP extensions may be required to support optional Moodle functionality, especially external authentication and/or enrolment (e.g. LDAP extension for LDAP authentication and the sockets extension for Chat server).<br />
* A working database server: [[MySQL]] or [[PostgreSQL]] are completely supported and recommended for use with any version of Moodle. Support for Microsoft SQL Server and Oracle has been added in Moodle 1.7. MySQL is ''the'' choice for many people because it is very popular, but there are some [[Arguments in favour of PostgreSQL|arguments in favour of PostgreSQL]], especially if you are planning a large deployment. <br />
** For Moodle 1.5 or later, MySQL (version 3.23 or later) or PostgreSQL (7.4 or later). <br />
** For Moodle 1.6 or later, MySQL (version 4.1.12 or later) or PostgreSQL (7.4 or later).<br />
** For Moodle 1.7 or later, MySQL (version 4.1.12 or later), PostgreSQL (7.4 or later) or Microsoft SQL Server 2005 (version 9 or [http://moodle.org/mod/forum/discuss.php?d=59284 SQL Server Express 2005])<br />
: MySQL Notes: For Moodle 1.6 or later, If you use latin languages only you can use MySQL 4.1.12. If you are using non-latin languages you require MySQL 4.1.16 or later. Currently the MySQL setting "strict mode" must be OFF (set to "" or "MYSQL40") in the MySQL configuration file. <br />
: PostgreSQL Notes: The minimum version of PostgreSQL is 7.4 and Moodle is widely used with 8.0 and 8.1.<br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<br />
== How many users? ==<br />
<br />
In addition to the hardware and software requirements, you will also need to think about the capacity of your Moodle installation in terms of the number of users it can handle. There are two numbers to plan for:<br />
<br />
* '''Browsing users''': the maximum number of users able to browse your Moodle site. This is the number of computers in your organization or on your course (whichever is greater).<br />
* '''Concurrent database users''': the maximum number of concurrent database users (needed for Moodle activities such as quizzes). This is the number of users who will be using Moodle at the same time. In an educational institution, use your timetable/roster to obtain this figure.<br />
<br />
Once you know these figures for your users, you can start work out if your Moodle installation can support this capacity. The exact number of users depends on your hardware/software/network combination. Usually the amount of memory installed (RAM) is the deciding factor but a faster overall processor speed will also help in reducing waiting times for pages to load. <br />
<br />
The general rule of thumb for a single server is that the approx max concurrent users = RAM (GB) * 50 and the approx max browsing users = Approx max concurrent users * 5. As an example, a university with 500 total computers on campus and 100 concurrent users at any time will need approx 2GB of RAM on the one server to support the number of concurrent users.<br />
<br />
'''Note if you are using a hosted account''': Ask your provider what limits are placed on the number of concurrent database connections and the processor load. This will give a good estimate of the number of users your Moodle install can manage.<br />
<br />
'''Note:''' As of August 31, 2007, the moodle 1.8.2+ codes are still not suitable for large installation, especially if you have large number (e.g. 20,000+) of courses. The main reason is the codes related to ROLES are still not fully optimized with database queries and still need some work. If you are planning to use 1.8.x codes for a larger institution, please make sure that you have sufficient time to do your own testing and performance profiling.<br />
<br />
[Update] This performance issue has been improved quite a bit in the most recent 1.8.3+ version (see this thread discussion: http://moodle.org/mod/forum/discuss.php?d=83281). However, you should still plan with caution if you are planning to use Moodle 1.8.x code base for larger installation.<br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<br />
== Download and copy files into place ==<br />
<br />
There are two ways to get Moodle, either as a compressed package or via CVS. <br />
* There are two types of compressed packages on the [http://download.moodle.org/ download page: http://download.moodle.org/], the standard distribution with Moodle only files and the [[Complete install packages|complete install]], which contains programs to operate Moodle in a web environment. <br />
* To use CVS, helpful instructions are available at the [[CVS_for_Administrators | CVS for Administrators]] page. The full [http://cvs.moodle.org/moodle/ Moodle CVS repository] is also available for browsing. <br />
<br />
After downloading, unpack the archive using either <br />
tar -zxvf [filename]<br />
or<br />
unzip [filename]<br />
as appropriate. <br />
<br />
If using CVS, run the CVS Checkout command.<br />
<br />
You will now be left with a directory called "moodle", containing a number of files and folders.<br />
<br />
You can either place the whole folder in your web server documents directory, in which case the site will be located at '''<nowiki>http://yourwebserver.com/moodle</nowiki>''', or you can copy all the contents straight into the main web server documents directory, in which case the site will be simply '''<nowiki>http://yourwebserver.com</nowiki>'''.<br />
<br />
If you are downloading Moodle to your local computer and then uploading it to your web site, it is usually better to upload the whole archive as one file, and then do the unpacking on the server. Even web hosting interfaces like cPanel allow you to uncompress archives in the "File Manager".<br />
<br />
=== Structure of moodle directory ===<br />
<br />
You can safely skip this section, but here is a quick summary of the contents of the Moodle folder, to help get you oriented:<br />
<br />
:''config.php'' - contains basic settings. This file does not come with Moodle - you will create it.<br />
:''install.php'' - the script you will run to create config.php<br />
:''version.php'' - defines the current version of Moodle code<br />
:''index.php'' - the front page of the site<br />
:''admin/'' - code to administrate the whole server<br />
:''auth/'' - plugin modules to authenticate users<br />
:''blocks/'' - plugin modules for the little side blocks on many pages<br />
:''calendar/'' - all the code for managing and displaying calendars<br />
:''course/'' - code to display and manage courses<br />
:''doc/'' - help documentation for Moodle (eg this page)<br />
:''files/'' - code to display and manage uploaded files<br />
:''lang/'' - texts in different languages, one directory per language<br />
:''lib/'' - libraries of core Moodle code<br />
:''login/'' - code to handle login and account creation<br />
:''mod/'' - all the main Moodle course modules are in here<br />
:''pix/'' - generic site graphics<br />
:''theme/'' - theme packs/skins to change the look of the site.<br />
:''user/'' - code to display and manage users<br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<br />
== Setting-up your system==<br />
To ensure that Moodle will install successfully, you need to check that the web server settings are correct, then create a blank database for Moodle to use and finally create a directory on your hard disk for Moodle to save your materials and other files you upload into your courses.<br />
<br />
=== Check web server settings ===<br />
<br />
*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. Mine usually looks like this:<br />
<br />
'''DirectoryIndex''' index.php index.html index.htm<br />
<br />
:Just make sure index.php is in the list (and preferably towards the start of the list, for efficiency).<br />
<br />
*Secondly, '''if you are using Apache 2''', then you should turn on the ''AcceptPathInfo'' variable, which allows scripts to be passed arguments like <nowiki>http://server/file.php/arg1/arg2</nowiki>. 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.<br />
<br />
'''AcceptPathInfo''' on<br />
<br />
=== Check PHP settings ===<br />
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'''):<br />
<br />
magic_quotes_gpc = 1 (preferred but not necessary)<br />
magic_quotes_runtime = 0 (necessary)<br />
file_uploads = 1<br />
session.auto_start = 0<br />
session.bug_compat_warn = 0<br />
<br />
:You may also want to set other, optional php.ini file settings while you are already editing it. For instance, you may want to reset the maximum upload size of file attachments, which usually defaults to 2M(egabytes). For instance, to set these to 16 Megabytes:<br />
<br />
post_max_size = 16M<br />
upload_max_filesize = 16M<br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<br />
=== Using a .htaccess file for webserver and PHP settings ===<br />
<br />
Use the above if you can directly edit your server's files, but if you are setting-up Moodle on a webhost, or 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. This only works on Apache servers and only when Overrides have been allowed in the main Apache configuration.<br />
<br />
* Create a file called '''.htaccess''' in Moodle's main directory that contains lines like the following. <br />
<br />
DirectoryIndex index.php index.html index.htm<br />
php_flag magic_quotes_gpc 1<br />
php_flag magic_quotes_runtime 0<br />
php_flag file_uploads 1<br />
php_flag session.auto_start 0<br />
php_flag session.bug_compat_warn 0<br />
<br />
:If you have Apache version 2 installed, add these lines:<br />
<br />
<IfDefine APACHE2><br />
AcceptPathInfo on<br />
</IfDefine><br />
<br />
:Otherwise add this single line:<br />
<br />
AcceptPathInfo on<br />
<br />
* Optionally, you can also do things like define the maximum size for uploaded files, etc by adding these lines:<br />
<br />
LimitRequestBody 0<br />
php_value upload_max_filesize 2M<br />
php_value post_max_size 2M<br />
<br />
* 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:<br />
<br />
cp lib/htaccess .htaccess<br />
<br />
'''Note''': Use a .htaccess file only [http://httpd.apache.org/docs/1.3/howto/htaccess.html#when as a last resort] as it can have an impact on the performance of your Moodle site and cause pages to load slowly on your browser.<br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<br />
=== Creating an empty database ===<br />
<br />
You need to create an empty database (eg "''moodle''") in your database system along with a special user (eg "moodleuser") that has access to that database (and that database only). You could use the "root" user if you wanted to for a test server, but this is not recommended for a production system: if hackers manage to discover the password then your whole database system would be at risk, rather than just one database.<br />
<br />
::'''Warning''': Bear in mind that, as of Moodle version 1.5.x, Moodle doesn't work with MySQL 5.x's strict mode setting (STRICT_TRANS_TABLES and/or STRICT_ALL_TABLES) -- see [http://moodle.org/mod/forum/discuss.php?d=58552 forum discussion]. So if you are using MySQL 5.x, edit MySQL's configuration file (called "my.ini" in Windows and "my.cnf" on Unix/Linux) and comment out that option or set it to <code>sql-mode=<nowiki>''</nowiki></code>. You have to restart MySQL after changing this setting. <br><br> If you do not have access to your server, use PHPMyAdmin (or another MySQL client) and enter the command <code>SET @@global.sql_mode=<nowiki>''</nowiki>;</code> (be sure to use single quotes, and don't forget the semicolon).<br />
<br />
<table style=background-color:lightCyan border=1 cellpadding=5 cellspacing=0 ><tr><td><br />
====Using a hosted server====<br />
If you are using a webhost, they will probably have a control panel web interface for you to create your database.<br />
<br />
The '''[http://www.cpanel.com/ cPanel]''' system is one of the most popular of these. <br />
To create a database using cPanel:<br />
<br />
# Click on the '''MySQL Databases''' icon.<br />
# Type '''moodle''' in the New Database field and click '''Create Database'''.<br />
# Type a ''username'' and ''password'' (not one you use elsewhere) in the respective fields and click '''Create User'''.<br>Note that the ''username'' and ''database'' names may be prefixed by your cPanel account name and an underscore, and truncated to 16 characters. When entering this information into the Moodle installer - use the full names.<br />
# Now use the '''Add Users to Databases''' button and give this new user account '''ALL''' rights to the new database.<br />
<br />
Continue with [[Installing_Moodle#CreatDataDir |Creating the data directory]]<br />
<br />
</table><br />
<br />
====Using the command line====<br />
<br />
If you have access to Unix or Windows command lines then you can do the same sort of thing by typing commands. You should do this using the MySQL Client program as follows (commands which you type-in are shown in bold):<br />
<br />
- Start the MySQL Client program:<br />
#'''mysql -u root -p'''<br />
Enter password:<br />
Welcome to the MySQL monitor. Commands end with ; or \g.<br />
Your MySQL connection id is 2 to server version: 5.0.22-log<br />
<br />
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.<br />
<br />
mysql><br />
<br />
- The prompt changes to "mysql>" to indicate that you are now working in the MySQL Client program. When working in MySQL, all commands which you type-in must end in a semi-colon. (If you hit the Enter key without the final semi-colon, you'll get the line continuation symbol '->'; this is your second chance to type the semi-colon and hit Enter.) <br />
<br />
- Begin by checking for any existing databases called "moodle" - if there are any you should change the name in all the commands which follow:<br />
mysql> '''SHOW DATABASES;'''<br />
+-------------------------+<br />
| Database |<br />
+-------------------------+<br />
| information_schema |<br />
| mysql |<br />
| test |<br />
+-------------------------+<br />
3 rows in set (0.03 sec)<br />
<br />
- Create a database to store the Moodle tables. We'll call this "moodle", as there are none with that name already in the above list, but change it if you need to.<br />
mysql> '''CREATE DATABASE moodle;'''<br />
Query OK, 1 row affected (0.00 sec)<br />
<br />
- Change the default character set and collation of the "moodle" database to UTF8. Leave this out if you are installing Moodle 1.5 or earlier):<br />
mysql> '''ALTER DATABASE moodle DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;'''<br />
Query OK, 1 row affected (0.00 sec)<br />
<br />
- Create a username and password to access the database "moodle" and grant database access permissions. We'll call the user "moodleuser" and set the password as "yourpassword". It's a good idea to change these for your installation however most people keep the username as "moodleuser". Remember the username and password you have set, as you'll need it in the configuration screens later. This is a long command so has been split over several lines by pressing the Return key.<br />
mysql> '''GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,'''<br />
-> '''DROP,INDEX,ALTER ON moodle.*'''<br />
-> '''TO moodleuser@localhost IDENTIFIED BY 'yourpassword';'''<br />
Query OK, 0 rows affected (0.01 sec)<br />
<br />
:'''Security Warnings''': Never leave the password as the one shown here. Make sure you have a strong password (a mixture of letters and numbers, upper and lower case). Avoid granting "ALL" permissions on the database.<br />
: '''Note''': For MySQL 4.0.1 or earlier, you don't need the CREATE TEMPORARY TABLES permission. <br />
<br />
- Exit the MySQL Client program:<br />
mysql> '''QUIT'''<br />
Bye<br />
#<br />
<br />
- Reload the grant tables using the mysqladmin program:<br />
#'''mysqladmin -u root -p reload'''<br />
Enter password:<br />
#<br />
<br />
And some example command lines for PostgreSQL:<br />
<br />
# su - postgres<br />
> psql -c "create user moodleuser createdb;" template1<br />
> psql -c "create database moodle <font color="red">with encoding 'unicode'</font>;" -U moodleuser template1<br />
> psql -c "alter user moodleuser nocreatedb;" template1<br />
> psql -c "alter user moodleuser with encrypted password 'yourpassword';" template1<br />
> su - root<br />
# /etc/init.d/postgresql reload<br />
<br />
If the Postgres create database command above (>psql -c "create database moodle...") gives an error message you may want to try:<br />
psql -c "create database moodle with template=template1 encoding = 'unicode' owner = moodleuser <br> location = '/var/mydata';"<br />
<br />
If the create database command asks you for a password, run the line containing 'encrypted password' first before proceeding.<br />
<br />
'''See also''':<br />
* Step-by-step instructions on [https://docs.moodle.org/en/Step-by-step_Install_Guide_for_Ubuntu installation for Ubuntu(Debian)]<br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<div id=CreatDataDir ><br />
<br />
=== Creating the data directory ===<br />
<br />
Moodle will also need some space on your server's hard disk to store uploaded files, such as course documents and user pictures. The Moodle installer tries hard to create the '''moodledata''' directory for you but if it fails then you will have to create a directory for this purpose manually.<br />
<br />
'''Security warning''': For security purposes, it's best that this directory is NOT accessible directly via the web. The easiest way to do this is to simply locate it OUTSIDE the web directory, but if you must have it in the web directory (and you are using Apache) then protect it by creating a file in the data directory called '''.htaccess''', containing these lines:<br />
<br />
order deny,allow<br />
deny from all<br />
<br />
'''Ownership & Permissions''': To make sure that Moodle can save uploaded files in this directory, check that the web server software has permission to read, write and execute in this directory. On Unix machines, this means setting the owner of the directory to be something like "nobody" or "apache", and then giving that user read, write and execute permissions. As an example, to change the owner to "nobody" you could use:<br />
<br />
chown -R nobody:apache moodledata<br />
<br />
To change the permissions so that the owner has read,write and execute permissions, use something like this:<br />
<br />
chmod -R 0770 moodledata<br />
<br />
'''Note''': If you are receiving permission denied messages, try ''chmod -R 0770 moodledata'' and then adjust the settings so that they are more secure. A more secure setting is ''chmod -R 0750 moodledata''. According to the comments in config-dist.php, "On hosting systems you might need to make sure that your group has no permissions at all while others have full permissions." To do this you could use ''chmod -R 707 moodledata''. See also the [[Security | security page]].<br />
<br />
Remember that by default moodle will issue a warning about moodle data directories created inside the web directory, but otherwise this directory can be located where you wish. You can later move or change the location of this directory, but if you do, be sure to edit the setting in the '''config.php''' file that sets this; e.g. if moodledata is under a directory called data, then it would look like this:<br />
<br />
$CFG->dataroot = '/data/moodledata';<br />
<br />
<table style=background-color:lightCyan border=1 cellpadding=5 cellspacing=0 ><tr><td><br />
<br />
'''CPanel and webhosts'''<br />
<br />
On cPanel systems you can use the "File Manager" to find the folder, click on it, then choose "Change Permissions". On many shared hosting servers, you will probably need to restrict all file access to your "group" (to prevent other webhost customers from looking at or changing your files), but provide full read/write access to everyone else (which will allow the web server to access your files). Speak to your server administrator if you are having trouble setting this up securely. In particular it will not be possible to create a usable data directory on sites that use a PHP feature known as "'''Safe Mode'''".<br />
</table><br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<br />
== Run the installer script to create config.php ==<br />
<br />
To run the installer script (install.php), just try to access your Moodle main URL using a web browser, or access '''<nowiki>http://yourserver/install.php</nowiki>''' directly.<br />
<br />
(The Installer will try to set a session cookie. If you get a popup warning in your browser make sure you accept that cookie!)<br />
<br />
Moodle will detect that configuration is necessary and will lead you through some screens to help you create a new configuration file called '''config.php'''. At the end of the process Moodle will try and write the file into the right location, otherwise you can press a button to download it from the installer and then upload '''config.php''' into the main Moodle directory on the server.<br />
<br />
Along the way the installer will test your server environment and give you suggestions about how to fix any problems. For most common issues these suggestions should be sufficient, but if you get stuck, check in the Installation Forum for more help.<br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<br />
== Go to the admin page to continue configuration ==<br />
<br />
Once the basic config.php has been correctly created in the previous step, trying to access the front page of your site will take you to the "admin" page for the rest of the configuration.<br />
<br />
The first time you access this admin page, you will be presented with a GPL "shrink wrap" agreement with which you must agree before you can continue with the setup.<br />
<br />
Now Moodle will start setting up your database and creating tables to store data. Firstly, the main database tables are created. You should see a number of SQL statements followed by status messages that look like this:<br />
<br />
CREATE TABLE course (<br />
id int(10) unsigned NOT NULL auto_increment,<br />
category int(10) unsigned NOT NULL default '0',<br />
password varchar(50) NOT NULL default <nowiki>''</nowiki>,<br />
fullname varchar(254) NOT NULL default <nowiki>''</nowiki>,<br />
shortname varchar(15) NOT NULL default <nowiki>''</nowiki>,<br />
summary text NOT NULL,<br />
format tinyint(4) NOT NULL default '1',<br />
teacher varchar(100) NOT NULL default 'Teacher',<br />
startdate int(10) unsigned NOT NULL default '0',<br />
enddate int(10) unsigned NOT NULL default '0',<br />
timemodified int(10) unsigned NOT NULL default '0',<br />
PRIMARY KEY (id)<br />
) TYPE=MyISAM;<br />
<br />
<font color="green">SUCCESS</font><br />
<br />
...and so on, followed by: <font color="green">Main databases set up successfully.</font><br />
<br />
If you don't see these, then there must have been some problem with the database or the configuration settings you defined in config.php. Check that PHP isn't in a restricted "Safe Mode" (commercial web hosts sometimes have safe mode turned on). You can check PHP variables by creating a little file containing '''<?php phpinfo() ?>''' and looking at it through a browser. Check all these and try this page again.<br />
<br />
Scroll down the very bottom of the page and press the "Continue" link.<br />
<br />
You should now see a form where you can define more configuration variables for your installation, such as the default language, SMTP hosts and so on. Don't worry too much about getting everything right just now - you can always come back and edit these later on using the admin interface. The defaults are designed to be useful and secure for most sites. Scroll down to the bottom and click "Save changes".<br />
<br />
If (and only if) you find yourself getting stuck on this page, unable to continue, then your server probably has what I call the "buggy referrer" problem. This is easy to fix: just turn off the "secureforms" setting, then try to continue again.<br />
<br />
Next you will see more pages that print lots of status messages as they set up all the tables required by the various Moodle module. As before, they should all be <font color="green">green</font>.<br />
<br />
Scroll down the very bottom of the page and press the "Continue" link.<br />
<br />
The next page is a form where you can define parameters for your Moodle site and the front page, such as the name, format, description and so on. Fill this out (you can always come back and change these later) and then press "Save changes".<br />
<br />
Finally, you will then be asked to create a top-level administration user for future access to the admin pages. Fill out the details with your own name, email etc and then click "Save changes". Not all the fields are required, but if you miss any important fields you'll be re-prompted for them.<br />
<br />
'''Make sure you remember the username and password you chose for the administration user account, as they will be necessary to access the administration page in future.'''<br />
<br />
(If for any reason your install is interrupted, or there is a system error of some kind that prevents you from logging in using the admin account, you can usually log in using the default username of "'''admin'''", with password "'''admin'''".)<br />
<br />
Once successful, you will be returned to the home page of your new site! Note the administration links that appear down the left hand side of the page (these items also appear on a separate Admin page) - these items are only visible to you because you are logged in as the admin user. All your further administration of Moodle can now be done using this menu, such as:<br />
<br />
* creating and deleting courses<br />
* creating and editing user accounts<br />
* administering teacher accounts<br />
* changing site-wide settings like themes etc<br />
<br />
But you are not done installing yet! There is one very important thing still to do (see the next section on cron).<br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<br />
== Set up cron ==<br />
<br />
Please refer to the [[Cron|Cron instructions]].<br />
<br />
== Set up backups ==<br />
<br />
Please refer to the [[Backup settings| backup instructions]].<br />
<br />
<br />
[[Installing_Moodle#Table_of_Contents|Table of Contents]]<br />
<br />
== Create a new course ==<br />
<br />
Now that Moodle is running properly, you can try creating a new course to play with.<br />
<br />
Select "Create a new course" from the Admin page (or the admin links on the home page).<br />
<br />
Fill out the form, paying special attention to the course format. You don't have to worry about the details too much at this stage, as everything can be changed later by the teacher. Note that the yellow help icons are everywhere to provide contextual help on any aspect.<br />
<br />
Press "Save changes", and you will be taken to a new form where you can assign teachers to the course. You can only add existing user accounts from this form - if you want to create a new teacher account then either ask the teacher to create one for themselves (see the login page), or create one for them using the "Add a new user" on the Admin page.<br />
<br />
Once done, the course is ready to customize, and is accessible via the "Courses" link on the home page.<br />
<br />
==See also==<br />
<br />
* [[Installation FAQ]]<br />
*[[Complete install packages]] might be an easier first time installs on some systems<br />
* [[Installing Apache, MySQL and PHP]] - Open source programs that can run Moodle on the web or on a desktop<br />
* [[Upgrading Moodle]]<br />
* Using Moodle [http://moodle.org/mod/forum/discuss.php?d=42688 Selecting a web host for Moodle] forum discussion<br />
* [[masquerading|Masquerading]] - Running Moodle behind a masquerading/NAT firewall<br />
<br />
[[Category:Installation]]<br />
<br />
[[cs:Instalace]]<br />
[[de:Installieren von Moodle]]<br />
[[es:Instalación de moodle]]<br />
[[fr:Installation de Moodle]]<br />
[[ja:Moodleのインストール]]<br />
[[nl:Installatiegids]]<br />
[[pl:Instalacja Moodle]]<br />
[[pt:Instalação do Moodle]]<br />
[[ru:Установка Moodle]]<br />
[[sk:Inštalácia]]<br />
[[zh:安装Moodlezh:]]</div>Kawhttps://docs.moodle.org/20/en/index.php?title=Performance_recommendations&diff=34188Performance recommendations2008-03-28T23:57:03Z<p>Kaw: /* MySQL performance */ Added link to MyISAM vs InnoDB forum discussion</p>
<hr />
<div>Location: ''Administration > Server > Performance''<br />
<br />
<br />
Moodle can be made to perform very well, at small usage levels or scaling up to many thousands of users. The factors involved in performance are basically the same as for any PHP-based database-driven system. When trying to optimize your server, try to focus on the factor which will make the most difference to the user. For example, if you have relatively more users browsing than accessing the database, look to improve the webserver performance.<br />
<br />
<br />
==Obtain a baseline benchmark==<br />
<br />
Before attempting any optimization, you should obtain a baseline benchmark of the component of the system you are trying to improve. For Linux try [http://lbs.sourceforge.net/ LBS] and for Windows use the Performance Monitor. Once you have quantitative data about how your system is performing currently, you'll be able to determine if the change you have made as has any real impact.<br />
<br />
The overall aim of adjustments to improve performance is to use RAM (cacheing) and to reduce disk-based activity. It is especially important to try to eliminate swap file usage as much as you can. If your system starts swapping, this is a sign that you need more RAM. <br />
<br />
The '''optimization order preference''' is usually: primary storage (more RAM), secondary storage (faster hard disks/improved hard disk configuration), processor (more and faster).<br />
<br />
==Scalability==<br />
<br />
Moodle's design (with clear separation of application layers) allows for strongly scalable setups. (Please check the list of [[Large installations|large Moodle installations]].)<br />
<br />
Large sites usually separate the web server and database onto separate servers, although for smaller installations this is typically not necessary.<br />
<br />
It is possible to load-balance a Moodle installation, for example by using more than one webserver. The separate webservers should query the same database and refer to the same filestore area, but otherwise the separation of the application layers is complete enough to make this kind of clustering feasible. Similarly, the database could be a cluster of servers (e.g. a MySQL cluster), but this is not an easy task and you should seek expert support, e.g. from a Moodle Partner.<br />
<br />
'''See also''': <br />
*[http://moodle.org/mod/forum/discuss.php?d=4801 Scalability] forum discussion.<br />
*[http://moodle.org/mod/forum/discuss.php?d=57202 Moodle clustering] forum discussion.<br />
*[http://moodle.org/mod/forum/discuss.php?d=44470 Software load balancing] forum discussion.<br />
*[http://moodle.org/mod/forum/discuss.php?d=49986 TCP load balancing] forum dicsussion.<br />
<br />
==Hardware configuration==<br />
'''Note''': The fastest and most effective change that you can make to improve performance is to '''increase the amount of RAM on your web server''' - get as much as possible (eg 4GB). Increasing primary memory will reduce the need for processes to swap to disk and will enable your server to handle more users.<br />
* Better performance is gained by obtaining the best '''processor capability''' you can, i.e. dual or dual core processors. A modern BIOS should allow you to enable hyperthreading, but check if this makes a difference to the overall performance of the processors by using a [http://en.wikipedia.org/wiki/Super_PI CPU benchmarking tool].<br />
* If you can afford them, use '''SCSI hard disks''' instead of SATA drives. SATA drives will increase your system's CPU utilization, whereas SCSI drives have their own integrated processors and come into their own when you have multiple drives. If you must have SATA drives, check that your motherboard and the drives themselves support NCQ (Native Command Queuing).<br />
* Purchase hard disks with a '''low seek time'''. This will improve the overall speed of your system, especially when accessing Moodle's reports.<br />
* Size your '''swap file''' correctly. The general advice is to set it to 4 x physical RAM.<br />
* Use a '''RAID disk system'''. Although there are many different RAID configurations you can create, the following generally works best:<br />
** install a hardware RAID controller (if you can)<br />
** the operating system and swap drive on one set of disks configured as RAID-1.<br />
** Moodle, Web server and Database server on another set of disks configured as RAID-5.<br />
* Use '''gigabit ethernet''' for improved latency and throughput. This is especially important when you have your webserver and database server separated out on different hosts.<br />
* Check the settings on your '''network card'''. You may get an improvement in performance by increasing the use of buffers and transmit/receive descriptors (balance this with processor and memory overheads) and off-loading TCP checksum calculation onto the card instead of the OS.<br />
* Read this [http://moodle.org/mod/forum/discuss.php?d=68579 Case Study] on a server stress test with 300 users. <br />
* See this [http://elearning.sgu.ac.jp/doc/PT/ accompanying report] on network traffic and server loads.<br />
<br />
==Operating System==<br />
* You can use [http://en.wikipedia.org/wiki/Linux Linux](recommended), Unix-based, Windows or Mac OS X for the server '''operating system'''. *nix operating systems generally require less memory than Mac OS X or Windows servers for doing the same task as the server is configured with just a shell interface. Additionally Linux does not have licensing fees attached, but can have a big learning curve if you're used to another operating system. If you have a large number of processors running SMP, you may also want to consider using a highly tuned OS such as [http://en.wikipedia.org/wiki/Solaris_Operating_Environment Solaris].<br />
* Check your own OS and '''vendor specific instructions''' for optimization steps.<br />
** For Linux look at the [http://linuxperf.sourceforge.net/ Linux Performance Team] site. <br />
** For Linux investigate the hdparm command, e.g. hdparm -m16 -d1 can be used to enable read/write on multiple sectors and DMA. Mount disks with the async and noatime options.<br />
** For Windows set the sever to be optimized for network applications (Control Panel, Network Connections, LAN connection, Properties, File & Printer Sharing for Microsoft Networks, Properties, Optimization). You can also search the [http://technet.microsoft.com/ Microsoft TechNet site] for optimization documents.<br />
<br />
==Web server performance==<br />
<br />
Installing [http://www.mozilla.com/en-US/ Firefox] and the [https://addons.mozilla.org/en-US/firefox/addon/1843 firebug] extension will allow you to watch the time it takes for each page component to load. Also, the [https://addons.mozilla.org/en-US/firefox/addon/5369 Yslow] extension will evaluate your page against Yahoo's [http://www.skrenta.com/2007/05/14_rules_for_fast_web_pages_by_1.html 14 rules] ([http://video.yahoo.com/video/play?vid=1040890 video]) for fast loading websites.<br />
<br />
===PHP performance===<br />
* You are strongly recommended to use a '''PHP accelerator''' to ease CPU load, such as [http://pecl.php.net/apc APC], [http://www.php-accelerator.co.uk/ PHPA], [http://trac.lighttpd.net/xcache/ Xcache] or [http://eaccelerator.net/ eAccelerator]. (Take care to choose a PHP accelerator that is known to work well with your version of PHP and note that Turck MMCache is [http://turckmmcache.exeprod.com/TheManifestoEnglish no longer maintained] and can cause failures with PHP 5). <br />
* Improvements in read/write performance can be improved by putting the cached PHP pages on a [[TMPFS]] filesystem - but remember that you'll lose the cache contents when there is a power failure or the server is rebooted.<br />
* Performance of PHP is better when installed as an '''Apache/IIS ISAPI module''' (rather than a CGI).<br />
* Also check the '''memory_limit''' in php.ini, reduce it to 16M for Moodle version earlier than 1.7 ([http://moodle.org/mod/forum/discuss.php?d=39656 See this forum discussion]). For Moodle 1.7 or later, it is recommended that the value of memory_limit should be 40M. As of [http://www.php.net/ChangeLog-5.php PHP 5.2.1] the default value for the memory_limit directive is 128M.<br />
<br />
===Apache performance===<br />
* If you are using Apache on a Windows server, use the build from [http://www.apachelounge.com Apache Lounge] which is reported to have [http://moodle.org/mod/forum/discuss.php?d=93358 performance and stability improvements] compared to the official Apache download. Note that this is an unofficial build, so may not keep up with official releases.<br />
* Set the '''MaxClients''' directive correctly. Use this formula to help (which uses 80% of available memory to leave room for spare):<br />
MaxClients = Total available memory * 80% / Max memory usage of apache process<br />
:Memory usage of apache process is usually 10MB, so a general rule of thumb is to divide your available memory in megabytes by 10 to get the value of MaxClients. To find the max memory usage of apache processes read the value from the shell command:<br />
#ps -ylC httpd --sort:rss<br />
<br />
:If you need to increase the value of '''MaxClients''' beyond 256, you will also need to set the '''ServerLimit''' directive. <br />
<br />
:'''Warning''': Do not be tempted to set the value of MaxClients higher than your available memory as your server will consume more RAM than available and start to swap to disk. <br />
* Consider reducing the '''number of modules''' that Apache loads in the httpd.conf file to the minumum necessary to reduce the memory needed. <br />
* Use the '''latest version of Apache''' - Apache 2 has an improved memory model which reduces memory usage further.<br />
* For Unix/Linux systems, consider lowering '''MaxRequestsPerChild''' in httpd.conf to as low as 20-30 (if you set it any lower the overhead of forking begins to outweigh the benefits). <br />
* For a heavily loaded server, consider setting '''KeepAlive Off''' (do this only if your Moodle pages do not contain links to resources or uploaded images) or lowering the '''KeepAliveTimeout''' to between 2 and 5. The default is 15 (seconds) - the higher the value the more server processes will be kept waiting for possibly idle connections. A more accurate value for KeepAliveTimeout is obtained by observing how long it takes your users to download a page. After altering any of the KeepAlive variables, monitor your CPU utilization as there may be an additional overhead in initiating more worker processes/threads.<br />
* As an alternative to using KeepAlive Off, consider setting-up a '''Reverse Proxy server''' infront of the Moodle server to cache HTML files with images. You can then return Apache to using keep-alives on the Moodle server.<br />
* If you do not use a .htaccess file, set the '''AllowOverride''' variable to AllowOverride None to prevent .htaccess lookups.<br />
* Set '''DirectoryIndex''' correctly so as to avoid content-negotiation. Here's an example from a production server:<br />
DirectoryIndex index.php index.html index.htm<br />
* Unless you are doing development work on the server, set '''ExtendedStatus Off''' and disable mod_info as well as mod_status.<br />
* Leave '''HostnamesLookups Off''' (as default) to reduce DNS latency.<br />
* Consider reducing the value of '''TimeOut''' to between 30 to 60 (seconds). <br />
* For the '''Options directive''', avoid Options Multiviews as this performs a directory scan. To reduce disk I/O further use<br />
Options -Indexes FollowSymLinks<br />
*'''Caching''' - Apache can be told to make pages load a lot faster by specifying that the browser should cache some various page elements such as images and reuse them from local memory rather than ask for them again every time a page is requested. How to do this varies slightly between OSes but there are two basic steps:<br />
<br />
# Install and enable mod_expires - refer to documentation or man pages<br />
# Add this code to the virtual server config file within the <directory> section for the root directory (or within the .htaccess file if AllowOverrides is On):<br />
<IfModule mod_expires.c><br />
ExpiresActive On<br />
ExpiresDefault "access plus 1 seconds"<br />
ExpiresByType text/html "access plus 1 seconds"<br />
ExpiresByType image/gif "access plus 1 week"<br />
ExpiresByType image/jpeg "access plus 1 week"<br />
ExpiresByType image/png "access plus 1 week"<br />
ExpiresByType text/css "access plus 1 week"<br />
ExpiresByType text/javascript "access plus 1 week"<br />
ExpiresByType application/x-javascript "access plus 1 week"<br />
ExpiresByType text/xml "access plus 1 seconds"<br />
</IfModule><br />
<br />
The effect is to make everything stay in the cache except HTML and XML, which change dynamically. It's possible to gain a several hundred percent decrease in load times this way. Adjust the cache times according to how often your images etc change.<br />
<br />
More info: [http://www.metaskills.net/blog/heuristics/sysadmin/how-to-control-browser-caching-with-apache-2 www.metaskills.net]<br />
<br />
===IIS performance===<br />
All alter this location in the registry:<br />
HKLM\SYSTEM\CurrentControlSet\Services\Inetinfo\Parameters\<br />
* The equivalent to KeepAliveTimeout is '''ListenBackLog''' (IIS - registry location is HKLM\ SYSTEM\ CurrentControlSet\ Services\ Inetinfo\ Parameters). Set this to between 2 to 5.<br />
*Change the '''MemCacheSize''' value to adjust the amount of memory (Mb) that IIS will use for its file cache (50% of available memory by default).<br />
*Change the '''MaxCachedFileSize''' to adjust the maximum size of a file cached in the file cache in bytes. Default is 262,144 (256K).<br />
*Create a new DWORD called '''ObjectCacheTTL''' to change the length of time (in milliseconds) that objects in the cache are held in memory. Default is 30,000 milliseconds (30 seconds).<br />
<br />
===Lighttpd performance===<br />
You can increase web server performance by using the '''light-weight webserver''' [http://www.lighttpd.net/ lighttpd] in combination with PHP in fastCGI-mode. Lighttpd has a lower memory consumption than Apache - typically 10M for each process. See this [[lighttpd | MoodleDocs Lighttpd page]] for configuration and administration links.<br />
<br />
==Database performance==<br />
<br />
Moodle contains a script which will display some key database performance statistics from the [http://phplens.com/lens/adodb/docs-perf.htm ADOdb performance monitor]. Run the script in your browser as in the following example:<br />
<br />
http://www.mymoodle.com/admin/dbperformance.php<br />
<br />
Use the data displayed as a guide to tune and improve the performance of your database server.<br />
<br />
===MySQL performance===<br />
<br />
The following are MySQL specific settings which can be adjusted for better performance in your my.cnf (my.ini in Windows). The file contains a list of settings and their values. To see the current values use these commands<br />
SHOW STATUS;<br />
SHOW VARIABLES; <br />
'''Important''': You must make backups of your database before attempting to change any MySQL server configuration. After any change to the my.cnf, restart mysqld.<br />
* Enable the '''query cache''' with <br />
query_cache_type = 1. <br />
For most Moodle installs, set the following:<br />
query_cache_size = 36M <br />
query_cache_min_res_unit = 2K. <br />
The query cache will improve performance if you are doing few updates on the database. <br />
* Set the '''table cache''' correctly. For Moodle 1.6 set <br />
table_cache = 256 <br />
(min), and for Moodle 1.7 set <br />
table_cache = 512 <br />
(min). The table cache is used by all threads (connections), so monitor the value of opened_tables to further adjust - if opened_tables > 3 * table_cache then increase table_cache upto your OS limit. Note also that the figure for table_cache will also change depending on the number of modules and plugins you have installed. Find the number for your server by executing the mysql statement below. Look at the number returned and set table_cache to this value.<br />
mysql>SELECT COUNT(table_name) FROM information_schema.tables WHERE table_schema='yourmoodledbname';<br />
* Set the '''thread cache''' correctly. Adjust the value so that your thread cache utilization is as close to 100% as possible by this formula:<br />
thread cache utilization (%) = (threads_created / connections) * 100<br />
* The '''key buffer''' can improve the access speed to Moodle's SELECT queries. The correct size depends on the size of the index files (.myi) and in Moodle 1.6 or later (without any additional modules and plugins), the recommendation for this value is key_buffer_size = 32M. Ideally you want the database to be reading once from the disk for every 100 requests so monitor that the value is suitable for your install by adjusting the value of key_buffer_size so that the following formulas are true:<br />
key_read / key_read_requests < 0.01<br />
key_write / key_write_requests <= 1.0<br />
* Set the '''maximum number of connections''' so that your users will not see a "Too many connections" message. Be careful that this may have an impact on the total memory used. MySQL connections usually last for milliseconds, so it is unusual even for a heavily loaded server for this value to be over 200.<br />
* Manage '''high burst activity'''. If your Moodle install uses a lot of quizzes and you are experiencing performance problems (check by monitoring the value of threads_connected - it should not be rising) consider increasing the value of back_log.<br />
* '''Optimize your tables weekly and after upgrading Moodle'''. It is good practice to also optimize your tables after performing a large data deletion exercise, e.g. at the end of your semester or academic year. This will ensure that index files are up to date. Backup your database first and then use:<br />
mysql>CHECK TABLE mdl_tablename;<br />
mysql>OPTIMIZE TABLE mdl_tablename;<br />
:The common tables in Moodle to check are mdl_course_sections, mdl_forum_posts, mdl_log and mdl_sessions (if using dbsessions). Any errors need to be corrected using REPAIR TABLE (see the [http://dev.mysql.com/doc/refman/5.0/en/repair-table.html MySQL manual] and this [http://moodle.org/mod/forum/discuss.php?d=58208#p279638 forum script]).<br />
* '''Maintain the key distribution'''. Every month or so it is a good idea to stop the mysql server and run these myisamchk commands.<br />
#myisamchk -a -S /pathtomysql/data/moodledir/*.MYI<br />
:'''Warning''': You must stop the mysql database process (mysqld) before running any myisamchk command. If you do not, you risk data loss.<br />
* Reduce the number of '''temporary tables saved to disk'''. Check this with the created_tmp_disk_tables value. If this is relatively large (>5%) increase tmp_table_size until you see a reduction. Note that this will have an impact on RAM usage.<br />
* Moodle's tables are in the MyISAM format, so '''turn InnoDB off''' as there is no performance gain. Add <code>skip-innodb</code> to your <code>my.cnf</code> file. If you must use InnoDB, you'll have to convert all of Moodle's tables. To do this run the innodb script:<br />
<br />
http://www.mymoodle.com/admin/innodb.php<br />
<br />
:See also [http://moodle.org/mod/forum/discuss.php?d=12961 this forum discussion] which looks at the MyISAM vs InnoDB options.<br />
<br />
===Other database performance links===<br />
* Consider using a '''distributed cacheing system''' like [http://en.wikipedia.org/wiki/Memcached memcached] but note that memcached does not have any security features so it should be used behind a firewall.<br />
* Consider using PostgreSQL. See [[Arguments in favour of PostgreSQL]] and [http://moodle.org/mod/forum/discuss.php?d=49195 how to migrate from MySQL to PostgreSQL] (forum discussion).<br />
* [[Increasing the database connection lifetime | Try increasing the database connection lifetime]]<br />
* [http://dev.mysql.com/doc/refman/5.0/en/server-parameters.html General advice on tuning MySQL parameters] (advice from the MySQL manual)<br />
* [http://www.mysqlperformanceblog.com/2007/11/01/innodb-performance-optimization-basics/ InnoDB performance optimization] taken from the [http://www.mysqlperformanceblog.com/ MySQL performance blog] site.<br />
<br />
==Moodle Admin settings==<br />
* In Moodle 1.7 or later, set the '''Cache type''' for your server: Site Admin -> Server -> Performance -> Cache type. There are several options available. <br />
:*If you do not have eaccelerator or mmemcached installed, choose "internal" (which makes use of the record/internal cache - see the next bullet point). <br />
:* If you have a single server and have compiled '''eaccelerator with shared memory support''', set the cache type to the eaccelerator option. <br />
:* If you have a '''separate memcached server''', set the cache type to memcached and enter a csv list of server IP addresses.<br />
* Enable the '''record/internal cache''': Site Admin -> Server -> Performance -> Record cache = True. Set the maximum amount of memory allocated to the cache in the Int Cache Max box. This will enable a primary cache for database records, without using any database engine cache, e.g. MySQL/PostgreSQL cache. See [http://tracker.moodle.org/browse/MDL-7196 this Tracker entry] for a full discussion.<br />
* Enable the '''language cache'''.<br />
* Large log files can cause overall performance to degrade over time. If you observe that the site has gradually got slower loading pages in the browser, '''reduce your Log life time''' setting (Admin/Server/Cleanup).<br />
* Performance can be greatly improved by allowing Moodle to use the system '''zip/unzip''' commands (rather than PHP-based zip libraries) - visit Admin/Server/System Paths and enter the path to the relevant executables. (Similarly, filling in the path to '''du''' will improve Moodle's speed at listing directory contents.)<br />
* Note that using '''secure web connections''' ('''https''' rather than '''http''') carries a higher processing burden, both for the webserver and the client - particularly because cacheing cannot be used as effectively, so the number of file requests is likely to increase dramatically. For this reason using https for all Moodle pages is not recommended. You can enable https just for the login screen, simply from Moodle's config page.<br />
* Check your '''filters'''. Having too many filters active can have serious effects on server load, especially on lower-end systems. The number of active filters has a direct effect on the perceived latency of your site; that is the time taken for each page impression. <br />
* Enable the '''text cache''' but do not "Filter all strings" unless you have a specific need. If in doubt profile the performance, and see how your changes affect the processing time.<br />
* Check your '''anti-virus''' measures on the server. Although they are useful for preventing security holes being exploited, some "On-Demand" scanners can affect performance by scanning page content (word, ppt files etc).<br />
* If there are performance problems loading course pages, check the '''Resource module settings'''. The setting resource_filterexternalpages is known to slow-down course pages and should be set to 'No' for better performance.<br />
* Check your '''forum settings'''. To improve performance set forum_trackreadposts = No and forum_usermarksread = Yes (this will impact on the convenience of your users' forum experience). Also consider setting the time of the day when old posts are cleared from the read table (forum_cleanreadtime) to when your site is less busy.<br />
<br />
==Performance of different Moodle modules==<br />
<br />
Moodle's activity modules, filters, and other plugins can be activated/deactivated. If necessary, you may wish to deactivate some features (such as chat) if not required - but this isn't necessary. Some notes on the performance of certain modules:<br />
<br />
* The '''Chat''' module is [http://moodle.org/mod/forum/discuss.php?d=37979&parent=175079 said] to be a hog in terms of frequent HTTP requests to the main server. This can be reduced by setting the module to use ''Streamed'' updates, or, if you're using a Unix-based webserver, by running the chat in daemon mode. When using the Chat module use the configuration settings to tune for your expected load. Pay particular attention to the ''chat_old_ping'' and ''chat_refresh'' parameters as these can have greatest impact on server load.<br />
* The '''Quiz''' module is known to stretch database performance. Try to optimise your database server by tuning. See [http://moodle.org/mod/forum/discuss.php?d=25616&parent=120770 for a brief report on performance for 55 students simultaneously using quizzes]<br />
** See this Case Study for an extensive server stress test with 300 quiz users.[http://moodle.org/mod/forum/discuss.php?d=68579] And this accompanying report on network traffic and server loads. [http://elearning.sgu.ac.jp/doc/PT/]<br />
* The Moodle '''Cron''' task is triggered by calling the script ''cron.php''. If this is called over HTTP (e.g. using wget or curl) it can take a large amount of memory on large installations. If it is called by directly invoking the php command (e.g. ''php -f /path/to/moodle/directory/admin/cron.php'') efficiency can be much improved.<br />
<br />
==See also==<br />
<br />
*Using Moodle [http://moodle.org/mod/forum/view.php?f=94 Servers and Performance] forum<br />
<br />
There have been a lot of discussions on moodle.org about performance, here are some of the more interesting and (potentially) useful ones:<br />
<br />
* [http://moodle.org/mod/forum/discuss.php?d=83057 Performance woes!]<br />
* [http://moodle.org/mod/forum/discuss.php?d=57028 Performance perspectives - a little script]<br />
* [http://moodle.org/mod/forum/discuss.php?d=88927 Comments on planned server hardware]<br />
<br />
[[Category:Performance]]<br />
<br />
[[fr:Performance]]<br />
[[ja:パフォーマンス]]<br />
[[pl:Wydajność]]</div>Kawhttps://docs.moodle.org/20/en/index.php?title=Performance_recommendations&diff=34091Performance recommendations2008-03-28T08:49:52Z<p>Kaw: /* Hardware configuration */ Adjusted links</p>
<hr />
<div>Location: ''Administration > Server > Performance''<br />
<br />
<br />
Moodle can be made to perform very well, at small usage levels or scaling up to many thousands of users. The factors involved in performance are basically the same as for any PHP-based database-driven system. When trying to optimize your server, try to focus on the factor which will make the most difference to the user. For example, if you have relatively more users browsing than accessing the database, look to improve the webserver performance.<br />
<br />
<br />
==Obtain a baseline benchmark==<br />
<br />
Before attempting any optimization, you should obtain a baseline benchmark of the component of the system you are trying to improve. For Linux try [http://lbs.sourceforge.net/ LBS] and for Windows use the Performance Monitor. Once you have quantitative data about how your system is performing currently, you'll be able to determine if the change you have made as has any real impact.<br />
<br />
The overall aim of adjustments to improve performance is to use RAM (cacheing) and to reduce disk-based activity. It is especially important to try to eliminate swap file usage as much as you can. If your system starts swapping, this is a sign that you need more RAM. <br />
<br />
The '''optimization order preference''' is usually: primary storage (more RAM), secondary storage (faster hard disks/improved hard disk configuration), processor (more and faster).<br />
<br />
==Scalability==<br />
<br />
Moodle's design (with clear separation of application layers) allows for strongly scalable setups. (Please check the list of [[Large installations|large Moodle installations]].)<br />
<br />
Large sites usually separate the web server and database onto separate servers, although for smaller installations this is typically not necessary.<br />
<br />
It is possible to load-balance a Moodle installation, for example by using more than one webserver. The separate webservers should query the same database and refer to the same filestore area, but otherwise the separation of the application layers is complete enough to make this kind of clustering feasible. Similarly, the database could be a cluster of servers (e.g. a MySQL cluster), but this is not an easy task and you should seek expert support, e.g. from a Moodle Partner.<br />
<br />
'''See also''': <br />
*[http://moodle.org/mod/forum/discuss.php?d=4801 Scalability] forum discussion.<br />
*[http://moodle.org/mod/forum/discuss.php?d=57202 Moodle clustering] forum discussion.<br />
*[http://moodle.org/mod/forum/discuss.php?d=44470 Software load balancing] forum discussion.<br />
*[http://moodle.org/mod/forum/discuss.php?d=49986 TCP load balancing] forum dicsussion.<br />
<br />
==Hardware configuration==<br />
'''Note''': The fastest and most effective change that you can make to improve performance is to '''increase the amount of RAM on your web server''' - get as much as possible (eg 4GB). Increasing primary memory will reduce the need for processes to swap to disk and will enable your server to handle more users.<br />
* Better performance is gained by obtaining the best '''processor capability''' you can, i.e. dual or dual core processors. A modern BIOS should allow you to enable hyperthreading, but check if this makes a difference to the overall performance of the processors by using a [http://en.wikipedia.org/wiki/Super_PI CPU benchmarking tool].<br />
* If you can afford them, use '''SCSI hard disks''' instead of SATA drives. SATA drives will increase your system's CPU utilization, whereas SCSI drives have their own integrated processors and come into their own when you have multiple drives. If you must have SATA drives, check that your motherboard and the drives themselves support NCQ (Native Command Queuing).<br />
* Purchase hard disks with a '''low seek time'''. This will improve the overall speed of your system, especially when accessing Moodle's reports.<br />
* Size your '''swap file''' correctly. The general advice is to set it to 4 x physical RAM.<br />
* Use a '''RAID disk system'''. Although there are many different RAID configurations you can create, the following generally works best:<br />
** install a hardware RAID controller (if you can)<br />
** the operating system and swap drive on one set of disks configured as RAID-1.<br />
** Moodle, Web server and Database server on another set of disks configured as RAID-5.<br />
* Use '''gigabit ethernet''' for improved latency and throughput. This is especially important when you have your webserver and database server separated out on different hosts.<br />
* Check the settings on your '''network card'''. You may get an improvement in performance by increasing the use of buffers and transmit/receive descriptors (balance this with processor and memory overheads) and off-loading TCP checksum calculation onto the card instead of the OS.<br />
* Read this [http://moodle.org/mod/forum/discuss.php?d=68579 Case Study] on a server stress test with 300 users. <br />
* See this [http://elearning.sgu.ac.jp/doc/PT/ accompanying report] on network traffic and server loads.<br />
<br />
==Operating System==<br />
* You can use [http://en.wikipedia.org/wiki/Linux Linux](recommended), Unix-based, Windows or Mac OS X for the server '''operating system'''. *nix operating systems generally require less memory than Mac OS X or Windows servers for doing the same task as the server is configured with just a shell interface. Additionally Linux does not have licensing fees attached, but can have a big learning curve if you're used to another operating system. If you have a large number of processors running SMP, you may also want to consider using a highly tuned OS such as [http://en.wikipedia.org/wiki/Solaris_Operating_Environment Solaris].<br />
* Check your own OS and '''vendor specific instructions''' for optimization steps.<br />
** For Linux look at the [http://linuxperf.sourceforge.net/ Linux Performance Team] site. <br />
** For Linux investigate the hdparm command, e.g. hdparm -m16 -d1 can be used to enable read/write on multiple sectors and DMA. Mount disks with the async and noatime options.<br />
** For Windows set the sever to be optimized for network applications (Control Panel, Network Connections, LAN connection, Properties, File & Printer Sharing for Microsoft Networks, Properties, Optimization). You can also search the [http://technet.microsoft.com/ Microsoft TechNet site] for optimization documents.<br />
<br />
==Web server performance==<br />
<br />
Installing [http://www.mozilla.com/en-US/ Firefox] and the [https://addons.mozilla.org/en-US/firefox/addon/1843 firebug] extension will allow you to watch the time it takes for each page component to load. Also, the [https://addons.mozilla.org/en-US/firefox/addon/5369 Yslow] extension will evaluate your page against Yahoo's [http://www.skrenta.com/2007/05/14_rules_for_fast_web_pages_by_1.html 14 rules] ([http://video.yahoo.com/video/play?vid=1040890 video]) for fast loading websites.<br />
<br />
===PHP performance===<br />
* You are strongly recommended to use a '''PHP accelerator''' to ease CPU load, such as [http://pecl.php.net/apc APC], [http://www.php-accelerator.co.uk/ PHPA], [http://trac.lighttpd.net/xcache/ Xcache] or [http://eaccelerator.net/ eAccelerator]. (Take care to choose a PHP accelerator that is known to work well with your version of PHP and note that Turck MMCache is [http://turckmmcache.exeprod.com/TheManifestoEnglish no longer maintained] and can cause failures with PHP 5). <br />
* Improvements in read/write performance can be improved by putting the cached PHP pages on a [[TMPFS]] filesystem - but remember that you'll lose the cache contents when there is a power failure or the server is rebooted.<br />
* Performance of PHP is better when installed as an '''Apache/IIS ISAPI module''' (rather than a CGI).<br />
* Also check the '''memory_limit''' in php.ini, reduce it to 16M for Moodle version earlier than 1.7 ([http://moodle.org/mod/forum/discuss.php?d=39656 See this forum discussion]). For Moodle 1.7 or later, it is recommended that the value of memory_limit should be 40M. As of [http://www.php.net/ChangeLog-5.php PHP 5.2.1] the default value for the memory_limit directive is 128M.<br />
<br />
===Apache performance===<br />
* If you are using Apache on a Windows server, use the build from [http://www.apachelounge.com Apache Lounge] which is reported to have [http://moodle.org/mod/forum/discuss.php?d=93358 performance and stability improvements] compared to the official Apache download. Note that this is an unofficial build, so may not keep up with official releases.<br />
* Set the '''MaxClients''' directive correctly. Use this formula to help (which uses 80% of available memory to leave room for spare):<br />
MaxClients = Total available memory * 80% / Max memory usage of apache process<br />
:Memory usage of apache process is usually 10MB, so a general rule of thumb is to divide your available memory in megabytes by 10 to get the value of MaxClients. To find the max memory usage of apache processes read the value from the shell command:<br />
#ps -ylC httpd --sort:rss<br />
<br />
:If you need to increase the value of '''MaxClients''' beyond 256, you will also need to set the '''ServerLimit''' directive. <br />
<br />
:'''Warning''': Do not be tempted to set the value of MaxClients higher than your available memory as your server will consume more RAM than available and start to swap to disk. <br />
* Consider reducing the '''number of modules''' that Apache loads in the httpd.conf file to the minumum necessary to reduce the memory needed. <br />
* Use the '''latest version of Apache''' - Apache 2 has an improved memory model which reduces memory usage further.<br />
* For Unix/Linux systems, consider lowering '''MaxRequestsPerChild''' in httpd.conf to as low as 20-30 (if you set it any lower the overhead of forking begins to outweigh the benefits). <br />
* For a heavily loaded server, consider setting '''KeepAlive Off''' (do this only if your Moodle pages do not contain links to resources or uploaded images) or lowering the '''KeepAliveTimeout''' to between 2 and 5. The default is 15 (seconds) - the higher the value the more server processes will be kept waiting for possibly idle connections. A more accurate value for KeepAliveTimeout is obtained by observing how long it takes your users to download a page. After altering any of the KeepAlive variables, monitor your CPU utilization as there may be an additional overhead in initiating more worker processes/threads.<br />
* As an alternative to using KeepAlive Off, consider setting-up a '''Reverse Proxy server''' infront of the Moodle server to cache HTML files with images. You can then return Apache to using keep-alives on the Moodle server.<br />
* If you do not use a .htaccess file, set the '''AllowOverride''' variable to AllowOverride None to prevent .htaccess lookups.<br />
* Set '''DirectoryIndex''' correctly so as to avoid content-negotiation. Here's an example from a production server:<br />
DirectoryIndex index.php index.html index.htm<br />
* Unless you are doing development work on the server, set '''ExtendedStatus Off''' and disable mod_info as well as mod_status.<br />
* Leave '''HostnamesLookups Off''' (as default) to reduce DNS latency.<br />
* Consider reducing the value of '''TimeOut''' to between 30 to 60 (seconds). <br />
* For the '''Options directive''', avoid Options Multiviews as this performs a directory scan. To reduce disk I/O further use<br />
Options -Indexes FollowSymLinks<br />
*'''Caching''' - Apache can be told to make pages load a lot faster by specifying that the browser should cache some various page elements such as images and reuse them from local memory rather than ask for them again every time a page is requested. How to do this varies slightly between OSes but there are two basic steps:<br />
<br />
# Install and enable mod_expires - refer to documentation or man pages<br />
# Add this code to the virtual server config file within the <directory> section for the root directory (or within the .htaccess file if AllowOverrides is On):<br />
<IfModule mod_expires.c><br />
ExpiresActive On<br />
ExpiresDefault "access plus 1 seconds"<br />
ExpiresByType text/html "access plus 1 seconds"<br />
ExpiresByType image/gif "access plus 1 week"<br />
ExpiresByType image/jpeg "access plus 1 week"<br />
ExpiresByType image/png "access plus 1 week"<br />
ExpiresByType text/css "access plus 1 week"<br />
ExpiresByType text/javascript "access plus 1 week"<br />
ExpiresByType application/x-javascript "access plus 1 week"<br />
ExpiresByType text/xml "access plus 1 seconds"<br />
</IfModule><br />
<br />
The effect is to make everything stay in the cache except HTML and XML, which change dynamically. It's possible to gain a several hundred percent decrease in load times this way. Adjust the cache times according to how often your images etc change.<br />
<br />
More info: [http://www.metaskills.net/blog/heuristics/sysadmin/how-to-control-browser-caching-with-apache-2 www.metaskills.net]<br />
<br />
===IIS performance===<br />
All alter this location in the registry:<br />
HKLM\SYSTEM\CurrentControlSet\Services\Inetinfo\Parameters\<br />
* The equivalent to KeepAliveTimeout is '''ListenBackLog''' (IIS - registry location is HKLM\ SYSTEM\ CurrentControlSet\ Services\ Inetinfo\ Parameters). Set this to between 2 to 5.<br />
*Change the '''MemCacheSize''' value to adjust the amount of memory (Mb) that IIS will use for its file cache (50% of available memory by default).<br />
*Change the '''MaxCachedFileSize''' to adjust the maximum size of a file cached in the file cache in bytes. Default is 262,144 (256K).<br />
*Create a new DWORD called '''ObjectCacheTTL''' to change the length of time (in milliseconds) that objects in the cache are held in memory. Default is 30,000 milliseconds (30 seconds).<br />
<br />
===Lighttpd performance===<br />
You can increase web server performance by using the '''light-weight webserver''' [http://www.lighttpd.net/ lighttpd] in combination with PHP in fastCGI-mode. Lighttpd has a lower memory consumption than Apache - typically 10M for each process. See this [[lighttpd | MoodleDocs Lighttpd page]] for configuration and administration links.<br />
<br />
==Database performance==<br />
<br />
Moodle contains a script which will display some key database performance statistics from the [http://phplens.com/lens/adodb/docs-perf.htm ADOdb performance monitor]. Run the script in your browser as in the following example:<br />
<br />
http://www.mymoodle.com/admin/dbperformance.php<br />
<br />
Use the data displayed as a guide to tune and improve the performance of your database server.<br />
<br />
===MySQL performance===<br />
<br />
The following are MySQL specific settings which can be adjusted for better performance in your my.cnf (my.ini in Windows). The file contains a list of settings and their values. To see the current values use these commands<br />
SHOW STATUS;<br />
SHOW VARIABLES; <br />
'''Important''': You must make backups of your database before attempting to change any MySQL server configuration. After any change to the my.cnf, restart mysqld.<br />
* Enable the '''query cache''' with <br />
query_cache_type = 1. <br />
For most Moodle installs, set the following:<br />
query_cache_size = 36M <br />
query_cache_min_res_unit = 2K. <br />
The query cache will improve performance if you are doing few updates on the database. <br />
* Set the '''table cache''' correctly. For Moodle 1.6 set <br />
table_cache = 256 <br />
(min), and for Moodle 1.7 set <br />
table_cache = 512 <br />
(min). The table cache is used by all threads (connections), so monitor the value of opened_tables to further adjust - if opened_tables > 3 * table_cache then increase table_cache upto your OS limit. Note also that the figure for table_cache will also change depending on the number of modules and plugins you have installed. Find the number for your server by executing the mysql statement below. Look at the number returned and set table_cache to this value.<br />
mysql>SELECT COUNT(table_name) FROM information_schema.tables WHERE table_schema='yourmoodledbname';<br />
* Set the '''thread cache''' correctly. Adjust the value so that your thread cache utilization is as close to 100% as possible by this formula:<br />
thread cache utilization (%) = (threads_created / connections) * 100<br />
* The '''key buffer''' can improve the access speed to Moodle's SELECT queries. The correct size depends on the size of the index files (.myi) and in Moodle 1.6 or later (without any additional modules and plugins), the recommendation for this value is key_buffer_size = 32M. Ideally you want the database to be reading once from the disk for every 100 requests so monitor that the value is suitable for your install by adjusting the value of key_buffer_size so that the following formulas are true:<br />
key_read / key_read_requests < 0.01<br />
key_write / key_write_requests <= 1.0<br />
* Set the '''maximum number of connections''' so that your users will not see a "Too many connections" message. Be careful that this may have an impact on the total memory used. MySQL connections usually last for milliseconds, so it is unusual even for a heavily loaded server for this value to be over 200.<br />
* Manage '''high burst activity'''. If your Moodle install uses a lot of quizzes and you are experiencing performance problems (check by monitoring the value of threads_connected - it should not be rising) consider increasing the value of back_log.<br />
* '''Optimize your tables weekly and after upgrading Moodle'''. It is good practice to also optimize your tables after performing a large data deletion exercise, e.g. at the end of your semester or academic year. This will ensure that index files are up to date. Backup your database first and then use:<br />
mysql>CHECK TABLE mdl_tablename;<br />
mysql>OPTIMIZE TABLE mdl_tablename;<br />
:The common tables in Moodle to check are mdl_course_sections, mdl_forum_posts, mdl_log and mdl_sessions (if using dbsessions). Any errors need to be corrected using REPAIR TABLE (see the [http://dev.mysql.com/doc/refman/5.0/en/repair-table.html MySQL manual] and this [http://moodle.org/mod/forum/discuss.php?d=58208#p279638 forum script]).<br />
* '''Maintain the key distribution'''. Every month or so it is a good idea to stop the mysql server and run these myisamchk commands.<br />
#myisamchk -a -S /pathtomysql/data/moodledir/*.MYI<br />
:'''Warning''': You must stop the mysql database process (mysqld) before running any myisamchk command. If you do not, you risk data loss.<br />
* Reduce the number of '''temporary tables saved to disk'''. Check this with the created_tmp_disk_tables value. If this is relatively large (>5%) increase tmp_table_size until you see a reduction. Note that this will have an impact on RAM usage.<br />
* Moodle's tables are in the MyISAM format, so '''turn InnoDB off''' as there is no performance gain. Add <code>skip-innodb</code> to your <code>my.cnf</code> file. If you must use InnoDB, you'll have to convert all of Moodle's tables. To do this run the innodb script:<br />
<br />
http://www.mymoodle.com/admin/innodb.php<br />
<br />
===Other database performance links===<br />
* Consider using a '''distributed cacheing system''' like [http://en.wikipedia.org/wiki/Memcached memcached] but note that memcached does not have any security features so it should be used behind a firewall.<br />
* Consider using PostgreSQL. See [[Arguments in favour of PostgreSQL]] and [http://moodle.org/mod/forum/discuss.php?d=49195 how to migrate from MySQL to PostgreSQL] (forum discussion).<br />
* [[Increasing the database connection lifetime | Try increasing the database connection lifetime]]<br />
* [http://dev.mysql.com/doc/refman/5.0/en/server-parameters.html General advice on tuning MySQL parameters] (advice from the MySQL manual)<br />
* [http://www.mysqlperformanceblog.com/2007/11/01/innodb-performance-optimization-basics/ InnoDB performance optimization] taken from the [http://www.mysqlperformanceblog.com/ MySQL performance blog] site.<br />
<br />
==Moodle Admin settings==<br />
* In Moodle 1.7 or later, set the '''Cache type''' for your server: Site Admin -> Server -> Performance -> Cache type. There are several options available. <br />
:*If you do not have eaccelerator or mmemcached installed, choose "internal" (which makes use of the record/internal cache - see the next bullet point). <br />
:* If you have a single server and have compiled '''eaccelerator with shared memory support''', set the cache type to the eaccelerator option. <br />
:* If you have a '''separate memcached server''', set the cache type to memcached and enter a csv list of server IP addresses.<br />
* Enable the '''record/internal cache''': Site Admin -> Server -> Performance -> Record cache = True. Set the maximum amount of memory allocated to the cache in the Int Cache Max box. This will enable a primary cache for database records, without using any database engine cache, e.g. MySQL/PostgreSQL cache. See [http://tracker.moodle.org/browse/MDL-7196 this Tracker entry] for a full discussion.<br />
* Enable the '''language cache'''.<br />
* Large log files can cause overall performance to degrade over time. If you observe that the site has gradually got slower loading pages in the browser, '''reduce your Log life time''' setting (Admin/Server/Cleanup).<br />
* Performance can be greatly improved by allowing Moodle to use the system '''zip/unzip''' commands (rather than PHP-based zip libraries) - visit Admin/Server/System Paths and enter the path to the relevant executables. (Similarly, filling in the path to '''du''' will improve Moodle's speed at listing directory contents.)<br />
* Note that using '''secure web connections''' ('''https''' rather than '''http''') carries a higher processing burden, both for the webserver and the client - particularly because cacheing cannot be used as effectively, so the number of file requests is likely to increase dramatically. For this reason using https for all Moodle pages is not recommended. You can enable https just for the login screen, simply from Moodle's config page.<br />
* Check your '''filters'''. Having too many filters active can have serious effects on server load, especially on lower-end systems. The number of active filters has a direct effect on the perceived latency of your site; that is the time taken for each page impression. <br />
* Enable the '''text cache''' but do not "Filter all strings" unless you have a specific need. If in doubt profile the performance, and see how your changes affect the processing time.<br />
* Check your '''anti-virus''' measures on the server. Although they are useful for preventing security holes being exploited, some "On-Demand" scanners can affect performance by scanning page content (word, ppt files etc).<br />
* If there are performance problems loading course pages, check the '''Resource module settings'''. The setting resource_filterexternalpages is known to slow-down course pages and should be set to 'No' for better performance.<br />
* Check your '''forum settings'''. To improve performance set forum_trackreadposts = No and forum_usermarksread = Yes (this will impact on the convenience of your users' forum experience). Also consider setting the time of the day when old posts are cleared from the read table (forum_cleanreadtime) to when your site is less busy.<br />
<br />
==Performance of different Moodle modules==<br />
<br />
Moodle's activity modules, filters, and other plugins can be activated/deactivated. If necessary, you may wish to deactivate some features (such as chat) if not required - but this isn't necessary. Some notes on the performance of certain modules:<br />
<br />
* The '''Chat''' module is [http://moodle.org/mod/forum/discuss.php?d=37979&parent=175079 said] to be a hog in terms of frequent HTTP requests to the main server. This can be reduced by setting the module to use ''Streamed'' updates, or, if you're using a Unix-based webserver, by running the chat in daemon mode. When using the Chat module use the configuration settings to tune for your expected load. Pay particular attention to the ''chat_old_ping'' and ''chat_refresh'' parameters as these can have greatest impact on server load.<br />
* The '''Quiz''' module is known to stretch database performance. Try to optimise your database server by tuning. See [http://moodle.org/mod/forum/discuss.php?d=25616&parent=120770 for a brief report on performance for 55 students simultaneously using quizzes]<br />
** See this Case Study for an extensive server stress test with 300 quiz users.[http://moodle.org/mod/forum/discuss.php?d=68579] And this accompanying report on network traffic and server loads. [http://elearning.sgu.ac.jp/doc/PT/]<br />
* The Moodle '''Cron''' task is triggered by calling the script ''cron.php''. If this is called over HTTP (e.g. using wget or curl) it can take a large amount of memory on large installations. If it is called by directly invoking the php command (e.g. ''php -f /path/to/moodle/directory/admin/cron.php'') efficiency can be much improved.<br />
<br />
==See also==<br />
<br />
*Using Moodle [http://moodle.org/mod/forum/view.php?f=94 Servers and Performance] forum<br />
<br />
There have been a lot of discussions on moodle.org about performance, here are some of the more interesting and (potentially) useful ones:<br />
<br />
* [http://moodle.org/mod/forum/discuss.php?d=83057 Performance woes!]<br />
* [http://moodle.org/mod/forum/discuss.php?d=57028 Performance perspectives - a little script]<br />
* [http://moodle.org/mod/forum/discuss.php?d=88927 Comments on planned server hardware]<br />
<br />
[[Category:Performance]]<br />
<br />
[[fr:Performance]]<br />
[[ja:パフォーマンス]]<br />
[[pl:Wydajność]]</div>Kawhttps://docs.moodle.org/20/en/index.php?title=Performance_recommendations&diff=34090Performance recommendations2008-03-28T08:45:34Z<p>Kaw: /* Apache performance */ Added Apache Lounge link for Windows</p>
<hr />
<div>Location: ''Administration > Server > Performance''<br />
<br />
<br />
Moodle can be made to perform very well, at small usage levels or scaling up to many thousands of users. The factors involved in performance are basically the same as for any PHP-based database-driven system. When trying to optimize your server, try to focus on the factor which will make the most difference to the user. For example, if you have relatively more users browsing than accessing the database, look to improve the webserver performance.<br />
<br />
<br />
==Obtain a baseline benchmark==<br />
<br />
Before attempting any optimization, you should obtain a baseline benchmark of the component of the system you are trying to improve. For Linux try [http://lbs.sourceforge.net/ LBS] and for Windows use the Performance Monitor. Once you have quantitative data about how your system is performing currently, you'll be able to determine if the change you have made as has any real impact.<br />
<br />
The overall aim of adjustments to improve performance is to use RAM (cacheing) and to reduce disk-based activity. It is especially important to try to eliminate swap file usage as much as you can. If your system starts swapping, this is a sign that you need more RAM. <br />
<br />
The '''optimization order preference''' is usually: primary storage (more RAM), secondary storage (faster hard disks/improved hard disk configuration), processor (more and faster).<br />
<br />
==Scalability==<br />
<br />
Moodle's design (with clear separation of application layers) allows for strongly scalable setups. (Please check the list of [[Large installations|large Moodle installations]].)<br />
<br />
Large sites usually separate the web server and database onto separate servers, although for smaller installations this is typically not necessary.<br />
<br />
It is possible to load-balance a Moodle installation, for example by using more than one webserver. The separate webservers should query the same database and refer to the same filestore area, but otherwise the separation of the application layers is complete enough to make this kind of clustering feasible. Similarly, the database could be a cluster of servers (e.g. a MySQL cluster), but this is not an easy task and you should seek expert support, e.g. from a Moodle Partner.<br />
<br />
'''See also''': <br />
*[http://moodle.org/mod/forum/discuss.php?d=4801 Scalability] forum discussion.<br />
*[http://moodle.org/mod/forum/discuss.php?d=57202 Moodle clustering] forum discussion.<br />
*[http://moodle.org/mod/forum/discuss.php?d=44470 Software load balancing] forum discussion.<br />
*[http://moodle.org/mod/forum/discuss.php?d=49986 TCP load balancing] forum dicsussion.<br />
<br />
==Hardware configuration==<br />
'''Note''': The fastest and most effective change that you can make to improve performance is to '''increase the amount of RAM on your web server''' - get as much as possible (eg 4GB). Increasing primary memory will reduce the need for processes to swap to disk and will enable your server to handle more users.<br />
* Better performance is gained by obtaining the best '''processor capability''' you can, i.e. dual or dual core processors. A modern BIOS should allow you to enable hyperthreading, but check if this makes a difference to the overall performance of the processors by using a [http://en.wikipedia.org/wiki/Super_PI CPU benchmarking tool].<br />
* If you can afford them, use '''SCSI hard disks''' instead of SATA drives. SATA drives will increase your system's CPU utilization, whereas SCSI drives have their own integrated processors and come into their own when you have multiple drives. If you must have SATA drives, check that your motherboard and the drives themselves support NCQ (Native Command Queuing).<br />
* Purchase hard disks with a '''low seek time'''. This will improve the overall speed of your system, especially when accessing Moodle's reports.<br />
* Size your '''swap file''' correctly. The general advice is to set it to 4 x physical RAM.<br />
* Use a '''RAID disk system'''. Although there are many different RAID configurations you can create, the following generally works best:<br />
** install a hardware RAID controller (if you can)<br />
** the operating system and swap drive on one set of disks configured as RAID-1.<br />
** Moodle, Web server and Database server on another set of disks configured as RAID-5.<br />
* Use '''gigabit ethernet''' for improved latency and throughput. This is especially important when you have your webserver and database server separated out on different hosts.<br />
* Check the settings on your '''network card'''. You may get an improvement in performance by increasing the use of buffers and transmit/receive descriptors (balance this with processor and memory overheads) and off-loading TCP checksum calculation onto the card instead of the OS.<br />
* Read this Case Study on a server stress test with 300 users.[http://moodle.org/mod/forum/discuss.php?d=68579] <br />
* See this accompanying report on network traffic and server loads. [http://elearning.sgu.ac.jp/doc/PT/]<br />
<br />
==Operating System==<br />
* You can use [http://en.wikipedia.org/wiki/Linux Linux](recommended), Unix-based, Windows or Mac OS X for the server '''operating system'''. *nix operating systems generally require less memory than Mac OS X or Windows servers for doing the same task as the server is configured with just a shell interface. Additionally Linux does not have licensing fees attached, but can have a big learning curve if you're used to another operating system. If you have a large number of processors running SMP, you may also want to consider using a highly tuned OS such as [http://en.wikipedia.org/wiki/Solaris_Operating_Environment Solaris].<br />
* Check your own OS and '''vendor specific instructions''' for optimization steps.<br />
** For Linux look at the [http://linuxperf.sourceforge.net/ Linux Performance Team] site. <br />
** For Linux investigate the hdparm command, e.g. hdparm -m16 -d1 can be used to enable read/write on multiple sectors and DMA. Mount disks with the async and noatime options.<br />
** For Windows set the sever to be optimized for network applications (Control Panel, Network Connections, LAN connection, Properties, File & Printer Sharing for Microsoft Networks, Properties, Optimization). You can also search the [http://technet.microsoft.com/ Microsoft TechNet site] for optimization documents.<br />
<br />
==Web server performance==<br />
<br />
Installing [http://www.mozilla.com/en-US/ Firefox] and the [https://addons.mozilla.org/en-US/firefox/addon/1843 firebug] extension will allow you to watch the time it takes for each page component to load. Also, the [https://addons.mozilla.org/en-US/firefox/addon/5369 Yslow] extension will evaluate your page against Yahoo's [http://www.skrenta.com/2007/05/14_rules_for_fast_web_pages_by_1.html 14 rules] ([http://video.yahoo.com/video/play?vid=1040890 video]) for fast loading websites.<br />
<br />
===PHP performance===<br />
* You are strongly recommended to use a '''PHP accelerator''' to ease CPU load, such as [http://pecl.php.net/apc APC], [http://www.php-accelerator.co.uk/ PHPA], [http://trac.lighttpd.net/xcache/ Xcache] or [http://eaccelerator.net/ eAccelerator]. (Take care to choose a PHP accelerator that is known to work well with your version of PHP and note that Turck MMCache is [http://turckmmcache.exeprod.com/TheManifestoEnglish no longer maintained] and can cause failures with PHP 5). <br />
* Improvements in read/write performance can be improved by putting the cached PHP pages on a [[TMPFS]] filesystem - but remember that you'll lose the cache contents when there is a power failure or the server is rebooted.<br />
* Performance of PHP is better when installed as an '''Apache/IIS ISAPI module''' (rather than a CGI).<br />
* Also check the '''memory_limit''' in php.ini, reduce it to 16M for Moodle version earlier than 1.7 ([http://moodle.org/mod/forum/discuss.php?d=39656 See this forum discussion]). For Moodle 1.7 or later, it is recommended that the value of memory_limit should be 40M. As of [http://www.php.net/ChangeLog-5.php PHP 5.2.1] the default value for the memory_limit directive is 128M.<br />
<br />
===Apache performance===<br />
* If you are using Apache on a Windows server, use the build from [http://www.apachelounge.com Apache Lounge] which is reported to have [http://moodle.org/mod/forum/discuss.php?d=93358 performance and stability improvements] compared to the official Apache download. Note that this is an unofficial build, so may not keep up with official releases.<br />
* Set the '''MaxClients''' directive correctly. Use this formula to help (which uses 80% of available memory to leave room for spare):<br />
MaxClients = Total available memory * 80% / Max memory usage of apache process<br />
:Memory usage of apache process is usually 10MB, so a general rule of thumb is to divide your available memory in megabytes by 10 to get the value of MaxClients. To find the max memory usage of apache processes read the value from the shell command:<br />
#ps -ylC httpd --sort:rss<br />
<br />
:If you need to increase the value of '''MaxClients''' beyond 256, you will also need to set the '''ServerLimit''' directive. <br />
<br />
:'''Warning''': Do not be tempted to set the value of MaxClients higher than your available memory as your server will consume more RAM than available and start to swap to disk. <br />
* Consider reducing the '''number of modules''' that Apache loads in the httpd.conf file to the minumum necessary to reduce the memory needed. <br />
* Use the '''latest version of Apache''' - Apache 2 has an improved memory model which reduces memory usage further.<br />
* For Unix/Linux systems, consider lowering '''MaxRequestsPerChild''' in httpd.conf to as low as 20-30 (if you set it any lower the overhead of forking begins to outweigh the benefits). <br />
* For a heavily loaded server, consider setting '''KeepAlive Off''' (do this only if your Moodle pages do not contain links to resources or uploaded images) or lowering the '''KeepAliveTimeout''' to between 2 and 5. The default is 15 (seconds) - the higher the value the more server processes will be kept waiting for possibly idle connections. A more accurate value for KeepAliveTimeout is obtained by observing how long it takes your users to download a page. After altering any of the KeepAlive variables, monitor your CPU utilization as there may be an additional overhead in initiating more worker processes/threads.<br />
* As an alternative to using KeepAlive Off, consider setting-up a '''Reverse Proxy server''' infront of the Moodle server to cache HTML files with images. You can then return Apache to using keep-alives on the Moodle server.<br />
* If you do not use a .htaccess file, set the '''AllowOverride''' variable to AllowOverride None to prevent .htaccess lookups.<br />
* Set '''DirectoryIndex''' correctly so as to avoid content-negotiation. Here's an example from a production server:<br />
DirectoryIndex index.php index.html index.htm<br />
* Unless you are doing development work on the server, set '''ExtendedStatus Off''' and disable mod_info as well as mod_status.<br />
* Leave '''HostnamesLookups Off''' (as default) to reduce DNS latency.<br />
* Consider reducing the value of '''TimeOut''' to between 30 to 60 (seconds). <br />
* For the '''Options directive''', avoid Options Multiviews as this performs a directory scan. To reduce disk I/O further use<br />
Options -Indexes FollowSymLinks<br />
*'''Caching''' - Apache can be told to make pages load a lot faster by specifying that the browser should cache some various page elements such as images and reuse them from local memory rather than ask for them again every time a page is requested. How to do this varies slightly between OSes but there are two basic steps:<br />
<br />
# Install and enable mod_expires - refer to documentation or man pages<br />
# Add this code to the virtual server config file within the <directory> section for the root directory (or within the .htaccess file if AllowOverrides is On):<br />
<IfModule mod_expires.c><br />
ExpiresActive On<br />
ExpiresDefault "access plus 1 seconds"<br />
ExpiresByType text/html "access plus 1 seconds"<br />
ExpiresByType image/gif "access plus 1 week"<br />
ExpiresByType image/jpeg "access plus 1 week"<br />
ExpiresByType image/png "access plus 1 week"<br />
ExpiresByType text/css "access plus 1 week"<br />
ExpiresByType text/javascript "access plus 1 week"<br />
ExpiresByType application/x-javascript "access plus 1 week"<br />
ExpiresByType text/xml "access plus 1 seconds"<br />
</IfModule><br />
<br />
The effect is to make everything stay in the cache except HTML and XML, which change dynamically. It's possible to gain a several hundred percent decrease in load times this way. Adjust the cache times according to how often your images etc change.<br />
<br />
More info: [http://www.metaskills.net/blog/heuristics/sysadmin/how-to-control-browser-caching-with-apache-2 www.metaskills.net]<br />
<br />
===IIS performance===<br />
All alter this location in the registry:<br />
HKLM\SYSTEM\CurrentControlSet\Services\Inetinfo\Parameters\<br />
* The equivalent to KeepAliveTimeout is '''ListenBackLog''' (IIS - registry location is HKLM\ SYSTEM\ CurrentControlSet\ Services\ Inetinfo\ Parameters). Set this to between 2 to 5.<br />
*Change the '''MemCacheSize''' value to adjust the amount of memory (Mb) that IIS will use for its file cache (50% of available memory by default).<br />
*Change the '''MaxCachedFileSize''' to adjust the maximum size of a file cached in the file cache in bytes. Default is 262,144 (256K).<br />
*Create a new DWORD called '''ObjectCacheTTL''' to change the length of time (in milliseconds) that objects in the cache are held in memory. Default is 30,000 milliseconds (30 seconds).<br />
<br />
===Lighttpd performance===<br />
You can increase web server performance by using the '''light-weight webserver''' [http://www.lighttpd.net/ lighttpd] in combination with PHP in fastCGI-mode. Lighttpd has a lower memory consumption than Apache - typically 10M for each process. See this [[lighttpd | MoodleDocs Lighttpd page]] for configuration and administration links.<br />
<br />
==Database performance==<br />
<br />
Moodle contains a script which will display some key database performance statistics from the [http://phplens.com/lens/adodb/docs-perf.htm ADOdb performance monitor]. Run the script in your browser as in the following example:<br />
<br />
http://www.mymoodle.com/admin/dbperformance.php<br />
<br />
Use the data displayed as a guide to tune and improve the performance of your database server.<br />
<br />
===MySQL performance===<br />
<br />
The following are MySQL specific settings which can be adjusted for better performance in your my.cnf (my.ini in Windows). The file contains a list of settings and their values. To see the current values use these commands<br />
SHOW STATUS;<br />
SHOW VARIABLES; <br />
'''Important''': You must make backups of your database before attempting to change any MySQL server configuration. After any change to the my.cnf, restart mysqld.<br />
* Enable the '''query cache''' with <br />
query_cache_type = 1. <br />
For most Moodle installs, set the following:<br />
query_cache_size = 36M <br />
query_cache_min_res_unit = 2K. <br />
The query cache will improve performance if you are doing few updates on the database. <br />
* Set the '''table cache''' correctly. For Moodle 1.6 set <br />
table_cache = 256 <br />
(min), and for Moodle 1.7 set <br />
table_cache = 512 <br />
(min). The table cache is used by all threads (connections), so monitor the value of opened_tables to further adjust - if opened_tables > 3 * table_cache then increase table_cache upto your OS limit. Note also that the figure for table_cache will also change depending on the number of modules and plugins you have installed. Find the number for your server by executing the mysql statement below. Look at the number returned and set table_cache to this value.<br />
mysql>SELECT COUNT(table_name) FROM information_schema.tables WHERE table_schema='yourmoodledbname';<br />
* Set the '''thread cache''' correctly. Adjust the value so that your thread cache utilization is as close to 100% as possible by this formula:<br />
thread cache utilization (%) = (threads_created / connections) * 100<br />
* The '''key buffer''' can improve the access speed to Moodle's SELECT queries. The correct size depends on the size of the index files (.myi) and in Moodle 1.6 or later (without any additional modules and plugins), the recommendation for this value is key_buffer_size = 32M. Ideally you want the database to be reading once from the disk for every 100 requests so monitor that the value is suitable for your install by adjusting the value of key_buffer_size so that the following formulas are true:<br />
key_read / key_read_requests < 0.01<br />
key_write / key_write_requests <= 1.0<br />
* Set the '''maximum number of connections''' so that your users will not see a "Too many connections" message. Be careful that this may have an impact on the total memory used. MySQL connections usually last for milliseconds, so it is unusual even for a heavily loaded server for this value to be over 200.<br />
* Manage '''high burst activity'''. If your Moodle install uses a lot of quizzes and you are experiencing performance problems (check by monitoring the value of threads_connected - it should not be rising) consider increasing the value of back_log.<br />
* '''Optimize your tables weekly and after upgrading Moodle'''. It is good practice to also optimize your tables after performing a large data deletion exercise, e.g. at the end of your semester or academic year. This will ensure that index files are up to date. Backup your database first and then use:<br />
mysql>CHECK TABLE mdl_tablename;<br />
mysql>OPTIMIZE TABLE mdl_tablename;<br />
:The common tables in Moodle to check are mdl_course_sections, mdl_forum_posts, mdl_log and mdl_sessions (if using dbsessions). Any errors need to be corrected using REPAIR TABLE (see the [http://dev.mysql.com/doc/refman/5.0/en/repair-table.html MySQL manual] and this [http://moodle.org/mod/forum/discuss.php?d=58208#p279638 forum script]).<br />
* '''Maintain the key distribution'''. Every month or so it is a good idea to stop the mysql server and run these myisamchk commands.<br />
#myisamchk -a -S /pathtomysql/data/moodledir/*.MYI<br />
:'''Warning''': You must stop the mysql database process (mysqld) before running any myisamchk command. If you do not, you risk data loss.<br />
* Reduce the number of '''temporary tables saved to disk'''. Check this with the created_tmp_disk_tables value. If this is relatively large (>5%) increase tmp_table_size until you see a reduction. Note that this will have an impact on RAM usage.<br />
* Moodle's tables are in the MyISAM format, so '''turn InnoDB off''' as there is no performance gain. Add <code>skip-innodb</code> to your <code>my.cnf</code> file. If you must use InnoDB, you'll have to convert all of Moodle's tables. To do this run the innodb script:<br />
<br />
http://www.mymoodle.com/admin/innodb.php<br />
<br />
===Other database performance links===<br />
* Consider using a '''distributed cacheing system''' like [http://en.wikipedia.org/wiki/Memcached memcached] but note that memcached does not have any security features so it should be used behind a firewall.<br />
* Consider using PostgreSQL. See [[Arguments in favour of PostgreSQL]] and [http://moodle.org/mod/forum/discuss.php?d=49195 how to migrate from MySQL to PostgreSQL] (forum discussion).<br />
* [[Increasing the database connection lifetime | Try increasing the database connection lifetime]]<br />
* [http://dev.mysql.com/doc/refman/5.0/en/server-parameters.html General advice on tuning MySQL parameters] (advice from the MySQL manual)<br />
* [http://www.mysqlperformanceblog.com/2007/11/01/innodb-performance-optimization-basics/ InnoDB performance optimization] taken from the [http://www.mysqlperformanceblog.com/ MySQL performance blog] site.<br />
<br />
==Moodle Admin settings==<br />
* In Moodle 1.7 or later, set the '''Cache type''' for your server: Site Admin -> Server -> Performance -> Cache type. There are several options available. <br />
:*If you do not have eaccelerator or mmemcached installed, choose "internal" (which makes use of the record/internal cache - see the next bullet point). <br />
:* If you have a single server and have compiled '''eaccelerator with shared memory support''', set the cache type to the eaccelerator option. <br />
:* If you have a '''separate memcached server''', set the cache type to memcached and enter a csv list of server IP addresses.<br />
* Enable the '''record/internal cache''': Site Admin -> Server -> Performance -> Record cache = True. Set the maximum amount of memory allocated to the cache in the Int Cache Max box. This will enable a primary cache for database records, without using any database engine cache, e.g. MySQL/PostgreSQL cache. See [http://tracker.moodle.org/browse/MDL-7196 this Tracker entry] for a full discussion.<br />
* Enable the '''language cache'''.<br />
* Large log files can cause overall performance to degrade over time. If you observe that the site has gradually got slower loading pages in the browser, '''reduce your Log life time''' setting (Admin/Server/Cleanup).<br />
* Performance can be greatly improved by allowing Moodle to use the system '''zip/unzip''' commands (rather than PHP-based zip libraries) - visit Admin/Server/System Paths and enter the path to the relevant executables. (Similarly, filling in the path to '''du''' will improve Moodle's speed at listing directory contents.)<br />
* Note that using '''secure web connections''' ('''https''' rather than '''http''') carries a higher processing burden, both for the webserver and the client - particularly because cacheing cannot be used as effectively, so the number of file requests is likely to increase dramatically. For this reason using https for all Moodle pages is not recommended. You can enable https just for the login screen, simply from Moodle's config page.<br />
* Check your '''filters'''. Having too many filters active can have serious effects on server load, especially on lower-end systems. The number of active filters has a direct effect on the perceived latency of your site; that is the time taken for each page impression. <br />
* Enable the '''text cache''' but do not "Filter all strings" unless you have a specific need. If in doubt profile the performance, and see how your changes affect the processing time.<br />
* Check your '''anti-virus''' measures on the server. Although they are useful for preventing security holes being exploited, some "On-Demand" scanners can affect performance by scanning page content (word, ppt files etc).<br />
* If there are performance problems loading course pages, check the '''Resource module settings'''. The setting resource_filterexternalpages is known to slow-down course pages and should be set to 'No' for better performance.<br />
* Check your '''forum settings'''. To improve performance set forum_trackreadposts = No and forum_usermarksread = Yes (this will impact on the convenience of your users' forum experience). Also consider setting the time of the day when old posts are cleared from the read table (forum_cleanreadtime) to when your site is less busy.<br />
<br />
==Performance of different Moodle modules==<br />
<br />
Moodle's activity modules, filters, and other plugins can be activated/deactivated. If necessary, you may wish to deactivate some features (such as chat) if not required - but this isn't necessary. Some notes on the performance of certain modules:<br />
<br />
* The '''Chat''' module is [http://moodle.org/mod/forum/discuss.php?d=37979&parent=175079 said] to be a hog in terms of frequent HTTP requests to the main server. This can be reduced by setting the module to use ''Streamed'' updates, or, if you're using a Unix-based webserver, by running the chat in daemon mode. When using the Chat module use the configuration settings to tune for your expected load. Pay particular attention to the ''chat_old_ping'' and ''chat_refresh'' parameters as these can have greatest impact on server load.<br />
* The '''Quiz''' module is known to stretch database performance. Try to optimise your database server by tuning. See [http://moodle.org/mod/forum/discuss.php?d=25616&parent=120770 for a brief report on performance for 55 students simultaneously using quizzes]<br />
** See this Case Study for an extensive server stress test with 300 quiz users.[http://moodle.org/mod/forum/discuss.php?d=68579] And this accompanying report on network traffic and server loads. [http://elearning.sgu.ac.jp/doc/PT/]<br />
* The Moodle '''Cron''' task is triggered by calling the script ''cron.php''. If this is called over HTTP (e.g. using wget or curl) it can take a large amount of memory on large installations. If it is called by directly invoking the php command (e.g. ''php -f /path/to/moodle/directory/admin/cron.php'') efficiency can be much improved.<br />
<br />
==See also==<br />
<br />
*Using Moodle [http://moodle.org/mod/forum/view.php?f=94 Servers and Performance] forum<br />
<br />
There have been a lot of discussions on moodle.org about performance, here are some of the more interesting and (potentially) useful ones:<br />
<br />
* [http://moodle.org/mod/forum/discuss.php?d=83057 Performance woes!]<br />
* [http://moodle.org/mod/forum/discuss.php?d=57028 Performance perspectives - a little script]<br />
* [http://moodle.org/mod/forum/discuss.php?d=88927 Comments on planned server hardware]<br />
<br />
[[Category:Performance]]<br />
<br />
[[fr:Performance]]<br />
[[ja:パフォーマンス]]<br />
[[pl:Wydajność]]</div>Kawhttps://docs.moodle.org/20/en/index.php?title=Performance_recommendations&diff=34089Performance recommendations2008-03-28T08:34:13Z<p>Kaw: /* Web server performance */ Updating and added Lighttpd section</p>
<hr />
<div>Location: ''Administration > Server > Performance''<br />
<br />
<br />
Moodle can be made to perform very well, at small usage levels or scaling up to many thousands of users. The factors involved in performance are basically the same as for any PHP-based database-driven system. When trying to optimize your server, try to focus on the factor which will make the most difference to the user. For example, if you have relatively more users browsing than accessing the database, look to improve the webserver performance.<br />
<br />
<br />
==Obtain a baseline benchmark==<br />
<br />
Before attempting any optimization, you should obtain a baseline benchmark of the component of the system you are trying to improve. For Linux try [http://lbs.sourceforge.net/ LBS] and for Windows use the Performance Monitor. Once you have quantitative data about how your system is performing currently, you'll be able to determine if the change you have made as has any real impact.<br />
<br />
The overall aim of adjustments to improve performance is to use RAM (cacheing) and to reduce disk-based activity. It is especially important to try to eliminate swap file usage as much as you can. If your system starts swapping, this is a sign that you need more RAM. <br />
<br />
The '''optimization order preference''' is usually: primary storage (more RAM), secondary storage (faster hard disks/improved hard disk configuration), processor (more and faster).<br />
<br />
==Scalability==<br />
<br />
Moodle's design (with clear separation of application layers) allows for strongly scalable setups. (Please check the list of [[Large installations|large Moodle installations]].)<br />
<br />
Large sites usually separate the web server and database onto separate servers, although for smaller installations this is typically not necessary.<br />
<br />
It is possible to load-balance a Moodle installation, for example by using more than one webserver. The separate webservers should query the same database and refer to the same filestore area, but otherwise the separation of the application layers is complete enough to make this kind of clustering feasible. Similarly, the database could be a cluster of servers (e.g. a MySQL cluster), but this is not an easy task and you should seek expert support, e.g. from a Moodle Partner.<br />
<br />
'''See also''': <br />
*[http://moodle.org/mod/forum/discuss.php?d=4801 Scalability] forum discussion.<br />
*[http://moodle.org/mod/forum/discuss.php?d=57202 Moodle clustering] forum discussion.<br />
*[http://moodle.org/mod/forum/discuss.php?d=44470 Software load balancing] forum discussion.<br />
*[http://moodle.org/mod/forum/discuss.php?d=49986 TCP load balancing] forum dicsussion.<br />
<br />
==Hardware configuration==<br />
'''Note''': The fastest and most effective change that you can make to improve performance is to '''increase the amount of RAM on your web server''' - get as much as possible (eg 4GB). Increasing primary memory will reduce the need for processes to swap to disk and will enable your server to handle more users.<br />
* Better performance is gained by obtaining the best '''processor capability''' you can, i.e. dual or dual core processors. A modern BIOS should allow you to enable hyperthreading, but check if this makes a difference to the overall performance of the processors by using a [http://en.wikipedia.org/wiki/Super_PI CPU benchmarking tool].<br />
* If you can afford them, use '''SCSI hard disks''' instead of SATA drives. SATA drives will increase your system's CPU utilization, whereas SCSI drives have their own integrated processors and come into their own when you have multiple drives. If you must have SATA drives, check that your motherboard and the drives themselves support NCQ (Native Command Queuing).<br />
* Purchase hard disks with a '''low seek time'''. This will improve the overall speed of your system, especially when accessing Moodle's reports.<br />
* Size your '''swap file''' correctly. The general advice is to set it to 4 x physical RAM.<br />
* Use a '''RAID disk system'''. Although there are many different RAID configurations you can create, the following generally works best:<br />
** install a hardware RAID controller (if you can)<br />
** the operating system and swap drive on one set of disks configured as RAID-1.<br />
** Moodle, Web server and Database server on another set of disks configured as RAID-5.<br />
* Use '''gigabit ethernet''' for improved latency and throughput. This is especially important when you have your webserver and database server separated out on different hosts.<br />
* Check the settings on your '''network card'''. You may get an improvement in performance by increasing the use of buffers and transmit/receive descriptors (balance this with processor and memory overheads) and off-loading TCP checksum calculation onto the card instead of the OS.<br />
* Read this Case Study on a server stress test with 300 users.[http://moodle.org/mod/forum/discuss.php?d=68579] <br />
* See this accompanying report on network traffic and server loads. [http://elearning.sgu.ac.jp/doc/PT/]<br />
<br />
==Operating System==<br />
* You can use [http://en.wikipedia.org/wiki/Linux Linux](recommended), Unix-based, Windows or Mac OS X for the server '''operating system'''. *nix operating systems generally require less memory than Mac OS X or Windows servers for doing the same task as the server is configured with just a shell interface. Additionally Linux does not have licensing fees attached, but can have a big learning curve if you're used to another operating system. If you have a large number of processors running SMP, you may also want to consider using a highly tuned OS such as [http://en.wikipedia.org/wiki/Solaris_Operating_Environment Solaris].<br />
* Check your own OS and '''vendor specific instructions''' for optimization steps.<br />
** For Linux look at the [http://linuxperf.sourceforge.net/ Linux Performance Team] site. <br />
** For Linux investigate the hdparm command, e.g. hdparm -m16 -d1 can be used to enable read/write on multiple sectors and DMA. Mount disks with the async and noatime options.<br />
** For Windows set the sever to be optimized for network applications (Control Panel, Network Connections, LAN connection, Properties, File & Printer Sharing for Microsoft Networks, Properties, Optimization). You can also search the [http://technet.microsoft.com/ Microsoft TechNet site] for optimization documents.<br />
<br />
==Web server performance==<br />
<br />
Installing [http://www.mozilla.com/en-US/ Firefox] and the [https://addons.mozilla.org/en-US/firefox/addon/1843 firebug] extension will allow you to watch the time it takes for each page component to load. Also, the [https://addons.mozilla.org/en-US/firefox/addon/5369 Yslow] extension will evaluate your page against Yahoo's [http://www.skrenta.com/2007/05/14_rules_for_fast_web_pages_by_1.html 14 rules] ([http://video.yahoo.com/video/play?vid=1040890 video]) for fast loading websites.<br />
<br />
===PHP performance===<br />
* You are strongly recommended to use a '''PHP accelerator''' to ease CPU load, such as [http://pecl.php.net/apc APC], [http://www.php-accelerator.co.uk/ PHPA], [http://trac.lighttpd.net/xcache/ Xcache] or [http://eaccelerator.net/ eAccelerator]. (Take care to choose a PHP accelerator that is known to work well with your version of PHP and note that Turck MMCache is [http://turckmmcache.exeprod.com/TheManifestoEnglish no longer maintained] and can cause failures with PHP 5). <br />
* Improvements in read/write performance can be improved by putting the cached PHP pages on a [[TMPFS]] filesystem - but remember that you'll lose the cache contents when there is a power failure or the server is rebooted.<br />
* Performance of PHP is better when installed as an '''Apache/IIS ISAPI module''' (rather than a CGI).<br />
* Also check the '''memory_limit''' in php.ini, reduce it to 16M for Moodle version earlier than 1.7 ([http://moodle.org/mod/forum/discuss.php?d=39656 See this forum discussion]). For Moodle 1.7 or later, it is recommended that the value of memory_limit should be 40M. As of [http://www.php.net/ChangeLog-5.php PHP 5.2.1] the default value for the memory_limit directive is 128M.<br />
<br />
===Apache performance===<br />
* Set the '''MaxClients''' directive correctly. Use this formula to help (which uses 80% of available memory to leave room for spare):<br />
MaxClients = Total available memory * 80% / Max memory usage of apache process<br />
:Memory usage of apache process is usually 10MB, so a general rule of thumb is to divide your available memory in megabytes by 10 to get the value of MaxClients. To find the max memory usage of apache processes read the value from the shell command:<br />
#ps -ylC httpd --sort:rss<br />
<br />
:If you need to increase the value of '''MaxClients''' beyond 256, you will also need to set the '''ServerLimit''' directive. <br />
<br />
:'''Warning''': Do not be tempted to set the value of MaxClients higher than your available memory as your server will consume more RAM than available and start to swap to disk. <br />
* Consider reducing the '''number of modules''' that Apache loads in the httpd.conf file to the minumum necessary to reduce the memory needed. <br />
* Use the '''latest version of Apache''' - Apache 2 has an improved memory model which reduces memory usage further.<br />
* For Unix/Linux systems, consider lowering '''MaxRequestsPerChild''' in httpd.conf to as low as 20-30 (if you set it any lower the overhead of forking begins to outweigh the benefits). <br />
* For a heavily loaded server, consider setting '''KeepAlive Off''' (do this only if your Moodle pages do not contain links to resources or uploaded images) or lowering the '''KeepAliveTimeout''' to between 2 and 5. The default is 15 (seconds) - the higher the value the more server processes will be kept waiting for possibly idle connections. A more accurate value for KeepAliveTimeout is obtained by observing how long it takes your users to download a page. After altering any of the KeepAlive variables, monitor your CPU utilization as there may be an additional overhead in initiating more worker processes/threads.<br />
* As an alternative to using KeepAlive Off, consider setting-up a '''Reverse Proxy server''' infront of the Moodle server to cache HTML files with images. You can then return Apache to using keep-alives on the Moodle server.<br />
* If you do not use a .htaccess file, set the '''AllowOverride''' variable to AllowOverride None to prevent .htaccess lookups.<br />
* Set '''DirectoryIndex''' correctly so as to avoid content-negotiation. Here's an example from a production server:<br />
DirectoryIndex index.php index.html index.htm<br />
* Unless you are doing development work on the server, set '''ExtendedStatus Off''' and disable mod_info as well as mod_status.<br />
* Leave '''HostnamesLookups Off''' (as default) to reduce DNS latency.<br />
* Consider reducing the value of '''TimeOut''' to between 30 to 60 (seconds). <br />
* For the '''Options directive''', avoid Options Multiviews as this performs a directory scan. To reduce disk I/O further use<br />
Options -Indexes FollowSymLinks<br />
*'''Caching''' - Apache can be told to make pages load a lot faster by specifying that the browser should cache some various page elements such as images and reuse them from local memory rather than ask for them again every time a page is requested. How to do this varies slightly between OSes but there are two basic steps:<br />
<br />
# Install and enable mod_expires - refer to documentation or man pages<br />
# Add this code to the virtual server config file within the <directory> section for the root directory (or within the .htaccess file if AllowOverrides is On):<br />
<IfModule mod_expires.c><br />
ExpiresActive On<br />
ExpiresDefault "access plus 1 seconds"<br />
ExpiresByType text/html "access plus 1 seconds"<br />
ExpiresByType image/gif "access plus 1 week"<br />
ExpiresByType image/jpeg "access plus 1 week"<br />
ExpiresByType image/png "access plus 1 week"<br />
ExpiresByType text/css "access plus 1 week"<br />
ExpiresByType text/javascript "access plus 1 week"<br />
ExpiresByType application/x-javascript "access plus 1 week"<br />
ExpiresByType text/xml "access plus 1 seconds"<br />
</IfModule><br />
<br />
The effect is to make everything stay in the cache except HTML and XML, which change dynamically. It's possible to gain a several hundred percent decrease in load times this way. Adjust the cache times according to how often your images etc change.<br />
<br />
More info: [http://www.metaskills.net/blog/heuristics/sysadmin/how-to-control-browser-caching-with-apache-2 www.metaskills.net]<br />
<br />
===IIS performance===<br />
All alter this location in the registry:<br />
HKLM\SYSTEM\CurrentControlSet\Services\Inetinfo\Parameters\<br />
* The equivalent to KeepAliveTimeout is '''ListenBackLog''' (IIS - registry location is HKLM\ SYSTEM\ CurrentControlSet\ Services\ Inetinfo\ Parameters). Set this to between 2 to 5.<br />
*Change the '''MemCacheSize''' value to adjust the amount of memory (Mb) that IIS will use for its file cache (50% of available memory by default).<br />
*Change the '''MaxCachedFileSize''' to adjust the maximum size of a file cached in the file cache in bytes. Default is 262,144 (256K).<br />
*Create a new DWORD called '''ObjectCacheTTL''' to change the length of time (in milliseconds) that objects in the cache are held in memory. Default is 30,000 milliseconds (30 seconds).<br />
<br />
===Lighttpd performance===<br />
You can increase web server performance by using the '''light-weight webserver''' [http://www.lighttpd.net/ lighttpd] in combination with PHP in fastCGI-mode. Lighttpd has a lower memory consumption than Apache - typically 10M for each process. See this [[lighttpd | MoodleDocs Lighttpd page]] for configuration and administration links.<br />
<br />
==Database performance==<br />
<br />
Moodle contains a script which will display some key database performance statistics from the [http://phplens.com/lens/adodb/docs-perf.htm ADOdb performance monitor]. Run the script in your browser as in the following example:<br />
<br />
http://www.mymoodle.com/admin/dbperformance.php<br />
<br />
Use the data displayed as a guide to tune and improve the performance of your database server.<br />
<br />
===MySQL performance===<br />
<br />
The following are MySQL specific settings which can be adjusted for better performance in your my.cnf (my.ini in Windows). The file contains a list of settings and their values. To see the current values use these commands<br />
SHOW STATUS;<br />
SHOW VARIABLES; <br />
'''Important''': You must make backups of your database before attempting to change any MySQL server configuration. After any change to the my.cnf, restart mysqld.<br />
* Enable the '''query cache''' with <br />
query_cache_type = 1. <br />
For most Moodle installs, set the following:<br />
query_cache_size = 36M <br />
query_cache_min_res_unit = 2K. <br />
The query cache will improve performance if you are doing few updates on the database. <br />
* Set the '''table cache''' correctly. For Moodle 1.6 set <br />
table_cache = 256 <br />
(min), and for Moodle 1.7 set <br />
table_cache = 512 <br />
(min). The table cache is used by all threads (connections), so monitor the value of opened_tables to further adjust - if opened_tables > 3 * table_cache then increase table_cache upto your OS limit. Note also that the figure for table_cache will also change depending on the number of modules and plugins you have installed. Find the number for your server by executing the mysql statement below. Look at the number returned and set table_cache to this value.<br />
mysql>SELECT COUNT(table_name) FROM information_schema.tables WHERE table_schema='yourmoodledbname';<br />
* Set the '''thread cache''' correctly. Adjust the value so that your thread cache utilization is as close to 100% as possible by this formula:<br />
thread cache utilization (%) = (threads_created / connections) * 100<br />
* The '''key buffer''' can improve the access speed to Moodle's SELECT queries. The correct size depends on the size of the index files (.myi) and in Moodle 1.6 or later (without any additional modules and plugins), the recommendation for this value is key_buffer_size = 32M. Ideally you want the database to be reading once from the disk for every 100 requests so monitor that the value is suitable for your install by adjusting the value of key_buffer_size so that the following formulas are true:<br />
key_read / key_read_requests < 0.01<br />
key_write / key_write_requests <= 1.0<br />
* Set the '''maximum number of connections''' so that your users will not see a "Too many connections" message. Be careful that this may have an impact on the total memory used. MySQL connections usually last for milliseconds, so it is unusual even for a heavily loaded server for this value to be over 200.<br />
* Manage '''high burst activity'''. If your Moodle install uses a lot of quizzes and you are experiencing performance problems (check by monitoring the value of threads_connected - it should not be rising) consider increasing the value of back_log.<br />
* '''Optimize your tables weekly and after upgrading Moodle'''. It is good practice to also optimize your tables after performing a large data deletion exercise, e.g. at the end of your semester or academic year. This will ensure that index files are up to date. Backup your database first and then use:<br />
mysql>CHECK TABLE mdl_tablename;<br />
mysql>OPTIMIZE TABLE mdl_tablename;<br />
:The common tables in Moodle to check are mdl_course_sections, mdl_forum_posts, mdl_log and mdl_sessions (if using dbsessions). Any errors need to be corrected using REPAIR TABLE (see the [http://dev.mysql.com/doc/refman/5.0/en/repair-table.html MySQL manual] and this [http://moodle.org/mod/forum/discuss.php?d=58208#p279638 forum script]).<br />
* '''Maintain the key distribution'''. Every month or so it is a good idea to stop the mysql server and run these myisamchk commands.<br />
#myisamchk -a -S /pathtomysql/data/moodledir/*.MYI<br />
:'''Warning''': You must stop the mysql database process (mysqld) before running any myisamchk command. If you do not, you risk data loss.<br />
* Reduce the number of '''temporary tables saved to disk'''. Check this with the created_tmp_disk_tables value. If this is relatively large (>5%) increase tmp_table_size until you see a reduction. Note that this will have an impact on RAM usage.<br />
* Moodle's tables are in the MyISAM format, so '''turn InnoDB off''' as there is no performance gain. Add <code>skip-innodb</code> to your <code>my.cnf</code> file. If you must use InnoDB, you'll have to convert all of Moodle's tables. To do this run the innodb script:<br />
<br />
http://www.mymoodle.com/admin/innodb.php<br />
<br />
===Other database performance links===<br />
* Consider using a '''distributed cacheing system''' like [http://en.wikipedia.org/wiki/Memcached memcached] but note that memcached does not have any security features so it should be used behind a firewall.<br />
* Consider using PostgreSQL. See [[Arguments in favour of PostgreSQL]] and [http://moodle.org/mod/forum/discuss.php?d=49195 how to migrate from MySQL to PostgreSQL] (forum discussion).<br />
* [[Increasing the database connection lifetime | Try increasing the database connection lifetime]]<br />
* [http://dev.mysql.com/doc/refman/5.0/en/server-parameters.html General advice on tuning MySQL parameters] (advice from the MySQL manual)<br />
* [http://www.mysqlperformanceblog.com/2007/11/01/innodb-performance-optimization-basics/ InnoDB performance optimization] taken from the [http://www.mysqlperformanceblog.com/ MySQL performance blog] site.<br />
<br />
==Moodle Admin settings==<br />
* In Moodle 1.7 or later, set the '''Cache type''' for your server: Site Admin -> Server -> Performance -> Cache type. There are several options available. <br />
:*If you do not have eaccelerator or mmemcached installed, choose "internal" (which makes use of the record/internal cache - see the next bullet point). <br />
:* If you have a single server and have compiled '''eaccelerator with shared memory support''', set the cache type to the eaccelerator option. <br />
:* If you have a '''separate memcached server''', set the cache type to memcached and enter a csv list of server IP addresses.<br />
* Enable the '''record/internal cache''': Site Admin -> Server -> Performance -> Record cache = True. Set the maximum amount of memory allocated to the cache in the Int Cache Max box. This will enable a primary cache for database records, without using any database engine cache, e.g. MySQL/PostgreSQL cache. See [http://tracker.moodle.org/browse/MDL-7196 this Tracker entry] for a full discussion.<br />
* Enable the '''language cache'''.<br />
* Large log files can cause overall performance to degrade over time. If you observe that the site has gradually got slower loading pages in the browser, '''reduce your Log life time''' setting (Admin/Server/Cleanup).<br />
* Performance can be greatly improved by allowing Moodle to use the system '''zip/unzip''' commands (rather than PHP-based zip libraries) - visit Admin/Server/System Paths and enter the path to the relevant executables. (Similarly, filling in the path to '''du''' will improve Moodle's speed at listing directory contents.)<br />
* Note that using '''secure web connections''' ('''https''' rather than '''http''') carries a higher processing burden, both for the webserver and the client - particularly because cacheing cannot be used as effectively, so the number of file requests is likely to increase dramatically. For this reason using https for all Moodle pages is not recommended. You can enable https just for the login screen, simply from Moodle's config page.<br />
* Check your '''filters'''. Having too many filters active can have serious effects on server load, especially on lower-end systems. The number of active filters has a direct effect on the perceived latency of your site; that is the time taken for each page impression. <br />
* Enable the '''text cache''' but do not "Filter all strings" unless you have a specific need. If in doubt profile the performance, and see how your changes affect the processing time.<br />
* Check your '''anti-virus''' measures on the server. Although they are useful for preventing security holes being exploited, some "On-Demand" scanners can affect performance by scanning page content (word, ppt files etc).<br />
* If there are performance problems loading course pages, check the '''Resource module settings'''. The setting resource_filterexternalpages is known to slow-down course pages and should be set to 'No' for better performance.<br />
* Check your '''forum settings'''. To improve performance set forum_trackreadposts = No and forum_usermarksread = Yes (this will impact on the convenience of your users' forum experience). Also consider setting the time of the day when old posts are cleared from the read table (forum_cleanreadtime) to when your site is less busy.<br />
<br />
==Performance of different Moodle modules==<br />
<br />
Moodle's activity modules, filters, and other plugins can be activated/deactivated. If necessary, you may wish to deactivate some features (such as chat) if not required - but this isn't necessary. Some notes on the performance of certain modules:<br />
<br />
* The '''Chat''' module is [http://moodle.org/mod/forum/discuss.php?d=37979&parent=175079 said] to be a hog in terms of frequent HTTP requests to the main server. This can be reduced by setting the module to use ''Streamed'' updates, or, if you're using a Unix-based webserver, by running the chat in daemon mode. When using the Chat module use the configuration settings to tune for your expected load. Pay particular attention to the ''chat_old_ping'' and ''chat_refresh'' parameters as these can have greatest impact on server load.<br />
* The '''Quiz''' module is known to stretch database performance. Try to optimise your database server by tuning. See [http://moodle.org/mod/forum/discuss.php?d=25616&parent=120770 for a brief report on performance for 55 students simultaneously using quizzes]<br />
** See this Case Study for an extensive server stress test with 300 quiz users.[http://moodle.org/mod/forum/discuss.php?d=68579] And this accompanying report on network traffic and server loads. [http://elearning.sgu.ac.jp/doc/PT/]<br />
* The Moodle '''Cron''' task is triggered by calling the script ''cron.php''. If this is called over HTTP (e.g. using wget or curl) it can take a large amount of memory on large installations. If it is called by directly invoking the php command (e.g. ''php -f /path/to/moodle/directory/admin/cron.php'') efficiency can be much improved.<br />
<br />
==See also==<br />
<br />
*Using Moodle [http://moodle.org/mod/forum/view.php?f=94 Servers and Performance] forum<br />
<br />
There have been a lot of discussions on moodle.org about performance, here are some of the more interesting and (potentially) useful ones:<br />
<br />
* [http://moodle.org/mod/forum/discuss.php?d=83057 Performance woes!]<br />
* [http://moodle.org/mod/forum/discuss.php?d=57028 Performance perspectives - a little script]<br />
* [http://moodle.org/mod/forum/discuss.php?d=88927 Comments on planned server hardware]<br />
<br />
[[Category:Performance]]<br />
<br />
[[fr:Performance]]<br />
[[ja:パフォーマンス]]<br />
[[pl:Wydajność]]</div>Kawhttps://docs.moodle.org/20/en/index.php?title=Performance_recommendations&diff=34088Performance recommendations2008-03-28T08:18:16Z<p>Kaw: /* Other database performance links */ Added links to MySQL performance blog and InnoDB performance optimization article</p>
<hr />
<div>Location: ''Administration > Server > Performance''<br />
<br />
<br />
Moodle can be made to perform very well, at small usage levels or scaling up to many thousands of users. The factors involved in performance are basically the same as for any PHP-based database-driven system. When trying to optimize your server, try to focus on the factor which will make the most difference to the user. For example, if you have relatively more users browsing than accessing the database, look to improve the webserver performance.<br />
<br />
<br />
==Obtain a baseline benchmark==<br />
<br />
Before attempting any optimization, you should obtain a baseline benchmark of the component of the system you are trying to improve. For Linux try [http://lbs.sourceforge.net/ LBS] and for Windows use the Performance Monitor. Once you have quantitative data about how your system is performing currently, you'll be able to determine if the change you have made as has any real impact.<br />
<br />
The overall aim of adjustments to improve performance is to use RAM (cacheing) and to reduce disk-based activity. It is especially important to try to eliminate swap file usage as much as you can. If your system starts swapping, this is a sign that you need more RAM. <br />
<br />
The '''optimization order preference''' is usually: primary storage (more RAM), secondary storage (faster hard disks/improved hard disk configuration), processor (more and faster).<br />
<br />
==Scalability==<br />
<br />
Moodle's design (with clear separation of application layers) allows for strongly scalable setups. (Please check the list of [[Large installations|large Moodle installations]].)<br />
<br />
Large sites usually separate the web server and database onto separate servers, although for smaller installations this is typically not necessary.<br />
<br />
It is possible to load-balance a Moodle installation, for example by using more than one webserver. The separate webservers should query the same database and refer to the same filestore area, but otherwise the separation of the application layers is complete enough to make this kind of clustering feasible. Similarly, the database could be a cluster of servers (e.g. a MySQL cluster), but this is not an easy task and you should seek expert support, e.g. from a Moodle Partner.<br />
<br />
'''See also''': <br />
*[http://moodle.org/mod/forum/discuss.php?d=4801 Scalability] forum discussion.<br />
*[http://moodle.org/mod/forum/discuss.php?d=57202 Moodle clustering] forum discussion.<br />
*[http://moodle.org/mod/forum/discuss.php?d=44470 Software load balancing] forum discussion.<br />
*[http://moodle.org/mod/forum/discuss.php?d=49986 TCP load balancing] forum dicsussion.<br />
<br />
==Hardware configuration==<br />
'''Note''': The fastest and most effective change that you can make to improve performance is to '''increase the amount of RAM on your web server''' - get as much as possible (eg 4GB). Increasing primary memory will reduce the need for processes to swap to disk and will enable your server to handle more users.<br />
* Better performance is gained by obtaining the best '''processor capability''' you can, i.e. dual or dual core processors. A modern BIOS should allow you to enable hyperthreading, but check if this makes a difference to the overall performance of the processors by using a [http://en.wikipedia.org/wiki/Super_PI CPU benchmarking tool].<br />
* If you can afford them, use '''SCSI hard disks''' instead of SATA drives. SATA drives will increase your system's CPU utilization, whereas SCSI drives have their own integrated processors and come into their own when you have multiple drives. If you must have SATA drives, check that your motherboard and the drives themselves support NCQ (Native Command Queuing).<br />
* Purchase hard disks with a '''low seek time'''. This will improve the overall speed of your system, especially when accessing Moodle's reports.<br />
* Size your '''swap file''' correctly. The general advice is to set it to 4 x physical RAM.<br />
* Use a '''RAID disk system'''. Although there are many different RAID configurations you can create, the following generally works best:<br />
** install a hardware RAID controller (if you can)<br />
** the operating system and swap drive on one set of disks configured as RAID-1.<br />
** Moodle, Web server and Database server on another set of disks configured as RAID-5.<br />
* Use '''gigabit ethernet''' for improved latency and throughput. This is especially important when you have your webserver and database server separated out on different hosts.<br />
* Check the settings on your '''network card'''. You may get an improvement in performance by increasing the use of buffers and transmit/receive descriptors (balance this with processor and memory overheads) and off-loading TCP checksum calculation onto the card instead of the OS.<br />
* Read this Case Study on a server stress test with 300 users.[http://moodle.org/mod/forum/discuss.php?d=68579] <br />
* See this accompanying report on network traffic and server loads. [http://elearning.sgu.ac.jp/doc/PT/]<br />
<br />
==Operating System==<br />
* You can use [http://en.wikipedia.org/wiki/Linux Linux](recommended), Unix-based, Windows or Mac OS X for the server '''operating system'''. *nix operating systems generally require less memory than Mac OS X or Windows servers for doing the same task as the server is configured with just a shell interface. Additionally Linux does not have licensing fees attached, but can have a big learning curve if you're used to another operating system. If you have a large number of processors running SMP, you may also want to consider using a highly tuned OS such as [http://en.wikipedia.org/wiki/Solaris_Operating_Environment Solaris].<br />
* Check your own OS and '''vendor specific instructions''' for optimization steps.<br />
** For Linux look at the [http://linuxperf.sourceforge.net/ Linux Performance Team] site. <br />
** For Linux investigate the hdparm command, e.g. hdparm -m16 -d1 can be used to enable read/write on multiple sectors and DMA. Mount disks with the async and noatime options.<br />
** For Windows set the sever to be optimized for network applications (Control Panel, Network Connections, LAN connection, Properties, File & Printer Sharing for Microsoft Networks, Properties, Optimization). You can also search the [http://technet.microsoft.com/ Microsoft TechNet site] for optimization documents.<br />
<br />
==Web server performance==<br />
<br />
Installing [http://www.mozilla.com/en-US/ Firefox] and the [https://addons.mozilla.org/en-US/firefox/addon/1843 firebug] extension will allow you to watch the time it takes for each page component to load. Also, the [https://addons.mozilla.org/en-US/firefox/addon/5369 Yslow] extension will evaluate your page against Yahoo's [http://www.skrenta.com/2007/05/14_rules_for_fast_web_pages_by_1.html 14 rules] ([http://video.yahoo.com/video/play?vid=1040890 video]) for fast loading websites.<br />
<br />
===PHP performance===<br />
* You are strongly recommended to use a '''PHP accelerator''' to ease CPU load, such as [http://pecl.php.net/apc APC] (recommended), [http://www.php-accelerator.co.uk/ PHPA], [http://trac.lighttpd.net/xcache/ Xcache] or [http://eaccelerator.net/ eAccelerator]. (Take care to choose a PHP accelerator that is known to work well with your version of PHP and note that Turck MMCache is [http://turckmmcache.exeprod.com/TheManifestoEnglish no longer maintained] and can cause failures with PHP 5). Put the cached PHP pages on a [[TMPFS]] filesystem.<br />
* Performance of PHP is better when installed as an '''Apache/IIS ISAPI module''' (rather than a CGI).<br />
* Also check the '''memory_limit''' in php.ini, reduce it to 16M for Moodle version earlier than 1.7 ([http://moodle.org/mod/forum/discuss.php?d=39656 See this forum discussion]). For Moodle 1.7 or later, it is recommended that the value of memory_limit should be 40M.<br />
<br />
===Apache performance===<br />
* Set the '''MaxClients''' directive correctly. Use this formula to help (which uses 80% of available memory to leave room for spare):<br />
MaxClients = Total available memory * 80% / Max memory usage of apache process<br />
:Memory usage of apache process is usually 10MB, so a general rule of thumb is to divide your available memory in megabytes by 10 to get the value of MaxClients. To find the max memory usage of apache processes read the value from the shell command:<br />
#ps -ylC httpd --sort:rss<br />
<br />
:If you need to increase the value of '''MaxClients''' beyond 256, you will also need to set the '''ServerLimit''' directive. <br />
<br />
:'''Warning''': Do not be tempted to set the value of MaxClients higher than your available memory as your server will consume more RAM than available and start to swap to disk. <br />
* Consider reducing the '''number of modules''' that Apache loads in the httpd.conf file to the minumum necessary to reduce the memory needed. <br />
* Use the '''latest version of Apache''' - Apache 2 has an improved memory model which reduces memory usage further.<br />
* For Unix/Linux systems, consider lowering '''MaxRequestsPerChild''' in httpd.conf to as low as 20-30 (if you set it any lower the overhead of forking begins to outweigh the benefits). <br />
* For a heavily loaded server, consider setting '''KeepAlive Off''' (do this only if your Moodle pages do not contain links to resources or uploaded images) or lowering the '''KeepAliveTimeout''' to between 2 and 5. The default is 15 (seconds) - the higher the value the more server processes will be kept waiting for possibly idle connections. A more accurate value for KeepAliveTimeout is obtained by observing how long it takes your users to download a page. After altering any of the KeepAlive variables, monitor your CPU utilization as there may be an additional overhead in initiating more worker processes/threads.<br />
* As an alternative to using KeepAlive Off, consider setting-up a '''Reverse Proxy server''' infront of the Moodle server to cache HTML files with images. You can then return Apache to using keep-alives on the Moodle server.<br />
* If you do not use a .htaccess file, set the '''AllowOverride''' variable to AllowOverride None to prevent .htaccess lookups.<br />
* Set '''DirectoryIndex''' correctly so as to avoid content-negotiation. Here's an example from a production server:<br />
DirectoryIndex index.php index.html index.htm<br />
* Unless you are doing development work on the server, set '''ExtendedStatus Off''' and disable mod_info as well as mod_status.<br />
* Leave '''HostnamesLookups Off''' (as default) to reduce DNS latency.<br />
* Consider reducing the value of '''TimeOut''' to between 30 to 60 (seconds). <br />
* For the '''Options directive''', avoid Options Multiviews as this performs a directory scan. To reduce disk I/O further use<br />
Options -Indexes FollowSymLinks<br />
*'''Caching''' - Apache can be told to make pages load a lot faster by specifying that the browser should cache some various page elements such as images and reuse them from local memory rather than ask for them again every time a page is requested. How to do this varies slightly between OSes but there are two basic steps:<br />
<br />
# Install and enable mod_expires - refer to documentation or man pages<br />
# Add this code to the virtual server config file within the <directory> section for the root directory (or within the .htaccess file if AllowOverrides is On):<br />
<IfModule mod_expires.c><br />
ExpiresActive On<br />
ExpiresDefault "access plus 1 seconds"<br />
ExpiresByType text/html "access plus 1 seconds"<br />
ExpiresByType image/gif "access plus 1 week"<br />
ExpiresByType image/jpeg "access plus 1 week"<br />
ExpiresByType image/png "access plus 1 week"<br />
ExpiresByType text/css "access plus 1 week"<br />
ExpiresByType text/javascript "access plus 1 week"<br />
ExpiresByType application/x-javascript "access plus 1 week"<br />
ExpiresByType text/xml "access plus 1 seconds"<br />
</IfModule><br />
<br />
The effect is to make everything stay in the cache except HTML and XML, which change dynamically. It's possible to gain a several hundred percent decrease in load times this way. Adjust the cache times according to how often your images etc change.<br />
<br />
More info: [http://www.metaskills.net/blog/heuristics/sysadmin/how-to-control-browser-caching-with-apache-2 www.metaskills.net]<br />
<br />
* Alternatively, you can increase web server performance by using the '''light-weight webserver''' [http://www.lighttpd.net/ lighttpd] in combination with PHP in fastCGI-mode instead of Apache. Lighttpd has a lower memory consumption than Apache. One single apache process requires more RAM than the whole lighttpd with all of its fastCGI-processes together. Note that Lighttpd is relatively difficult to configure and administration takes a more time.<br />
<br />
===IIS performance===<br />
All alter this location in the registry:<br />
HKLM\SYSTEM\CurrentControlSet\Services\Inetinfo\Parameters\<br />
* The equivalent to KeepAliveTimeout is '''ListenBackLog''' (IIS - registry location is HKLM\ SYSTEM\ CurrentControlSet\ Services\ Inetinfo\ Parameters). Set this to between 2 to 5.<br />
*Change the '''MemCacheSize''' value to adjust the amount of memory (Mb) that IIS will use for its file cache (50% of available memory by default).<br />
*Change the '''MaxCachedFileSize''' to adjust the maximum size of a file cached in the file cache in bytes. Default is 262,144 (256K).<br />
*Create a new DWORD called '''ObjectCacheTTL''' to change the length of time (in milliseconds) that objects in the cache are held in memory. Default is 30,000 milliseconds (30 seconds).<br />
<br />
==Database performance==<br />
<br />
Moodle contains a script which will display some key database performance statistics from the [http://phplens.com/lens/adodb/docs-perf.htm ADOdb performance monitor]. Run the script in your browser as in the following example:<br />
<br />
http://www.mymoodle.com/admin/dbperformance.php<br />
<br />
Use the data displayed as a guide to tune and improve the performance of your database server.<br />
<br />
===MySQL performance===<br />
<br />
The following are MySQL specific settings which can be adjusted for better performance in your my.cnf (my.ini in Windows). The file contains a list of settings and their values. To see the current values use these commands<br />
SHOW STATUS;<br />
SHOW VARIABLES; <br />
'''Important''': You must make backups of your database before attempting to change any MySQL server configuration. After any change to the my.cnf, restart mysqld.<br />
* Enable the '''query cache''' with <br />
query_cache_type = 1. <br />
For most Moodle installs, set the following:<br />
query_cache_size = 36M <br />
query_cache_min_res_unit = 2K. <br />
The query cache will improve performance if you are doing few updates on the database. <br />
* Set the '''table cache''' correctly. For Moodle 1.6 set <br />
table_cache = 256 <br />
(min), and for Moodle 1.7 set <br />
table_cache = 512 <br />
(min). The table cache is used by all threads (connections), so monitor the value of opened_tables to further adjust - if opened_tables > 3 * table_cache then increase table_cache upto your OS limit. Note also that the figure for table_cache will also change depending on the number of modules and plugins you have installed. Find the number for your server by executing the mysql statement below. Look at the number returned and set table_cache to this value.<br />
mysql>SELECT COUNT(table_name) FROM information_schema.tables WHERE table_schema='yourmoodledbname';<br />
* Set the '''thread cache''' correctly. Adjust the value so that your thread cache utilization is as close to 100% as possible by this formula:<br />
thread cache utilization (%) = (threads_created / connections) * 100<br />
* The '''key buffer''' can improve the access speed to Moodle's SELECT queries. The correct size depends on the size of the index files (.myi) and in Moodle 1.6 or later (without any additional modules and plugins), the recommendation for this value is key_buffer_size = 32M. Ideally you want the database to be reading once from the disk for every 100 requests so monitor that the value is suitable for your install by adjusting the value of key_buffer_size so that the following formulas are true:<br />
key_read / key_read_requests < 0.01<br />
key_write / key_write_requests <= 1.0<br />
* Set the '''maximum number of connections''' so that your users will not see a "Too many connections" message. Be careful that this may have an impact on the total memory used. MySQL connections usually last for milliseconds, so it is unusual even for a heavily loaded server for this value to be over 200.<br />
* Manage '''high burst activity'''. If your Moodle install uses a lot of quizzes and you are experiencing performance problems (check by monitoring the value of threads_connected - it should not be rising) consider increasing the value of back_log.<br />
* '''Optimize your tables weekly and after upgrading Moodle'''. It is good practice to also optimize your tables after performing a large data deletion exercise, e.g. at the end of your semester or academic year. This will ensure that index files are up to date. Backup your database first and then use:<br />
mysql>CHECK TABLE mdl_tablename;<br />
mysql>OPTIMIZE TABLE mdl_tablename;<br />
:The common tables in Moodle to check are mdl_course_sections, mdl_forum_posts, mdl_log and mdl_sessions (if using dbsessions). Any errors need to be corrected using REPAIR TABLE (see the [http://dev.mysql.com/doc/refman/5.0/en/repair-table.html MySQL manual] and this [http://moodle.org/mod/forum/discuss.php?d=58208#p279638 forum script]).<br />
* '''Maintain the key distribution'''. Every month or so it is a good idea to stop the mysql server and run these myisamchk commands.<br />
#myisamchk -a -S /pathtomysql/data/moodledir/*.MYI<br />
:'''Warning''': You must stop the mysql database process (mysqld) before running any myisamchk command. If you do not, you risk data loss.<br />
* Reduce the number of '''temporary tables saved to disk'''. Check this with the created_tmp_disk_tables value. If this is relatively large (>5%) increase tmp_table_size until you see a reduction. Note that this will have an impact on RAM usage.<br />
* Moodle's tables are in the MyISAM format, so '''turn InnoDB off''' as there is no performance gain. Add <code>skip-innodb</code> to your <code>my.cnf</code> file. If you must use InnoDB, you'll have to convert all of Moodle's tables. To do this run the innodb script:<br />
<br />
http://www.mymoodle.com/admin/innodb.php<br />
<br />
===Other database performance links===<br />
* Consider using a '''distributed cacheing system''' like [http://en.wikipedia.org/wiki/Memcached memcached] but note that memcached does not have any security features so it should be used behind a firewall.<br />
* Consider using PostgreSQL. See [[Arguments in favour of PostgreSQL]] and [http://moodle.org/mod/forum/discuss.php?d=49195 how to migrate from MySQL to PostgreSQL] (forum discussion).<br />
* [[Increasing the database connection lifetime | Try increasing the database connection lifetime]]<br />
* [http://dev.mysql.com/doc/refman/5.0/en/server-parameters.html General advice on tuning MySQL parameters] (advice from the MySQL manual)<br />
* [http://www.mysqlperformanceblog.com/2007/11/01/innodb-performance-optimization-basics/ InnoDB performance optimization] taken from the [http://www.mysqlperformanceblog.com/ MySQL performance blog] site.<br />
<br />
==Moodle Admin settings==<br />
* In Moodle 1.7 or later, set the '''Cache type''' for your server: Site Admin -> Server -> Performance -> Cache type. There are several options available. <br />
:*If you do not have eaccelerator or mmemcached installed, choose "internal" (which makes use of the record/internal cache - see the next bullet point). <br />
:* If you have a single server and have compiled '''eaccelerator with shared memory support''', set the cache type to the eaccelerator option. <br />
:* If you have a '''separate memcached server''', set the cache type to memcached and enter a csv list of server IP addresses.<br />
* Enable the '''record/internal cache''': Site Admin -> Server -> Performance -> Record cache = True. Set the maximum amount of memory allocated to the cache in the Int Cache Max box. This will enable a primary cache for database records, without using any database engine cache, e.g. MySQL/PostgreSQL cache. See [http://tracker.moodle.org/browse/MDL-7196 this Tracker entry] for a full discussion.<br />
* Enable the '''language cache'''.<br />
* Large log files can cause overall performance to degrade over time. If you observe that the site has gradually got slower loading pages in the browser, '''reduce your Log life time''' setting (Admin/Server/Cleanup).<br />
* Performance can be greatly improved by allowing Moodle to use the system '''zip/unzip''' commands (rather than PHP-based zip libraries) - visit Admin/Server/System Paths and enter the path to the relevant executables. (Similarly, filling in the path to '''du''' will improve Moodle's speed at listing directory contents.)<br />
* Note that using '''secure web connections''' ('''https''' rather than '''http''') carries a higher processing burden, both for the webserver and the client - particularly because cacheing cannot be used as effectively, so the number of file requests is likely to increase dramatically. For this reason using https for all Moodle pages is not recommended. You can enable https just for the login screen, simply from Moodle's config page.<br />
* Check your '''filters'''. Having too many filters active can have serious effects on server load, especially on lower-end systems. The number of active filters has a direct effect on the perceived latency of your site; that is the time taken for each page impression. <br />
* Enable the '''text cache''' but do not "Filter all strings" unless you have a specific need. If in doubt profile the performance, and see how your changes affect the processing time.<br />
* Check your '''anti-virus''' measures on the server. Although they are useful for preventing security holes being exploited, some "On-Demand" scanners can affect performance by scanning page content (word, ppt files etc).<br />
* If there are performance problems loading course pages, check the '''Resource module settings'''. The setting resource_filterexternalpages is known to slow-down course pages and should be set to 'No' for better performance.<br />
* Check your '''forum settings'''. To improve performance set forum_trackreadposts = No and forum_usermarksread = Yes (this will impact on the convenience of your users' forum experience). Also consider setting the time of the day when old posts are cleared from the read table (forum_cleanreadtime) to when your site is less busy.<br />
<br />
==Performance of different Moodle modules==<br />
<br />
Moodle's activity modules, filters, and other plugins can be activated/deactivated. If necessary, you may wish to deactivate some features (such as chat) if not required - but this isn't necessary. Some notes on the performance of certain modules:<br />
<br />
* The '''Chat''' module is [http://moodle.org/mod/forum/discuss.php?d=37979&parent=175079 said] to be a hog in terms of frequent HTTP requests to the main server. This can be reduced by setting the module to use ''Streamed'' updates, or, if you're using a Unix-based webserver, by running the chat in daemon mode. When using the Chat module use the configuration settings to tune for your expected load. Pay particular attention to the ''chat_old_ping'' and ''chat_refresh'' parameters as these can have greatest impact on server load.<br />
* The '''Quiz''' module is known to stretch database performance. Try to optimise your database server by tuning. See [http://moodle.org/mod/forum/discuss.php?d=25616&parent=120770 for a brief report on performance for 55 students simultaneously using quizzes]<br />
** See this Case Study for an extensive server stress test with 300 quiz users.[http://moodle.org/mod/forum/discuss.php?d=68579] And this accompanying report on network traffic and server loads. [http://elearning.sgu.ac.jp/doc/PT/]<br />
* The Moodle '''Cron''' task is triggered by calling the script ''cron.php''. If this is called over HTTP (e.g. using wget or curl) it can take a large amount of memory on large installations. If it is called by directly invoking the php command (e.g. ''php -f /path/to/moodle/directory/admin/cron.php'') efficiency can be much improved.<br />
<br />
==See also==<br />
<br />
*Using Moodle [http://moodle.org/mod/forum/view.php?f=94 Servers and Performance] forum<br />
<br />
There have been a lot of discussions on moodle.org about performance, here are some of the more interesting and (potentially) useful ones:<br />
<br />
* [http://moodle.org/mod/forum/discuss.php?d=83057 Performance woes!]<br />
* [http://moodle.org/mod/forum/discuss.php?d=57028 Performance perspectives - a little script]<br />
* [http://moodle.org/mod/forum/discuss.php?d=88927 Comments on planned server hardware]<br />
<br />
[[Category:Performance]]<br />
<br />
[[fr:Performance]]<br />
[[ja:パフォーマンス]]<br />
[[pl:Wydajność]]</div>Kawhttps://docs.moodle.org/20/en/index.php?title=Moodle_migration&diff=30173Moodle migration2007-12-12T13:19:10Z<p>Kaw: /* Migrating a complete Moodle site */ Correct sed command</p>
<hr />
<div>There are times when you will need to move your Moodle site from one server to another. This is known as migrating your Moodle site and occurs when you need to change the <code>$CFG->wwwroot</code> value in your Moodle ''config.php''. The process is divided into the following tasks:<br />
<br />
<br />
==Upgrade Moodle==<br />
<br />
When migrating Moodle it is often a good idea to take the opportunity to upgrade Moodle to the latest version. If you manage your own server, follow the instructions in [[Upgrading | upgrading moodle]], otherwise check if your host can upgrade for you.<br />
<br />
==Restore a single course==<br />
<br />
You may need to restore a single course from an old site to a new one, especially if you are testing the migration. When restoring a Moodle backup file to Moodle on a different server than the one used to create the backup, the absolute referenced links to files maybe broken. To fix this problem open the ''backup-coursename.zip'' file and edit the ''moodle.xml'' file replacing links with <code>$@FILEPHP@$</code>.<br />
<br />
For example, replace <nowiki>http://yourserver.com/file.php/243/</nowiki> with <code>$@FILEPHP@$</code><br />
<br />
When the file is restored it will use the correct file path for the new course.<br />
<br />
==Migrating a complete Moodle site==<br />
<br />
This involves moving a whole site from one server to another. If you are changing the domain/IP address to the new server you need to do these steps:<br />
* '''Maintenance mode'''. Place your current Moodle site in maintenance mode to prevent any further additions to the Moodle database. Don't let administrators login during the migration as they are not affected by the maintenance mode setting.<br />
* '''Backup your current Moodle database'''. Do this by following the instructions in the [[Upgrading | upgrading Moodle]] page. This will give you a text file containing the mysql dump.<br />
* '''Copy the Moodle software'''. You will need to copy the Moodle code itself to the new server - upgrade the code to the latest version if you can.<br />
* '''Change <code>$CFG->wwwroot</code>'''. In your (possibly new) Moodle directory, change the <code>$CFG->wwwroot</code> variable in the ''config.php'' file for the new server.<br />
* '''Copy data directory contents (moodledata)'''. Copy the contents of your data directory (check for the value in <code>$CFG->dataroot</code>) to the new server. Check also that permissions remain the same on the new dataroot folder and change the value if you have changed its location on the new server.<br />
* '''Change your Moodle URL'''. If you have a new URL, you'll need to change this in the Moodle database to the new server. This is needed as links to pictures, files, etc are stored as absolute links and will reference the old <code>$CFG->wwwroot</code> value. So when loading a mysql backup dump of the Moodle server into mysql on another server the absolute referenced links will be broken. There are two methods of doing this:<br />
:(a) The first method changes the Moodle URL using the Moodle script ''replace.php'' while your site is currently running just before you backup the Moodle database. Point your browser to <nowiki>http://yourserver.com/admin/replace.php</nowiki><br />
<br />
:Enter the url for your old server (<nowiki>http://oldserver.com/</nowiki>) and new server (<nowiki>http://newserver.com/</nowiki>) and it will fix the mysql tables. You will also need to clear out any cached links by restarting your webserver. Now, take another backup of the Moodle database - this one will have the correct URLs.<br />
<br />
:(b) The second method is to backup the Moodle database first, then use the search and replace feature of your text editor (or use a unix tool like sed) to replace the old URL with the new one in the mysql backup file. Here is an example sed command:<br />
<br />
: <code>#sed -e 's/oldserver.com/newserver.com/' oldmysqldump.sql > newmysqldump.sql</code><br />
<br />
:'''Tip''': You may want to check the mysqldump file to see how the old server was referenced.<br />
:After changing the URL, restore the mysql database<br />
* '''Test the migration'''. To test the new install, access Moodle using your browser and the new server's URL. When you have tested that a number of links in the courses work, take the new Moodle site out of maintenance mode.<br />
'''See also''': [http://moodle.org/mod/forum/discuss.php?d=85812 Forum discussion] on migrating Moodle's data directory on a Windows system.<br />
<br />
==DNS changes==<br />
<br />
You may have had to change the DNS entries for the new Moodle site. If you have done so, it will take some time for the changes to replicate, so be patient.<br />
<br />
==Internal and external access==<br />
<br />
Lastly, check that the new site can be accessed internally and externally. <br />
<br />
==See also==<br />
* [http://moodle.org/mod/forum/discuss.php?d=62959 Changing Moodle URL] forum discussion<br />
* [http://moodle.org/mod/forum/discuss.php?d=57477 Changing site address] forum discussion<br />
* [http://moodle.org/mod/forum/discuss.php?d=76704 Upgrading whilst migrating] forum discussion<br />
<br />
[[Category:Installation]]<br />
<br />
[[fr:Migration de Moodle]]<br />
[[nl:Moodle verhuizen]]</div>Kawhttps://docs.moodle.org/20/en/index.php?title=Moodle_migration&diff=30083Moodle migration2007-12-10T06:58:18Z<p>Kaw: /* Migrating a complete Moodle site */ Changed order</p>
<hr />
<div>There are times when you will need to move your Moodle site from one server to another. This is known as migrating your Moodle site and occurs when you need to change the <code>$CFG->wwwroot</code> value in your Moodle ''config.php''. The process is divided into the following tasks:<br />
<br />
<br />
==Upgrade Moodle==<br />
<br />
When migrating Moodle it is often a good idea to take the opportunity to upgrade Moodle to the latest version. If you manage your own server, follow the instructions in [[Upgrading | upgrading moodle]], otherwise check if your host can upgrade for you.<br />
<br />
==Restore a single course==<br />
<br />
You may need to restore a single course from an old site to a new one, especially if you are testing the migration. When restoring a Moodle backup file to Moodle on a different server than the one used to create the backup, the absolute referenced links to files maybe broken. To fix this problem open the ''backup-coursename.zip'' file and edit the ''moodle.xml'' file replacing links with <code>$@FILEPHP@$</code>.<br />
<br />
For example, replace <nowiki>http://yourserver.com/file.php/243/</nowiki> with <code>$@FILEPHP@$</code><br />
<br />
When the file is restored it will use the correct file path for the new course.<br />
<br />
==Migrating a complete Moodle site==<br />
<br />
This involves moving a whole site from one server to another. If you are changing the domain/IP address to the new server you need to do these steps:<br />
* '''Maintenance mode'''. Place your current Moodle site in maintenance mode to prevent any further additions to the Moodle database. Don't let administrators login during the migration as they are not affected by the maintenance mode setting.<br />
* '''Backup your current Moodle database'''. Do this by following the instructions in the [[Upgrading | upgrading Moodle]] page. This will give you a text file containing the mysql dump.<br />
* '''Copy the Moodle software'''. You will need to copy the Moodle code itself to the new server - upgrade the code to the latest version if you can.<br />
* '''Change <code>$CFG->wwwroot</code>'''. In your (possibly new) Moodle directory, change the <code>$CFG->wwwroot</code> variable in the ''config.php'' file for the new server.<br />
* '''Copy data directory contents (moodledata)'''. Copy the contents of your data directory (check for the value in <code>$CFG->dataroot</code>) to the new server. Check also that permissions remain the same on the new dataroot folder and change the value if you have changed its location on the new server.<br />
* '''Change your Moodle URL'''. If you have a new URL, you'll need to change this in the Moodle database to the new server. This is needed as links to pictures, files, etc are stored as absolute links and will reference the old <code>$CFG->wwwroot</code> value. So when loading a mysql backup dump of the Moodle server into mysql on another server the absolute referenced links will be broken. There are two methods of doing this:<br />
:(a) The first method changes the Moodle URL using the Moodle script ''replace.php'' while your site is currently running just before you backup the Moodle database. Point your browser to <nowiki>http://yourserver.com/admin/replace.php</nowiki><br />
<br />
:Enter the url for your old server (<nowiki>http://oldserver.com/</nowiki>) and new server (<nowiki>http://newserver.com/</nowiki>) and it will fix the mysql tables. You will also need to clear out any cached links by restarting your webserver. Now, take another backup of the Moodle database - this one will have the correct URLs.<br />
<br />
:(b) The second method is to backup the Moodle database first, then use the search and replace feature of your text editor (or use a unix tool like sed) to replace the old URL with the new one in the mysql backup file. Here is an example sed command:<br />
<br />
: <code>#sed -e 's/oldserver.com/newserver.com/' mysqldump.sql</code><br />
<br />
:'''Tip''': You may want to check the mysqldump file to see how the old server was referenced.<br />
:After changing the URL, restore the mysql database<br />
* '''Test the migration'''. To test the new install, access Moodle using your browser and the new server's URL. When you have tested that a number of links in the courses work, take the new Moodle site out of maintenance mode.<br />
'''See also''': [http://moodle.org/mod/forum/discuss.php?d=85812 Forum discussion] on migrating Moodle's data directory on a Windows system.<br />
<br />
==DNS changes==<br />
<br />
You may have had to change the DNS entries for the new Moodle site. If you have done so, it will take some time for the changes to replicate, so be patient.<br />
<br />
==Internal and external access==<br />
<br />
Lastly, check that the new site can be accessed internally and externally. <br />
<br />
==See also==<br />
* [http://moodle.org/mod/forum/discuss.php?d=62959 Changing Moodle URL] forum discussion<br />
* [http://moodle.org/mod/forum/discuss.php?d=57477 Changing site address] forum discussion<br />
* [http://moodle.org/mod/forum/discuss.php?d=76704 Upgrading whilst migrating] forum discussion<br />
<br />
[[Category:Installation]]<br />
<br />
[[fr:Migration de Moodle]]<br />
[[nl:Moodle verhuizen]]</div>Kawhttps://docs.moodle.org/20/en/index.php?title=Installation_FAQ&diff=30045Installation FAQ2007-12-09T11:46:43Z<p>Kaw: /* Why is a particular page blank or incomplete? */ Typo</p>
<hr />
<div>{{FAQ}}<br />
<br />
==PHP - is it installed and what version do I have?==<br />
<br />
Make a new file on your web site called ''info.php'', containing the following text, and call it from your browser:<br />
<br />
<?PHP phpinfo() ?><br />
<br />
If nothing happens then you don't have PHP installed or your webserver is not configured to handle .php files properly. See the installation docs for some information about where to download it for your computer. See the [[phpinfo]] page for details about the content of this page.<br />
<br />
== System information needed for Installation Forum ==<br />
When posting questions to the installation forum, try to provide as much background information as possible about your moodle system. Use this template to copy and paste into your post:<br />
* Server Operating System name (version also if possible): <br />
* Browser name (version also if possible):<br />
* Moodle version:<br />
* Moodle install type? (New/Upgrade):<br />
* Moodle config.php attached?(Y/N):<br />
* Phpinfo attached? (Y/N):<br />
<br />
For the last two items, try to include the following in your post as an attachment:<br />
* A copy of your phpinfo output as shown in your browser (see the instructions above for an explanation of how to obtain this).<br />
* A copy of the Moodle configuration file. This is located in the directory moodle and is named config.php<br />
<br />
Copy and paste both of these into a single text file (using vi, Notepad, etc) and attach this to your post.<br />
<br />
If you cannot provide your phpinfo, try to copy & paste and complete these in your post:<br />
* Webserver (e.g. Apache/IIS) version:<br />
* Database server (e.g. MySQL, PostgreSQL) version:<br />
* PHP version:<br />
<br />
For installation on web hosting accounts: contact your support desk who should be able to tell you this information.<br />
<br />
: '''Security Warning''': Make sure you edit any files and delete any passwords before posting onto the forum.<br />
<br />
==What & where are Moodle's configuration settings stored?==<br />
Configuration settings are stored in the config.php file stored in your moodle folder. This file is created during the installation process. If there is a problem and the installation cannot create the file, you can try creating it manually from the [[Configuration file]] docs. Please remember that manually editing the file is not recommended and may lead to blank pages, especially if there are additional spaces and/or lines after the final php closing tag "?>".<br />
<br />
==Running a health check==<br />
Moodle contains a script that will help identify common php and webserver configuration problems as well as configuration problems. It is a good idea to run this script to check if you are having post-installation problems. Use your browser to run this file:<br />
<br />
http://www.mymoodle.com/moodle/admin/health.php<br />
<br />
Change the above line if you have installed moodle in the webroot instead of a folder inside the webroot.<br />
<br />
==Downloading previous releases of Moodle==<br />
* '''Generic Packages''': If your server does not meet the [[Installing_Moodle#Requirements | requirements]] for the current version of Moodle, you can download previous releases by using wget, lynx or curl with this URL:<br />
<nowiki>http://download.moodle.org/stable[version_number]</nowiki> <br />
:For example: to download Moodle version 1.5, use http://download.moodle.org/stable15. You'll see a directory tree with the files displayed. Click on the one you want and download as normal - if you require the latest update of the version, scroll to the end of the list and download the "moodle-latest" file, or alternatively use these URLs for zip or tgz downloads:<br />
<nowiki>http://download.moodle.org/stable[version_number]/moodle-latest-[version_number].zip</nowiki><br />
<nowiki>http://download.moodle.org/stable[version_number]/moodle-latest-[version_number].tgz</nowiki><br />
<br />
:Changes made in the version in the last month are listed in the "CHANGES" file in the directory listing. The files you download contain Moodle code and are not the Windows or Mac packages - so you need to have a webserver, a database server and PHP already installed. The earliest version available is Moodle 1.3.<br />
* '''Windows Packages''': To download previous releases of the Moodle packages for Windows, use this URL:<br />
<nowiki>http://download.moodle.org/windows/MoodleWindowsInstaller-latest-[version_number].zip</nowiki><br />
* '''Mac Packages''': To download previous releases of the Mac pacakges, use either of these URLs (depending on whether you need the Intel or PPC package):<br />
<nowiki>http://download.moodle.org/macosx/Moodle4Mac-Intel-[version_number].dmg</nowiki><br />
<nowiki>http://download.moodle.org/macosx/Moodle4Mac-PPC-[version_number}.dmg</nowiki><br />
* '''Using CVS''': You can also use CVS to download older releases and incremental releases of the Moodle generic packages, e.g. Moodle 1.5.4 - see the [[CVS_for_Administrators | CVS documentation]].<br />
<br />
== How to enable and check PHP error logs==<br />
PHP can be set up to log errors in a variety of different ways: two of these involve the use of the php.ini file and the ini_set command. <br />
* '''Using the php.ini file''': The log settings are contained in the php.ini file stored on the server. If you don't know where that is, edit your Moodle ''config.php'' and add the following as the second line<br />
<br />
phpinfo();<br />
<br />
:then reload the web page. Look for the entry '''Configuration File (php.ini) Path'''.<br />
<br />
:When you have located php.ini open it in your favorite text editor. Find the '''Error handling and logging''' section of the php.ini file. Make sure that both '''display_errors = On''', '''display_startup_errors = On''' and '''log_errors = On''' are present and uncommented. Check the value of '''error_log''' - this tells you the location of the file errors are logged to. If it is commented out then errors will be sent to the web server error log file. Remember, if you make any changes to this file you will need to restart the web server (or just reboot the server).<br />
<br />
* '''Using ini_set commands''': If you are using Moodle 1.7 or higher, the previous steps are not enough. In those versions error logging parameters are dependant on certain administrative settings that you specify in the debugging section. The problem is that if you can't access the administrative pages, you can't set the debugging options. So the only way to modify them is by adding the following lines to your config.php file, just before the last line (the one containing a single'?>' only):<br />
<br />
ini_set ('display_errors', 'on');<br />
ini_set ('log_errors', 'on');<br />
ini_set ('display_startup_errors', 'on');<br />
ini_set ('error_reporting', E_ALL);<br />
<br />
:This will enable the same settings specified above even if Moodle sets them otherwise. <br />
:'''Important''': Remember to put them just before the last line of config.php.<br />
<br />
==Any text I add with an apostrophe (') or a quote (") causes errors or comes up with a slash added==<br />
<br />
Problems caused by apostrophes are caused by incorrect "magic quotes" settings. Moodle requires the following settings in the php.ini file (which are usually the default):<br />
<br />
magic_quotes_gpc = On<br />
magic_quotes_runtime = Off<br />
<br />
Please see [[Installing Moodle]] for more details.<br />
<br />
If you are using [[Debian_GNU/Linux_installation|Debian]] then the problem might be in the version of PHP that you have installed. Have a look at this [http://tracker.moodle.org/browse/MDL-9691 bug report ] to see if it matches your situation.<br />
<br />
==Email copies are not being sent from my forums==<br />
<br />
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.<br />
<br />
Basically, you need to set up a process to regularly call the script <code><nowiki>http://yoursite/admin/cron.php</nowiki></code>. Please refer to the [[Cron|cron instructions]].<br />
<br />
'''Tip:''' Try the default setting in Moodle variables page. Leave the smtphost blank. This will be acceptable for the majority of users.<br />
<br />
'''Tip:''' Make sure that allowuseremailcharset in Administration > Configuration > Variables > Mail is set to No. Setting this to Yes might cause this problem in some versions of Moodle.<br />
<br />
==Error: database connection failed==<br />
<br />
If you get errors like "database connection failed" or "could not connect to the database you specified", here are some possible reasons and some possible solutions.<br />
<br />
* Your '''database server''' isn't installed or running. To check this for MySQL try typing the following command line<br />
$telnet database_host_name 3306<br />
:You should get a cryptic response which includes the version number of the MySQL server. <br />
* If you are attempting to run '''two instances of Moodle on different ports''', use the ip address of the host (not localhost) in the $CFG->dbhost setting, e.g. $CFG->dbhost = 127.0.0.1:3308.<br />
* You don't have the '''PHP mysql or postgresql extensions''' installed (please refer to FAQ re. whether PHP is installed).<br />
* You haven't created a '''Moodle database and assigned a user''' with the correct privileges to access it. <br />
* The '''Moodle database settings''' are incorrect. The database name, database user or database user password in your Moodle configuration file ''config.php'' are incorrect. Use phpMyAdmin to set up and check your MySQL installation.<br />
* Check that there are '''no apostrophes or non-alphabetic letters''' in your MySQL username or password.<br />
* You are using MySQL version 4.1 or higher but the PHP MySQL extension is pre-4.1 (check in your phpinfo output). In this case the '''default password hashing algorithm''' is incompatible with that available in the PHP mysql extension versions 4.x.x. Use these MySQL commands to change the passwords to the old format:<br />
<br />
mysql>SET PASSWORD FOR 'root'@'localhost' = OLD_PASSWORD('password');<br />
mysql>SET PASSWORD FOR 'moodleuser'@'localhost' = OLD_PASSWORD('password');<br />
<br />
:Also, consider upgrading your PHP MySQL extension. See [http://dev.mysql.com/doc/mysql/en/old-client.html this MySQL document] for further information on how to deal with this problem.<br />
* You are using Fedora core 3 or some other Linux system with '''SELinux installed''' and enabled. See the following URL for information on how to disable SELinux: http://fedora.redhat.com/projects/selinux/ If you don't want to disable SELinux, you have to allow httpd process to create network connections:<br />
<br />
setsebool httpd_can_network_connect true<br />
<br />
* Mac OSX users -- if you are running MySQL on a Mac OSX, try changing '''$CFG->dbhost''' from 'localhost' to '127.0.0.1'<br />
'''See also''': MySQL page on [http://dev.mysql.com/doc/refman/5.0/en/common-errors.html common errors] which lists several possible scenarios for connection failure, with advice on how to fix the problems.<br />
<br />
==I can't log in - I just stay stuck on the login screen==<br />
<br />
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].<br />
<br />
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]].<br />
<br />
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>.<br />
<br />
If you are still having problems, read the [[Can_not_log_in | Cannot log in]] page.<br />
<br />
==I can't log in with message "Please verify that the current setting of session.save_path is correct" ==<br />
<br />
This error occurs when PHP is having problems saving its session files. You may also see these other error messages displayed on the screen or in your log files:<br />
<br />
Warning: Unknown: open(some-path/sessions/sess_acbf942a7399db3489ffa910e35d5242, O_RDWR)<br />
failed: Permission denied (13) in Unknown on line 0<br />
<br />
Warning: Unknown(): open(some-path/sessions/sess_acbf942a7399db3489ffa910e35d5242, O_RDWR) <br />
failed: No space left on device (28) in Unknown on line 0<br />
<br />
Warning: Unknown: Failed to write session data (files). Please verify that the current <br />
setting of session.save_path is correct (some-path/sessions) in Unknown on line 0 <br />
<br />
To temporarily bypass these errors, '''use database sessions''' by editing your [[Configuration_file | moodle configuration file]] and adding this line:<br />
<br />
$CFG->dbsessions = true;<br />
<br />
Database sessions may overload your mysql database and are not ideal in a shared hosting environment, so if this solves the problem, you can start fixing the problem as follows:<br />
* Check '''access rights'''. The session.save_path should be accessible by the apache user. Try this command:<br />
<br />
chown -R apache:apache some-path/sessions<br />
<br />
:This assumes that 'apache' is the name of the user your webserver runs under - it could also be 'nobody'.<br />
* Check the '''permissions''' to the directory that PHP is trying to save to (session.save_path = some-path/sessions). Set the permissions initially to 0777 (everyone read, write, execute) with this command:<br />
<br />
chmod -R 0777 some-path/sessions<br />
<br />
:If this fixes the problem, reduce the permissions (700 is recommended).<br />
<br />
'''See also''': Session problems can be specific to your server environment. As an example, see [http://moodle.org/mod/forum/discuss.php?d=55925#254596 this forum discussion] about session problems with Lycos hosting.<br />
<br />
==I log in but the login link doesn't change. I am logged in and can navigate freely.==<br />
<br />
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.<br />
<br />
==I keep getting this error: A server error that affects your login session was detected.==<br />
<br />
Please refer to the Using Moodle forum discussion [http://moodle.org/mod/forum/discuss.php?d=73716 A server error that affects your login session was detected. Please login again or restart your browser.].<br />
<br />
==I keep getting this error: Failed opening required '/web/moodle/lib/setup.php'==<br />
<br />
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.<br />
<br />
Sometimes people only use the path from their home directory, or relative to the root of the web server directory.<br />
<br />
==My pages show fatal errors such as : Parse error, call to undefined function: get_string()==<br />
<br />
If you see errors like:<br />
<br />
Parse error: parse error, unexpected T_VARIABLE in /path/to/moodle/config.php on line 94 <br />
Fatal error: Call to undefined function: get_string() in /path/to/moodle/mod/resource/lib.php<br />
on line 11<br />
<br />
then you have probably left out a semi-colon or closing quote from a line in ''config.php'' (previous to line 94).<br />
<br />
Another possibility is that you edited ''config.php'' in a program like Word and saved it as a HTML web page, instead of using a plain text editor like Notepad.<br />
<br />
Another thing to check, particularly if you are using 3rd party modules or plugins, is whether any of the php scripts use short open tags (<? ?>) instead of proper ones (<?php ?>). Short tags are bad for various reasons, so first contact the author of that extension to tell them about the problem. Then either replace short tags with conventional ones, or set this line in php.ini:<br />
<br />
short_open_tag = On<br />
<br />
You should never find short tags in core moodle code. If you do, please file a bug in the bug tracker.<br />
<br />
==Serious Error! Could not set up the site!==<br />
<br />
Please refer to the Using Moodle forum discussion [http://moodle.org/mod/forum/discuss.php?d=32071 Serious Error! Could not set up the site!].<br />
<br />
==Uploaded files give "File not found"==<br />
<br />
For example: Not Found: The requested URL /moodle/file.php/2/myfile.jpg was not found on this server.<br />
<br />
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):<br />
<br />
'''AcceptPathInfo''' on<br />
<br />
Note, this will ONLY work for Apache versions 2.x.<br />
<br />
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.<br />
<br />
To use this alternative method, you should change the ''slasharguments'' variable. For moodle versions < 1.6, this is located in the Operating System section of Administration >> Configuration >> [[admin/config|Variables]]. Otherwise, this option is located in Administration >> Server >> HTTP. You should now be able to access your uploaded files.<br />
<br />
==When I go to the admin page, I get told to make dirroot blank!==<br />
<br />
If you see errors like this:<br />
<br />
Please fix your settings in config.php: <br />
You have: $CFG->dirroot = "/home/users/fred/public_html/moodle"; <br />
but it should be: $CFG->dirroot = "";<br />
<br />
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'':<br />
<br />
if ($dirroot != $CFG->dirroot) {<br />
<br />
and change it to this:<br />
<br />
if (!empty($dirroot) and $dirroot != $CFG->dirroot) {<br />
<br />
==When trying to add a resource I receive error messages==<br />
<br />
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]].<br />
<br />
==Why are all my pages blank?==<br />
<br />
Check the dirroot variable in ''config.php''. You must use complete, absolute pathnames e.g.<br />
<br />
$CFG->dirroot = "d:\inetpub\sites\www.yoursite.com\web\moodle";<br />
<br />
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 enable PHP error displays, set these lines in your ''php.ini'' file and reload the web page.<br />
<br />
display_errors = On<br />
display_startup_errors = On<br />
<br />
To determine if MySQL support is your problem, insert this as the second line in your ''config.php'' file<br />
<br />
phpinfo();<br />
<br />
then reload the web page. Examine the output closely to see if MySQL is supported. If not look for a package you are missing.<br />
<br />
== Why is a particular page blank or incomplete? ==<br />
<br />
*'''Check your web server log files!!''' <br />
:If a particular page is blank or incomplete (it doesn't display the footer), before you do anything else [[Installation_FAQ#How_to_enable_and_check_PHP_error_logs | check your error logs]]. Having established that PHP error logging is working, reproduce the error. Immediately check the error log file right at the end. Hopefully you will see a PHP error message at or very near the end of the file. This may solve your problem directly or makes it a lot easier to diagnose the problem in the Moodle forums.<br />
<br />
*If you are '''upgrading to a new version of Moodle''', check that you do not have an old version of a non-standard block or module installed. Remove any such blocks or modules installed using the admin settings page and start the install process again. However, do also make sure that you have included all required optional plugins that were required by your courses. <br />
<br />
*If you '''do not see any blocks listed''', turn editing on and remove any blocks that you have added to that page and try reloading.<br />
<br />
==Installation hangs when setting-up database tables==<br />
*Sometimes the installation will hang when setting up tables. This will be an abrupt hang with half the page displayed in the browser and/or other outputs removed, e.g. the “Scroll to continue” link is displayed but no “Continue” button is there. If this is the case, it is usually a mysql error and not a php error. Check that there is no limit placed on your mysql database, e.g. a "questions" limit.<br />
<br />
*If the install is on a webhost, adding the following line to the .htaccess file in the moodle directory has been known to solve the problem.<br />
AddType x-mapp-php5 .php<br />
<br />
*Try also renaming the .htaccess file so that it is disabled.<br />
<br />
*You may also want to look and see if you've customized any of your code. Look at the last successful table, and then look at the block, mod, or other code that is referenced by that table. For example, if your install hangs and continues to say that the forum tables were successful as the last message, look at /mod/forum/ for any custom code. If you have customized code, backup those files and replace with the correct files. You can then restart the install by renaming config.php or reinstalling your database from the backup. If your install is successful, you can make your code changes back into the stock Moodle code.<br />
<br />
*It may also be that the "memory_limit" in your php.ini is set too low. Please check your php.ini file and allocate the recommended amount (see [https://docs.moodle.org/en/Installing_Moodle#Requirements Moodle requirements]). For Moodle version 1.8 and above at least 40MB is recommended.<br />
<br />
*A work-around to this problem is to setup a working Moodle system on your local PC or server using the [http://download.moodle.org Moodle Packages]. Once you have a running Moodle, [https://docs.moodle.org/en/Upgrading_Moodle#Backup_important_data backup the database] and import to your webhost. Then backup the Moodle code itself (the "moodle" directory on your PC) and copy this to your webhost using (for example) FTP. Finally, edit the moodle/config.php file for the new settings that have to be changed for the webhost.<br />
<br />
*To avoid this problem when upgrading, prefer to upgrade incrementally. For example: upgrade from 1.6.* to 1.7.* and then to 1.8.* rather than straight from 1.6.* to 1.8.*<br />
<br />
'''Note''': When upgrading an existing database, the installation may appear to hang at the roles generation phase. This process can take a very long time - so please be patient.<br />
<br />
==Why can't I upload a new image into my profile?==<br />
<br />
If you don't see anything on your user profile pages to let you upload user images then it's usually because GD is not enabled on your server. GD is a library that allows image processing.<br />
<br />
1. Make sure '''GD has been included in your PHP installation'''. You can check this by going into Administration >> Configuration >> [[Variables]] and looking for the gdversion setting. This setting is chosen automatically every time you visit that page. If it shows GD version 1 or version 2 then everything should be fine. Save that configuration page and go back to your user profile.<br />
<br />
2. If Moodle thinks GD is not installed, then you will need to '''install the GD library'''. <br />
*On Unix you may need to re-compile PHP with arguments something like this:<br />
<br />
./configure --with-apxs=/usr/local/apache/bin/apxs --with-xml --with-gd <br />
--with-jpeg-dir=/usr/local --with-png-dir=/usr --with-ttf --enable-gd-native-ttf <br />
--enable-magic-quotes --with-mysql --enable-sockets --enable-track-vars <br />
--enable-versioning --with-zlib<br />
<br />
* On Windows this is usually a matter of "turning on" the extension in PHP by editing your php.ini file. To do this remove the semicolon for the php_gd2.dll extension - check that this file is actually present in your php extensions folder first (search your php.ini for extension_dir to determine where this points to on your hard disk). You should then have a line that looks like this:<br />
extension=php_gd2.dll<br />
<br />
:Windows users should see the [[Installing AMP|installation instructions]] for further help. <br />
<br />
3. Remember to '''restart your webserver''' (if possible) and re-visit the Moodle configuration page after making any changes to PHP so it can pick up the correct version of GD.<br />
<br />
'''See also''': Using Moodle forum discussion [http://moodle.org/mod/forum/discuss.php?d=44271 Profile pictures] for additional information.<br />
<br />
==Why do I keep getting error messages about "headers already sent"?==<br />
<br />
If you see errors like this:<br />
<br />
Warning: Cannot add header information - headers already sent by <br />
(output started at /webs/moodle/config.php:87) in /webs/moodle/lib/moodlelib.php <br />
on line 1322 <br />
<br />
Warning: Cannot add header information - headers already sent by <br />
(output started at /webs/moodle/config.php:87) in /webs/moodle/lib/moodlelib.php <br />
on line 1323 <br />
<br />
Warning: Cannot add header information - headers already sent by <br />
(output started at /webs/moodle/config.php:87) in /webs/moodle/login/index.php <br />
on line 54<br />
<br />
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.<br />
<br />
== Why doesn't my Moodle site display the time and date correctly? ==<br />
<br />
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.<br />
<br />
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)<br />
<br />
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.<br />
<br />
==I receive this error "500:Internal Server Error"==<br />
You'll get this error message if there is a syntax error in your .htaccess or httpd.conf files. You will also see this error if your server does not support .htaccess files, especially if it is running PHPsuexec. Also, you may have a directive in your .htaccess or httpd.conf files which are not compatible with your web server version.<br />
<br />
==How do I uninstall Moodle?==<br />
'''Moodle package installation''': If you have downloaded a Moodle package, simply uninstall using your system commands. On Windows PCs, you should access the Control Panel -> Add/Remove Programs. Select the package name and click Change or Remove Programs.<br />
<br />
'''Webhost/manual installation''': If you have installed Moodle manually or have installed onto a webhost, follow these steps:<br />
*Delete the moodle database using this mysql command (or delete using your mysql client, e.g. PHPMyAdmin):<br />
<pre>sql>DROP DATABASE moodle;</pre><br />
:In the above example replace 'moodle' with the name of the moodle database you created when installing.<br />
*Delete the moodledata directory. If you, or your users, have uploaded materials into this directory take a copy of these before deleting this directory.<br />
*Delete the moodle directory itself. This will delete all of the moodle PHP script files.<br />
<br />
<br />
==How do I upgrade Moodle? Do I just overwrite the files?==<br />
Do not overwrite files, it may cause strange errors. You should read the [[Upgrade]] documentation before proceeding.<br />
<br />
==Migrating Moodle to a new site or server==<br />
Migrating Moodle means that you have to move the current installation to a new server, and so may have to change IP addresses or DNS entries. To do this you will need to change the $CFG->wwwroot value in the config.php on the new server. You will also have to change any absolute links stored in the database backup file (before restoring the file on the new server) either using the admin/replace.php script, your text editor or another "search and replace" tool, e.g. sed. For more details see the [[Moodle_migration | Moodle Migration]] page.<br />
<br />
==Fatal error allowed memory size exhausted. How do I increase my php memory limit?==<br />
You will sometimes see an error message something like this:<br />
Fatal error: Allowed memory size of 67108864 bytes exhausted <br />
(tried to allocate xx bytes) in /var/www/moodle/yyyy.php<br />
This error means that the php memory_limit value is not enough for the php script. The memory_limit value is the "allowed memory size" - 64M in the example above (67108864 bytes / 1024 = 65536 KB. 65536 KB / 1024 = 64 MB). You will need to increase the php memory_limit value until this message is not shown anymore. There are two methods of doing this.<br />
*On a hosted installation, add the following line to your .htaccess file (or create one in the moodle directory if it does not already exist):<br />
php_value memory_limit <value>M<br />
Example: php_value memory_limit 40M<br />
*If you have your own server with shell access, edit your php.ini file (make sure it's the correct one by checking in your phpinfo output) as follows:<br />
memory_limit <value>M<br />
Example: memory_limit 40M<br />
Remember that you need to restart your web server to make changes to php.ini effective. An alternative is to disable the memory_limit by using the command ''memory_limit 0''.<br />
<br />
----<br />
==Why does my new installation display correctly on the server, but when I view it from a different machine, styles and images are missing?==<br />
In the installation instructions, one of the suggested settings for 'webroot' is 'localhost'. This is fine if all you want to do is some local testing of your new Moodle installation. If, however, you want to view your new installation from another machine on the same local area network, or view your site on the internet, you will have to change this setting:<br />
*For local testing, 'localhost' is fine for the webroot ($CFG->wwwroot in config.php). <br />
*If you want to test your site from other machines on the same local area network (LAN), then you will have to use the private ip address of the serving machine, (e.g. 192.168.1.2/moodle) or the network name of the serving computer (e.g. network_name_of_serving_machine/moodle) as the web root. Depending on your LAN setup, it may be better to use the network name of the computer rather than its (private) ip address, because the ip address can and will change from time to time. If you don't want to use the network name, then you will have to speak to your network administrator and have them assign a permanent ip address to the serving machine.<br />
*Finally, if you want to test your new installation across the internet, you will have to use either a domain name or a permanent (public) ip address/moodle as your web root. To handle both types of access, see [https://docs.moodle.org/en/masquerading masquerading].<br />
<br />
[[Category:FAQ]]<br />
[[Category:Installation]]<br />
<br />
[[es:FAQ Instalación]]<br />
[[fr:FAQ d'installation]]<br />
[[nl:Installatie FAQ]]<br />
[[ja:インストールFAQ]]<br />
[[ru:Установка FAQ]]</div>Kawhttps://docs.moodle.org/20/en/index.php?title=Installation_FAQ&diff=30034Installation FAQ2007-12-08T22:43:58Z<p>Kaw: /* Uploaded files give "File not found" */ Added 1.8 location of slasharguments</p>
<hr />
<div>{{FAQ}}<br />
<br />
==PHP - is it installed and what version do I have?==<br />
<br />
Make a new file on your web site called ''info.php'', containing the following text, and call it from your browser:<br />
<br />
<?PHP phpinfo() ?><br />
<br />
If nothing happens then you don't have PHP installed or your webserver is not configured to handle .php files properly. See the installation docs for some information about where to download it for your computer. See the [[phpinfo]] page for details about the content of this page.<br />
<br />
== System information needed for Installation Forum ==<br />
When posting questions to the installation forum, try to provide as much background information as possible about your moodle system. Use this template to copy and paste into your post:<br />
* Server Operating System name (version also if possible): <br />
* Browser name (version also if possible):<br />
* Moodle version:<br />
* Moodle install type? (New/Upgrade):<br />
* Moodle config.php attached?(Y/N):<br />
* Phpinfo attached? (Y/N):<br />
<br />
For the last two items, try to include the following in your post as an attachment:<br />
* A copy of your phpinfo output as shown in your browser (see the instructions above for an explanation of how to obtain this).<br />
* A copy of the Moodle configuration file. This is located in the directory moodle and is named config.php<br />
<br />
Copy and paste both of these into a single text file (using vi, Notepad, etc) and attach this to your post.<br />
<br />
If you cannot provide your phpinfo, try to copy & paste and complete these in your post:<br />
* Webserver (e.g. Apache/IIS) version:<br />
* Database server (e.g. MySQL, PostgreSQL) version:<br />
* PHP version:<br />
<br />
For installation on web hosting accounts: contact your support desk who should be able to tell you this information.<br />
<br />
: '''Security Warning''': Make sure you edit any files and delete any passwords before posting onto the forum.<br />
<br />
==What & where are Moodle's configuration settings stored?==<br />
Configuration settings are stored in the config.php file stored in your moodle folder. This file is created during the installation process. If there is a problem and the installation cannot create the file, you can try creating it manually from the [[Configuration file]] docs. Please remember that manually editing the file is not recommended and may lead to blank pages, especially if there are additional spaces and/or lines after the final php closing tag "?>".<br />
<br />
==Running a health check==<br />
Moodle contains a script that will help identify common php and webserver configuration problems as well as configuration problems. It is a good idea to run this script to check if you are having post-installation problems. Use your browser to run this file:<br />
<br />
http://www.mymoodle.com/moodle/admin/health.php<br />
<br />
Change the above line if you have installed moodle in the webroot instead of a folder inside the webroot.<br />
<br />
==Downloading previous releases of Moodle==<br />
* '''Generic Packages''': If your server does not meet the [[Installing_Moodle#Requirements | requirements]] for the current version of Moodle, you can download previous releases by using wget, lynx or curl with this URL:<br />
<nowiki>http://download.moodle.org/stable[version_number]</nowiki> <br />
:For example: to download Moodle version 1.5, use http://download.moodle.org/stable15. You'll see a directory tree with the files displayed. Click on the one you want and download as normal - if you require the latest update of the version, scroll to the end of the list and download the "moodle-latest" file, or alternatively use these URLs for zip or tgz downloads:<br />
<nowiki>http://download.moodle.org/stable[version_number]/moodle-latest-[version_number].zip</nowiki><br />
<nowiki>http://download.moodle.org/stable[version_number]/moodle-latest-[version_number].tgz</nowiki><br />
<br />
:Changes made in the version in the last month are listed in the "CHANGES" file in the directory listing. The files you download contain Moodle code and are not the Windows or Mac packages - so you need to have a webserver, a database server and PHP already installed. The earliest version available is Moodle 1.3.<br />
* '''Windows Packages''': To download previous releases of the Moodle packages for Windows, use this URL:<br />
<nowiki>http://download.moodle.org/windows/MoodleWindowsInstaller-latest-[version_number].zip</nowiki><br />
* '''Mac Packages''': To download previous releases of the Mac pacakges, use either of these URLs (depending on whether you need the Intel or PPC package):<br />
<nowiki>http://download.moodle.org/macosx/Moodle4Mac-Intel-[version_number].dmg</nowiki><br />
<nowiki>http://download.moodle.org/macosx/Moodle4Mac-PPC-[version_number}.dmg</nowiki><br />
* '''Using CVS''': You can also use CVS to download older releases and incremental releases of the Moodle generic packages, e.g. Moodle 1.5.4 - see the [[CVS_for_Administrators | CVS documentation]].<br />
<br />
== How to enable and check PHP error logs==<br />
PHP can be set up to log errors in a variety of different ways: two of these involve the use of the php.ini file and the ini_set command. <br />
* '''Using the php.ini file''': The log settings are contained in the php.ini file stored on the server. If you don't know where that is, edit your Moodle ''config.php'' and add the following as the second line<br />
<br />
phpinfo();<br />
<br />
:then reload the web page. Look for the entry '''Configuration File (php.ini) Path'''.<br />
<br />
:When you have located php.ini open it in your favorite text editor. Find the '''Error handling and logging''' section of the php.ini file. Make sure that both '''display_errors = On''', '''display_startup_errors = On''' and '''log_errors = On''' are present and uncommented. Check the value of '''error_log''' - this tells you the location of the file errors are logged to. If it is commented out then errors will be sent to the web server error log file. Remember, if you make any changes to this file you will need to restart the web server (or just reboot the server).<br />
<br />
* '''Using ini_set commands''': If you are using Moodle 1.7 or higher, the previous steps are not enough. In those versions error logging parameters are dependant on certain administrative settings that you specify in the debugging section. The problem is that if you can't access the administrative pages, you can't set the debugging options. So the only way to modify them is by adding the following lines to your config.php file, just before the last line (the one containing a single'?>' only):<br />
<br />
ini_set ('display_errors', 'on');<br />
ini_set ('log_errors', 'on');<br />
ini_set ('display_startup_errors', 'on');<br />
ini_set ('error_reporting', E_ALL);<br />
<br />
:This will enable the same settings specified above even if Moodle sets them otherwise. <br />
:'''Important''': Remember to put them just before the last line of config.php.<br />
<br />
==Any text I add with an apostrophe (') or a quote (") causes errors or comes up with a slash added==<br />
<br />
Problems caused by apostrophes are caused by incorrect "magic quotes" settings. Moodle requires the following settings in the php.ini file (which are usually the default):<br />
<br />
magic_quotes_gpc = On<br />
magic_quotes_runtime = Off<br />
<br />
Please see [[Installing Moodle]] for more details.<br />
<br />
If you are using [[Debian_GNU/Linux_installation|Debian]] then the problem might be in the version of PHP that you have installed. Have a look at this [http://tracker.moodle.org/browse/MDL-9691 bug report ] to see if it matches your situation.<br />
<br />
==Email copies are not being sent from my forums==<br />
<br />
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.<br />
<br />
Basically, you need to set up a process to regularly call the script <code><nowiki>http://yoursite/admin/cron.php</nowiki></code>. Please refer to the [[Cron|cron instructions]].<br />
<br />
'''Tip:''' Try the default setting in Moodle variables page. Leave the smtphost blank. This will be acceptable for the majority of users.<br />
<br />
'''Tip:''' Make sure that allowuseremailcharset in Administration > Configuration > Variables > Mail is set to No. Setting this to Yes might cause this problem in some versions of Moodle.<br />
<br />
==Error: database connection failed==<br />
<br />
If you get errors like "database connection failed" or "could not connect to the database you specified", here are some possible reasons and some possible solutions.<br />
<br />
* Your '''database server''' isn't installed or running. To check this for MySQL try typing the following command line<br />
$telnet database_host_name 3306<br />
:You should get a cryptic response which includes the version number of the MySQL server. <br />
* If you are attempting to run '''two instances of Moodle on different ports''', use the ip address of the host (not localhost) in the $CFG->dbhost setting, e.g. $CFG->dbhost = 127.0.0.1:3308.<br />
* You don't have the '''PHP mysql or postgresql extensions''' installed (please refer to FAQ re. whether PHP is installed).<br />
* You haven't created a '''Moodle database and assigned a user''' with the correct privileges to access it. <br />
* The '''Moodle database settings''' are incorrect. The database name, database user or database user password in your Moodle configuration file ''config.php'' are incorrect. Use phpMyAdmin to set up and check your MySQL installation.<br />
* Check that there are '''no apostrophes or non-alphabetic letters''' in your MySQL username or password.<br />
* You are using MySQL version 4.1 or higher but the PHP MySQL extension is pre-4.1 (check in your phpinfo output). In this case the '''default password hashing algorithm''' is incompatible with that available in the PHP mysql extension versions 4.x.x. Use these MySQL commands to change the passwords to the old format:<br />
<br />
mysql>SET PASSWORD FOR 'root'@'localhost' = OLD_PASSWORD('password');<br />
mysql>SET PASSWORD FOR 'moodleuser'@'localhost' = OLD_PASSWORD('password');<br />
<br />
:Also, consider upgrading your PHP MySQL extension. See [http://dev.mysql.com/doc/mysql/en/old-client.html this MySQL document] for further information on how to deal with this problem.<br />
* You are using Fedora core 3 or some other Linux system with '''SELinux installed''' and enabled. See the following URL for information on how to disable SELinux: http://fedora.redhat.com/projects/selinux/ If you don't want to disable SELinux, you have to allow httpd process to create network connections:<br />
<br />
setsebool httpd_can_network_connect true<br />
<br />
* Mac OSX users -- if you are running MySQL on a Mac OSX, try changing '''$CFG->dbhost''' from 'localhost' to '127.0.0.1'<br />
'''See also''': MySQL page on [http://dev.mysql.com/doc/refman/5.0/en/common-errors.html common errors] which lists several possible scenarios for connection failure, with advice on how to fix the problems.<br />
<br />
==I can't log in - I just stay stuck on the login screen==<br />
<br />
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].<br />
<br />
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]].<br />
<br />
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>.<br />
<br />
If you are still having problems, read the [[Can_not_log_in | Cannot log in]] page.<br />
<br />
==I can't log in with message "Please verify that the current setting of session.save_path is correct" ==<br />
<br />
This error occurs when PHP is having problems saving its session files. You may also see these other error messages displayed on the screen or in your log files:<br />
<br />
Warning: Unknown: open(some-path/sessions/sess_acbf942a7399db3489ffa910e35d5242, O_RDWR)<br />
failed: Permission denied (13) in Unknown on line 0<br />
<br />
Warning: Unknown(): open(some-path/sessions/sess_acbf942a7399db3489ffa910e35d5242, O_RDWR) <br />
failed: No space left on device (28) in Unknown on line 0<br />
<br />
Warning: Unknown: Failed to write session data (files). Please verify that the current <br />
setting of session.save_path is correct (some-path/sessions) in Unknown on line 0 <br />
<br />
To temporarily bypass these errors, '''use database sessions''' by editing your [[Configuration_file | moodle configuration file]] and adding this line:<br />
<br />
$CFG->dbsessions = true;<br />
<br />
Database sessions may overload your mysql database and are not ideal in a shared hosting environment, so if this solves the problem, you can start fixing the problem as follows:<br />
* Check '''access rights'''. The session.save_path should be accessible by the apache user. Try this command:<br />
<br />
chown -R apache:apache some-path/sessions<br />
<br />
:This assumes that 'apache' is the name of the user your webserver runs under - it could also be 'nobody'.<br />
* Check the '''permissions''' to the directory that PHP is trying to save to (session.save_path = some-path/sessions). Set the permissions initially to 0777 (everyone read, write, execute) with this command:<br />
<br />
chmod -R 0777 some-path/sessions<br />
<br />
:If this fixes the problem, reduce the permissions (700 is recommended).<br />
<br />
'''See also''': Session problems can be specific to your server environment. As an example, see [http://moodle.org/mod/forum/discuss.php?d=55925#254596 this forum discussion] about session problems with Lycos hosting.<br />
<br />
==I log in but the login link doesn't change. I am logged in and can navigate freely.==<br />
<br />
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.<br />
<br />
==I keep getting this error: A server error that affects your login session was detected.==<br />
<br />
Please refer to the Using Moodle forum discussion [http://moodle.org/mod/forum/discuss.php?d=73716 A server error that affects your login session was detected. Please login again or restart your browser.].<br />
<br />
==I keep getting this error: Failed opening required '/web/moodle/lib/setup.php'==<br />
<br />
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.<br />
<br />
Sometimes people only use the path from their home directory, or relative to the root of the web server directory.<br />
<br />
==My pages show fatal errors such as : Parse error, call to undefined function: get_string()==<br />
<br />
If you see errors like:<br />
<br />
Parse error: parse error, unexpected T_VARIABLE in /path/to/moodle/config.php on line 94 <br />
Fatal error: Call to undefined function: get_string() in /path/to/moodle/mod/resource/lib.php<br />
on line 11<br />
<br />
then you have probably left out a semi-colon or closing quote from a line in ''config.php'' (previous to line 94).<br />
<br />
Another possibility is that you edited ''config.php'' in a program like Word and saved it as a HTML web page, instead of using a plain text editor like Notepad.<br />
<br />
Another thing to check, particularly if you are using 3rd party modules or plugins, is whether any of the php scripts use short open tags (<? ?>) instead of proper ones (<?php ?>). Short tags are bad for various reasons, so first contact the author of that extension to tell them about the problem. Then either replace short tags with conventional ones, or set this line in php.ini:<br />
<br />
short_open_tag = On<br />
<br />
You should never find short tags in core moodle code. If you do, please file a bug in the bug tracker.<br />
<br />
==Serious Error! Could not set up the site!==<br />
<br />
Please refer to the Using Moodle forum discussion [http://moodle.org/mod/forum/discuss.php?d=32071 Serious Error! Could not set up the site!].<br />
<br />
==Uploaded files give "File not found"==<br />
<br />
For example: Not Found: The requested URL /moodle/file.php/2/myfile.jpg was not found on this server.<br />
<br />
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):<br />
<br />
'''AcceptPathInfo''' on<br />
<br />
Note, this will ONLY work for Apache versions 2.x.<br />
<br />
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.<br />
<br />
To use this alternative method, you should change the ''slasharguments'' variable. For moodle versions < 1.6, this is located in the Operating System section of Administration >> Configuration >> [[admin/config|Variables]]. Otherwise, this option is located in Administration >> Server >> HTTP. You should now be able to access your uploaded files.<br />
<br />
==When I go to the admin page, I get told to make dirroot blank!==<br />
<br />
If you see errors like this:<br />
<br />
Please fix your settings in config.php: <br />
You have: $CFG->dirroot = "/home/users/fred/public_html/moodle"; <br />
but it should be: $CFG->dirroot = "";<br />
<br />
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'':<br />
<br />
if ($dirroot != $CFG->dirroot) {<br />
<br />
and change it to this:<br />
<br />
if (!empty($dirroot) and $dirroot != $CFG->dirroot) {<br />
<br />
==When trying to add a resource I receive error messages==<br />
<br />
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]].<br />
<br />
==Why are all my pages blank?==<br />
<br />
Check the dirroot variable in ''config.php''. You must use complete, absolute pathnames e.g.<br />
<br />
$CFG->dirroot = "d:\inetpub\sites\www.yoursite.com\web\moodle";<br />
<br />
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 enable PHP error displays, set these lines in your ''php.ini'' file and reload the web page.<br />
<br />
display_errors = On<br />
display_startup_errors = On<br />
<br />
To determine if MySQL support is your problem, insert this as the second line in your ''config.php'' file<br />
<br />
phpinfo();<br />
<br />
then reload the web page. Examine the output closely to see if MySQL is supported. If not look for a package you are missing.<br />
<br />
== Why is a particular page blank or incomplete? ==<br />
<br />
*'''Check your web server log files!!''' <br />
:If a particular page is blank or incomplete (it doesn't display the footer), before you do anything else [[Installation_FAQ#How_to_enable_and_check_PHP_error_logs | check your error logs]]. Having established that PHP error logging is working, reproduce the error. Immediately check the error log file right at the end. Hopefully you will see a PHP error message at or very near the end of the file. This may solve your problem directly or makes it a lot easier to diagnose the problem in the Moodle forums.<br />
<br />
*If you are '''upgrading to a new version of Moodle''', check that you do not have an old version of a non-standard block or module installed. Remove any such blocks or modules installed remove them using the admin settings page and start the install process again. However, do also make sure that you have included all required optional plugins that were required by your courses. <br />
<br />
*If you '''do not see any blocks listed''', turn editing on and remove any blocks that you have added to that page and try reloading.<br />
<br />
==Installation hangs when setting-up database tables==<br />
*Sometimes the installation will hang when setting up tables. This will be an abrupt hang with half the page displayed in the browser and/or other outputs removed, e.g. the “Scroll to continue” link is displayed but no “Continue” button is there. If this is the case, it is usually a mysql error and not a php error. Check that there is no limit placed on your mysql database, e.g. a "questions" limit.<br />
<br />
*If the install is on a webhost, adding the following line to the .htaccess file in the moodle directory has been known to solve the problem.<br />
AddType x-mapp-php5 .php<br />
<br />
*Try also renaming the .htaccess file so that it is disabled.<br />
<br />
*You may also want to look and see if you've customized any of your code. Look at the last successful table, and then look at the block, mod, or other code that is referenced by that table. For example, if your install hangs and continues to say that the forum tables were successful as the last message, look at /mod/forum/ for any custom code. If you have customized code, backup those files and replace with the correct files. You can then restart the install by renaming config.php or reinstalling your database from the backup. If your install is successful, you can make your code changes back into the stock Moodle code.<br />
<br />
*It may also be that the "memory_limit" in your php.ini is set too low. Please check your php.ini file and allocate the recommended amount (see [https://docs.moodle.org/en/Installing_Moodle#Requirements Moodle requirements]). For Moodle version 1.8 and above at least 40MB is recommended.<br />
<br />
*A work-around to this problem is to setup a working Moodle system on your local PC or server using the [http://download.moodle.org Moodle Packages]. Once you have a running Moodle, [https://docs.moodle.org/en/Upgrading_Moodle#Backup_important_data backup the database] and import to your webhost. Then backup the Moodle code itself (the "moodle" directory on your PC) and copy this to your webhost using (for example) FTP. Finally, edit the moodle/config.php file for the new settings that have to be changed for the webhost.<br />
<br />
*To avoid this problem when upgrading, prefer to upgrade incrementally. For example: upgrade from 1.6.* to 1.7.* and then to 1.8.* rather than straight from 1.6.* to 1.8.*<br />
<br />
'''Note''': When upgrading an existing database, the installation may appear to hang at the roles generation phase. This process can take a very long time - so please be patient.<br />
<br />
==Why can't I upload a new image into my profile?==<br />
<br />
If you don't see anything on your user profile pages to let you upload user images then it's usually because GD is not enabled on your server. GD is a library that allows image processing.<br />
<br />
1. Make sure '''GD has been included in your PHP installation'''. You can check this by going into Administration >> Configuration >> [[Variables]] and looking for the gdversion setting. This setting is chosen automatically every time you visit that page. If it shows GD version 1 or version 2 then everything should be fine. Save that configuration page and go back to your user profile.<br />
<br />
2. If Moodle thinks GD is not installed, then you will need to '''install the GD library'''. <br />
*On Unix you may need to re-compile PHP with arguments something like this:<br />
<br />
./configure --with-apxs=/usr/local/apache/bin/apxs --with-xml --with-gd <br />
--with-jpeg-dir=/usr/local --with-png-dir=/usr --with-ttf --enable-gd-native-ttf <br />
--enable-magic-quotes --with-mysql --enable-sockets --enable-track-vars <br />
--enable-versioning --with-zlib<br />
<br />
* On Windows this is usually a matter of "turning on" the extension in PHP by editing your php.ini file. To do this remove the semicolon for the php_gd2.dll extension - check that this file is actually present in your php extensions folder first (search your php.ini for extension_dir to determine where this points to on your hard disk). You should then have a line that looks like this:<br />
extension=php_gd2.dll<br />
<br />
:Windows users should see the [[Installing AMP|installation instructions]] for further help. <br />
<br />
3. Remember to '''restart your webserver''' (if possible) and re-visit the Moodle configuration page after making any changes to PHP so it can pick up the correct version of GD.<br />
<br />
'''See also''': Using Moodle forum discussion [http://moodle.org/mod/forum/discuss.php?d=44271 Profile pictures] for additional information.<br />
<br />
==Why do I keep getting error messages about "headers already sent"?==<br />
<br />
If you see errors like this:<br />
<br />
Warning: Cannot add header information - headers already sent by <br />
(output started at /webs/moodle/config.php:87) in /webs/moodle/lib/moodlelib.php <br />
on line 1322 <br />
<br />
Warning: Cannot add header information - headers already sent by <br />
(output started at /webs/moodle/config.php:87) in /webs/moodle/lib/moodlelib.php <br />
on line 1323 <br />
<br />
Warning: Cannot add header information - headers already sent by <br />
(output started at /webs/moodle/config.php:87) in /webs/moodle/login/index.php <br />
on line 54<br />
<br />
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.<br />
<br />
== Why doesn't my Moodle site display the time and date correctly? ==<br />
<br />
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.<br />
<br />
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)<br />
<br />
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.<br />
<br />
==I receive this error "500:Internal Server Error"==<br />
You'll get this error message if there is a syntax error in your .htaccess or httpd.conf files. You will also see this error if your server does not support .htaccess files, especially if it is running PHPsuexec. Also, you may have a directive in your .htaccess or httpd.conf files which are not compatible with your web server version.<br />
<br />
==How do I uninstall Moodle?==<br />
'''Moodle package installation''': If you have downloaded a Moodle package, simply uninstall using your system commands. On Windows PCs, you should access the Control Panel -> Add/Remove Programs. Select the package name and click Change or Remove Programs.<br />
<br />
'''Webhost/manual installation''': If you have installed Moodle manually or have installed onto a webhost, follow these steps:<br />
*Delete the moodle database using this mysql command (or delete using your mysql client, e.g. PHPMyAdmin):<br />
<pre>sql>DROP DATABASE moodle;</pre><br />
:In the above example replace 'moodle' with the name of the moodle database you created when installing.<br />
*Delete the moodledata directory. If you, or your users, have uploaded materials into this directory take a copy of these before deleting this directory.<br />
*Delete the moodle directory itself. This will delete all of the moodle PHP script files.<br />
<br />
<br />
==How do I upgrade Moodle? Do I just overwrite the files?==<br />
Do not overwrite files, it may cause strange errors. You should read the [[Upgrade]] documentation before proceeding.<br />
<br />
==Migrating Moodle to a new site or server==<br />
Migrating Moodle means that you have to move the current installation to a new server, and so may have to change IP addresses or DNS entries. To do this you will need to change the $CFG->wwwroot value in the config.php on the new server. You will also have to change any absolute links stored in the database backup file (before restoring the file on the new server) either using the admin/replace.php script, your text editor or another "search and replace" tool, e.g. sed. For more details see the [[Moodle_migration | Moodle Migration]] page.<br />
<br />
==Fatal error allowed memory size exhausted. How do I increase my php memory limit?==<br />
You will sometimes see an error message something like this:<br />
Fatal error: Allowed memory size of 67108864 bytes exhausted <br />
(tried to allocate xx bytes) in /var/www/moodle/yyyy.php<br />
This error means that the php memory_limit value is not enough for the php script. The memory_limit value is the "allowed memory size" - 64M in the example above (67108864 bytes / 1024 = 65536 KB. 65536 KB / 1024 = 64 MB). You will need to increase the php memory_limit value until this message is not shown anymore. There are two methods of doing this.<br />
*On a hosted installation, add the following line to your .htaccess file (or create one in the moodle directory if it does not already exist):<br />
php_value memory_limit <value>M<br />
Example: php_value memory_limit 40M<br />
*If you have your own server with shell access, edit your php.ini file (make sure it's the correct one by checking in your phpinfo output) as follows:<br />
memory_limit <value>M<br />
Example: memory_limit 40M<br />
Remember that you need to restart your web server to make changes to php.ini effective. An alternative is to disable the memory_limit by using the command ''memory_limit 0''.<br />
<br />
----<br />
==Why does my new installation display correctly on the server, but when I view it from a different machine, styles and images are missing?==<br />
In the installation instructions, one of the suggested settings for 'webroot' is 'localhost'. This is fine if all you want to do is some local testing of your new Moodle installation. If, however, you want to view your new installation from another machine on the same local area network, or view your site on the internet, you will have to change this setting:<br />
*For local testing, 'localhost' is fine for the webroot ($CFG->wwwroot in config.php). <br />
*If you want to test your site from other machines on the same local area network (LAN), then you will have to use the private ip address of the serving machine, (e.g. 192.168.1.2/moodle) or the network name of the serving computer (e.g. network_name_of_serving_machine/moodle) as the web root. Depending on your LAN setup, it may be better to use the network name of the computer rather than its (private) ip address, because the ip address can and will change from time to time. If you don't want to use the network name, then you will have to speak to your network administrator and have them assign a permanent ip address to the serving machine.<br />
*Finally, if you want to test your new installation across the internet, you will have to use either a domain name or a permanent (public) ip address/moodle as your web root. To handle both types of access, see [https://docs.moodle.org/en/masquerading masquerading].<br />
<br />
[[Category:FAQ]]<br />
[[Category:Installation]]<br />
<br />
[[es:FAQ Instalación]]<br />
[[fr:FAQ d'installation]]<br />
[[nl:Installatie FAQ]]<br />
[[ja:インストールFAQ]]<br />
[[ru:Установка FAQ]]</div>Kaw