Configuração do PHP

From mediawiki.org
This page is a translated version of the page PHP configuration and the translation is 54% 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.

Compatibilidade do MediaWiki

Para o conjunto permitido das versões do PHP que pode utilizar com a sua versão do MediaWiki, consulte Compatibilidade#PHP.

Instalação

Por favor, consulte https://php.net/install.

Opções de tempo de compilação

Requerido

As seguintes extensões são requeridas pelo MediaWiki:

  • mbstring multibyte character string support

Não é suportado MySQL e PostgreSQL através de 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.

Opcional

O MediaWiki precisa ou quer um número de recursos opcionais do PHP que precisam ser habilitados no tempo de compilação:

Exemplo

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.

Armazenamento em cache do opcode

Veja: Manual:Performance tuning

Devido à grande base de código do MediaWiki, é altamente recomendado que um sistema seja usado para armazenar em cache os scripts compilados; Existem vários desses plugins para PHP, alguns gratuitos, alguns proprietários. Existe uma lista de alguns caches: PHP usually comes with this extension pre-installed and enabled.

Configurações em tempo de execução (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
Esta opção corrompe a entrada de dados imprevisivelmente, adicionando citações em, e. arquivos abertos, dados recebidos do banco de dados etc. O MediaWiki se recusará a instalar se esta opção estiver ativada.
magic_quotes_sybase
igual a magic_quotes_runtime
mbstring.func_overload
Esta opção causa erros e pode corromper dados imprevisíveis; O MediaWiki se recusará a instalar se esta opção estiver ativada.
zend.ze1_compatibility_mode
Esta opção causa erros horríveis; O MediaWiki se recusará a instalar se esta opção estiver ativada.
memory_limit
O MediaWiki precisa de memória suficiente para funcionar. O limite mínimo deve ser algo como 20 MB, mas se você quiser que o MediaWiki funcione corretamente, considere usar pelo menos 50 MB.
disable_functions
Para poder encontrar o GNU diff3 e git durante o processo de instalação, esta entrada não deve conter passthru
post_max_size
If you are getting the error "Algumas partes do formulário de edição não chegaram ao servidor; verifique que a sua edição continua intacta e tente novamente, por favor." then it could be because this is set with a "MB" prefix, instead of just "M" (the former is interpreted at bytes, not megabytes).

Redimensionamento de imagens

ImageMagick or the GD PHP module can be used for image thumbnailing. See Manual:Image administration#Image thumbnailing

Ver também