PHP 설정
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.
미디어위키 호환성
For the allowed set of PHP versions you can use with your version of MediaWiki, see Compatibility#PHP.
설치
https://php.net/install 를 보세요.
컴파일-시간 옵션
필요한것
다음과 같은 추가기능이 필요합니다 :
- iconv character set conversion library
- JSON (alternatively, the pecl-json-c fork)
- mbstring multibyte character string support
- fileinfo MIME type detection
- At least one database driver:
MySQL, PostgreSQL 그리고 PDO 는 지원하지 않습니다
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:
- zlib compression library, optionally to compress the file cache
- exif functions to display EXIF data from uploaded images (
$wgShowEXIF
).
예시
We are successfully working with these compiler options:
'./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'
In detail, these configure options do the following:
- --with-mysqli=mysqlnd
- Include MySQLi (MySQL improved) support. The MySQL native driver will be used when value is
mysqlnd
. - --with-pdo-mysql=mysqlnd
- PDO: MySQL support. The native driver will be used when value is
mysqlnd
. - --with-apxs2=/usr/sbin/apxs2
- 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.
- --with-zlib
- Allows PHP to read / write zipped files and send compressed data to Apache ... or something like that
- --with-ldap
- Important if you want your wiki users to be verified by LDAP
- --with-gd
- 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...
- --with-jpeg-dir
- Seems nonsensical
- --with-iconv-dir
- Seems nonsensical
- --enable-mbstring
- Allows multibyte character string support. This is optional, as slower custom code will be used if not available.
Opcode caching
- See 메뉴얼:성능 향상
Due to MediaWiki's large codebase, it is highly recommended that a system be used to cache the compiled scripts; the opcache PHP extension can be used for this. 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
and$_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 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.
- 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 "편집의 일부 내용이 서버에 전달되지 않았습니다. 편집이 손상되지 않았는지 확인하고 다시 시도해 주십시오." then it could be because this is set with a "MB" prefix, instead of just "M" (the former is interpreted at bytes, not megabytes).
Image Resizing
ImageMagick or the GD PHP module can be used for image thumbnailing. See Manual:Image administration#Image thumbnailing