Jump to content

Konfigurasi PHP

From mediawiki.org
This page is a translated version of the page PHP configuration and the translation is 47% complete.
Outdated translations are marked like this.

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.

Pemasangan

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

Compile-time options

Kebutuhan

Ekstensi-ekstensi berikut dibutuhkan oleh MediaWiki:

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.

Opsional

MediaWiki membutuhkan atau menginginkan sejumlah fitur opsional PHP yang perlu diaktifkan pada saat kompilasi:


Contoh

Kami berhasil menggunakan opsi kompiler berikut:

'./configure' \
  '--with-mysqli=mysqlnd' \
  '--with-pdo-mysql=mysqlnd' \
  '--with-apxs2=/usr/sbin/apxs2' \
  '--with-zlib' \
  '--with-ldap' \
  '--with-gd' \
  '--with-jpeg-dir' \
  '--with-iconv-dir' \
  '--enable-mbstring' 

Secara rinci, opsi konfigurasi ini melakukan hal-hal berikut:

--with-mysqli=mysqlnd
Menyertakan dukungan MySQLi (MySQL yang disempurnakan). Driver bawaan MySQL akan digunakan ketika nilainya adalah mysqlnd.
--with-pdo-mysql=mysqlnd
PDO: Dukungan MySQL. Driver bawaan akan digunakan ketika nilainya mysqlnd.
--with-apxs2=/usr/sbin/apxs2
Ini diperlukan jika Anda ingin membangun mod_php. APXS digunakan untuk mengkonfigurasi kompilasi modul Apache. Anda perlu mengubah (atau menghilangkan path) sesuai dengan sistem Anda. APXS is for configuring compilation of an Apache module. You will need to change (or omit the path) for your specific system.
--with-zlib
Memungkinkan PHP untuk membaca/menulis file terkompresi dan mengirim data terkompresi ke Apache... atau semacam itu.
--with-ldap
Penting jika Anda ingin nama pengguna wiki Anda diverifikasi oleh LDAP.
--with-gd
Gunakan ini jika Anda ingin memproses gambar 'di dalam' PHP, jika tidak, Anda dapat menggunakan ImageMagick. Karena opsi ini membutuhkan berbagai pustaka yang terpasang... tetapi mungkin IM memiliki dependensi yang sama... yah sudahlah...
--with-jpeg-dir
Terlihat tidak masuk akal
--with-iconv-dir
Terlihat tidak masuk akal
--enable-mbstring
Menyediakan dukungan string karakter multibyte. Ini bersifat opsional, karena jika tidak tersedia akan digunakan kode kustom yang lebih lambat.

Opcode caching

Karena basis kode MediaWiki yang besar, sangat direkomenadasikan menggunakan sistem untuk menyimpan skrip yang telah dikompilasi dalam cache; ekstensi PHP opcache dapat digunakan untuk tujuan ini. PHP usually comes with this extension pre-installed and enabled.


Runtime configuration (php.ini)

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

magic_quotes_gpc
This options adds quotes to data in $_GET, $_POST dan $_COOKIES. MediaWiki can work with this option turned on, but will have to remove these quotes and thus will be slower.
magic_quotes_runtime
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.
magic_quotes_sybase
same as magic_quotes_runtime
mbstring.func_overload
This option causes errors and may corrupt data unpredictably; MediaWiki will refuse to install if this option is turned on.
zend.ze1_compatibility_mode
This option causes horrible bugs; MediaWiki will refuse to install if this option is turned on.
memory_limit
MediaWiki needs sufficient 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.
disable_functions
To be able to find GNU diff3 and git during installation process this entry must not contain passthru
post_max_size
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. See Manual:Image administration#Image thumbnailing

Lihat pula