PHP settings by Moodle version

Jump to: navigation, search

Note: You are currently viewing documentation for Moodle 2.0. Up-to-date documentation for the latest stable version is available here: PHP settings by Moodle version.


This page requires a review. Please do so and remove this template when finished.

PHP Version

Moodle has different PHP requirements for different versions:

  • Moodle 2.0 will require PHP 5.2.8 or later.
  • Moodle 1.6 to 1.9 requires PHP 4.3.0 or later
  • Moodle 1.0 to 1.5 requires PHP 4.1.0 or later

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.

  • register_globals MUST be OFF
  • safe_mode needs to be OFF.
  • 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.
  • session.save_handler needs to be set to FILES.
  • magic_quotes_gpc should be OFF. (It will be an installation pre-requisite for this to be turned off from 2.0 onwards.)
  • magic_quotes_runtime needs to be OFF.
  • file_uploads needs to be ON.
  • session.auto_start needs to be OFF.
  • session.bug_compat_warn needs to be OFF.
  • For file uploads in Moodle 2 on a Windows install, the temp folder must be defined and writeable by your webserver user

PHP Extensions and libraries

  • The mbstring extension is recommended for Moodle 1.6 or later.
  • The iconv extension is recommended for Moodle 1.6 or later.
  • GD library and the FreeType 2 library and extensions are needed to be able to look at the dynamic graphs that the logs pages make. (Freetype support is available as part of the GD extension for the 5.x versions of PHP)
  • The mysql extension (the mysqli extension from 2.0 onwards) is required if you are using the MySQL database. Note that in some Linux distributions (notably Red Hat) this is an optional installation.
  • The pgsql extension is required if you are using the PostgreSQL database.
  • The zlib extension is required for zip/unzip functionality.
  • The pdo and pdo_sqlite extensions are required for the (experimental) SQLite 3 database support.
  • The tokenizer extension is recommended for Moodle 1.8 or later (enabled by default as of PHP 4.3.0).
  • The curl and openssl extensions are required for the Moodle network functionality (Moodle 1.8 or later).
  • The xmlrpc extension is required for the Moodle network functionality (Moodle 1.8 or later).
  • The ctype extension is recommended for Moodle 1.8 or later (enabled by default as of PHP 4.2.0).
  • 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).

Database Support

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, especially if you are planning a large deployment.

  • For Moodle 1.5, MySQL (version 3.23 or later) or PostgreSQL (7.4 or later).
  • For Moodle 1.6, MySQL (version 4.1.12 or later) or PostgreSQL (7.4 or later).
  • For Moodle 1.7, MySQL (version 4.1.12 or later), PostgreSQL (7.4 or later) or Microsoft SQL Server 2005 (version 9 or SQL Server Express 2005)
  • 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 SQL Server Express 2005)
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.
PostgreSQL Notes: PostgreSQL 7.4 is recommended for earlier Moodle versions, since Moodle 1.8 only PostgreSQL 8.0 and above are supported.
  • 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.

See also