Konfigurasi PHP

This page is a translated version of the page PHP configuration and the translation is 33% complete.

PHP is a web template system that accidentally grew up into a fairly general language. PHP's syntax, capabilities, and execution model bear vague similarities to Perl; scripts are loaded by an "interpreter", compiled to bytecode, and then executed. The PHP interpreter can be run from the command line, CGI-style, or more commonly as an in-process Apache module.

Kompatibilitas MediaWiki

For the allowed set of PHP versions you can use with your version of MediaWiki, see Compatibility#PHP.


Silakan lihat https://php.net/install.

Compile-time options


Ekstensi-ekstensi berikut dibutuhkan oleh MediaWiki:

  • iconv character set conversion library
  • mbstring multibyte character string support
  • intl Unicode normalization
  • calendar Support for conversion between different calendars
  • At least one database driver:

MySQL dan PostgreSQL melalui PDO tidak didukung

Perl Compatible Regular Expressions, Session, Standard PHP Library, and JSON are enabled by default; Perl Compatible Regular Expressions and Standard PHP Library cannot be disabled since PHP 5.3.


MediaWiki either needs or wants a number of optional features of PHP that need to be enabled at compile time:


We are successfully working with these compiler options:

'./configure' \
  '--with-mysql' \
  '--with-apxs2=/usr/sbin/apxs2' \
  '--with-zlib' \
  '--with-ldap' \
  '--with-gd' \
  '--with-jpeg-dir' \
  '--with-iconv-dir' \

In detail, these configure options do the following:

Allows PHP to query MySQL. This is an essential feature (I think). You will need to have MySQL installed to enable this option.
this is required if you want to build mod_php. APXS is for configuring compilation of an Apache module. You will need to change (or omit the path) for your specific system.
Allows PHP to read / write zipped files and send compressed data to Apache ... or something like that
Important if you want your wiki users to be verified by LDAP
Use this if you want image processing 'within' PHP, else you can use ImageMagick. Because this option requires that you have various libraries installed... but presumably IM has the same deps... oh well...
Seems nonsensical
Seems nonsensical
Allows multibyte character string support. This is optional, as slower custom code will be used if not available.

Opcode caching

Lihat Manual:Performance tuning

Due to MediaWiki's large codebase, it is highly recommended that a system be used to cache the compiled scripts; there are a number of such plugins for PHP, some free, some proprietary. There is a list of some caches:

Untungnya, semua ini dapat dipasang sebagai colok-masuk Zend, Anda cukup masuk ke perpustakaan dan mengubah php.ini Anda. Tidak perlu melakukan kompilasi ulang yang rumit untuk seluruh PHP!

TBergantung pada cache dan opsi yang Anda gunakan, Anda mungkin harus melakukan operasi khusus setiap kali memperbarui berkas skrip.

MediaWiki can also interact with that caches and use them for object caching, see $wgMainCacheType .

Runtime configuration (php.ini)

Some settings in php.ini affects MediaWiki behavior and some of them are incompatible with MediaWiki.

This options adds quotes to data in $_GET, $_POST and $_COOKIES. MediaWiki can work with this option turned on, but will have to remove these quotes and thus will be slower.
This option corrupts data input unpredictably by adding quotes in e.g. opened files, data received from database etc. MediaWiki will refuse to install if this option is turned on.
same as magic_quotes_runtime
This option causes errors and may corrupt data unpredictably; MediaWiki will refuse to install if this option is turned on.
This option causes horrible bugs; MediaWiki will refuse to install if this option is turned on.
MediaWiki needs sufficiently memory to work. The minimal limit should be something like 20 MB, but if you want MediaWiki to work correctly, consider using at least 50 MB.
To be able to find GNU diff3 and git during installation process this entry must not contain passthru
If you are getting the error "Beberapa bagian dari formulir suntingan tidak berhasil mencapai peladen; periksa ulang apakah suntingan Anda tetap utuh dan coba lagi." then it could be because this is set with a "MB" prefix, instead of just "M" (the former is interpreted at bytes, not megabytes).

Mengubah ukuran gambar

ImageMagick dapat digunakan untuk mengubah ukuran gambar. Jika tidak tersedia, modul GD PHP dapat digunakan bila memungkinkan.

Lihat pula