phpinfo


目录

PHP is the scripting language in which Moodle is developed. It is integrated with your web server. The web server detects php pages (by their extension) and sends them to PHP for execution. PHP must be installed and configured properly for Moodle to work effectively (or at all).

PHP Versions

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. If you change php.ini, don't forget to restart the server.

Finding the correct php.ini

Sometimes it is not obvious where the php.ini file is located or you may even find more than one. To be certain run 'phpinfo' - see below. The path of the php.ini file is a few lines down in the top section.

Note that if you are using command-line (CLI) PHP for running cron (or anything else) it may be configured with a different php.ini file. To check, run the following command:

php -i | grep php.ini

PHP Extensions and libraries

The following PHP extensions are required or recommended (some, e.g. iconv, ctype and tokenizer are now included in PHP by default). Others will need to be installed or selected.

Required extensions

Installing (missing) extensions

This depends on how PHP was installed on your machine and what access you have. Here are some possibilities:

After making any changes or additions, don't forget to re-start your web server.

.htaccess files

If you don't have access to the php.ini file or there are conflicting requirements with other PHP applications on the same server you may be able to change PHP settings in an .htaccess file. This should be placed in the 'root' of your Moodle installation (i.e. the same place as the config.php file).

The file isn't always called .htaccess and may not work at all. Contact your server administrator to be sure

Settings are made by adding lines in one of two formats:

Examples:

PHP info

The phpinfo display contains information about the configuration of your PHP installation. This is useful for checking:

Displaying phpinfo in Moodle

An administrator can find PHP info in Settings > Site administration > Server > PHP info.

Displaying phpinfo outside of Moodle

To view the phpinfo information:

<?php phpinfo(); ?>

See also


Source: docs.moodle.org/503/en/phpinfo — MoodleDocs (GPL) · Imported 2026-11-10.


版本号 #3
由 cocobook-sync 创建于 2026-11-10 17:00:20 UTC
由 cocobook-sync 更新于 2026-11-11 00:43:02 UTC