====== Конфигурация PHP для «Докувики» ======= «Докувики» запускается почти при каждой установке PHP, и программа установки проверяет наличие минимальной необходимой функциональности PHP. На этой странице даны советы о том, как настроить параметры [[http://www.php.net/|PHP]] , чтобы повлиять на функциональность, производительность, безопасность и переносимость «ДокуВики». Пожалуйста, обратитесь к онлайн- [[http://www.php.net/manual/en/|PHP manual]] для получения более подробной информации.. ===== php.ini ===== Основным средством настройки PHP является файл конфигурации (''php.ini''). Для версий серверного модуля PHP этот файл загружается только один раз при запуске веб-сервера. Для версии CGI и CLI это происходит при каждом вызове. Этот файл содержит список директив, управляющих работой PHP. Подробную информацию об этих директивах можно найти на странице директив [[phpfn>ini|php.ini directives]] в Интернете. Хотя в большинстве случаев «ДокуВики» будет работать «из коробки» с типичными настройками PHP дистрибутива, ряд параметров конфигурации имеет особое значение для «ДокуВики». С другой стороны, всегда имейте в виду, что то, что может быть хорошим или даже рекомендуемым значением для «ДокуВики», в некоторых случаях может нарушить работу других приложений PHP, которые вы также размещаете. Это особенно верно при включении директив, повышающих безопасность PHP, при наличии других приложений PHP, которые полагаются на небезопасные функции PHP, такие как register_globals и т. д. ==== short_open_tag ==== Разрешить '''' tags are recognized. DokuWiki will run with ''short_open_tag'' set to off. * Suggested: short_open_tag = Off However, note that some [[:templates]] or [[:plugins]] might rely on this feature being set to ''On''. ==== safe_mode ==== [[phpfn>features.safe-mode|Safe Mode]] attempts to solve the shared-server security problem by restricting/disabling certain PHP functions. DokuWiki will run even with ''safe_mode'' set to on. However, depending on your hosters configuration you may need to use the [[:config:safemodehack|safemodehack]] option. If in doubt, or when troubleshooting, start with ''safe_mode = Off''. ==== output_buffering ==== Output buffering allows you to send header lines (including cookies) even after you send body content. DokuWiki will run with either setting. * Suggested: output_buffering = Off ==== output_handler ==== Redirect all the output of all scripts to a function. Setting ''output_handler'' automatically turns on ''output_buffering''. This setting can be used to automatically gzip all content before sending it to the client's browser. This can create problems with images and downloads. Turn on DokuWiki's [[config:gzip_output]] feature instead. * Suggested: output_handler = ==== zlib.output_compression ==== Provides transparent output compression using the zlib library. In general setting ''zlib.output_compression = On'' works quite well with DokuWiki. However, DokuWiki supports output compression via the [[config:gzip_output|gzip_output]] option. * Suggested: zlib.output_compression = Off ==== implicit_flush ==== Tells PHP to tell the output layer to flush itself automatically after every output block. Turning this option on has serious performance implications and is generally recommended for debugging purposes only. DokuWiki takes care of flushing the buffer when needed. * Suggested: implicit_flush = Off ==== allow_call_time_pass_reference ==== Whether to warn when arguments are passed by reference at function call time, as this method is deprecated. Arguments that should be passed by reference should be indicated in the function declaration, not at function call time. * Suggested: allow_call_time_pass_reference = Off ==== max_execution_time ==== Maximum execution time of each script, in seconds. * Suggested: max_execution_time = 30 ==== max_input_time ==== Maximum amount of time each script may spend parsing request data. * Suggested: max_input_time = 60 ==== max_input_vars ==== Under certain conditions (e.g.- working with large tables with the edittable plugin) the default value of 1000 is quickly met. * Suggested: max_input_vars = 10000 ==== memory_limit ==== Maximum amount of memory a script may consume. * Suggested: memory_limit = 32M ==== error_reporting ==== Which errors to report. * Suggested: error_reporting = E_ALL & ~E_NOTICE ==== display_errors ==== Print out errors (as a part of the output). For production web sites, you're strongly encouraged to turn this feature off, and use error logging instead. * Suggested: display_errors = Off ==== display_startup_errors ==== Print out errors that occur during PHP's startup sequence (''display_errors'' has no control over these). It's strongly recommended to keep display_startup_errors off, except for when debugging. * Suggested: display_startup_errors = Off ==== log_errors ==== Log errors into a log file. Also set ''error_log'' accordingly. * Suggested: log_errors = On ==== variables_order ==== The order in which PHP registers GET, POST, Cookie, Environment and Built-in variables (G, P, C, E & S respectively). * Suggested: variables_order = "EGPCS" ==== register_argc_argv ==== Whether to declare the ''argv'' & ''argc'' variables (that would contain the GET information). * Suggested: register_argc_argv = Off ==== Magic Quotes ==== [[http://php.net/manual/en/security.magicquotes.php|Magic Quotes]] is a process that automagically escapes incoming data to the PHP script. It's preferred to code with magic quotes off and to instead escape the data at runtime, as needed. DokuWiki will detect the used settings and will handle the given values as needed. However disabling these options is recommended. === magic_quotes_gpc === Affects HTTP Request data (GET, POST, and Cookie). * Suggested: magic_quotes_gpc = Off === magic_quotes_runtime === If enabled, most functions that return data from an external source, including databases and text files (SQL, from ''exec()'', etc), will have quotes escaped with a backslash. * Suggested: magic_quotes_runtime = Off === magic_quotes_sybase === Use Sybase-style magic quotes (a single-quote is escaped with a single-quote instead of a backslash). * Suggested: magic_quotes_sybase = Off ==== file_uploads ==== Whether to allow HTTP file uploads. * Suggested: file_uploads = On ==== upload_max_filesize ==== Maximum allowed size for uploaded files. It should match what you expect the maximum size of uploaded mediafiles to be. ==== session.use_cookies ==== Whether to use cookies. * Suggested: session.use_cookies = 1 ==== session.cache_limiter ==== Defines which cache control HTTP headers are sent to the client. These headers determine the rules by which the page content may be cached by the client and intermediate proxies. Acceptable values are ''none'', ''nocache'' (the default), ''private'', ''private_no_expire'' or ''public''.Setting the cache limiter to ''nocache'' disallows any client/proxy caching. A value of ''public'' permits caching by proxies and the client, whereas ''private'' disallows caching by proxies and permits the client to cache the contents. In private mode, the Expire header sent to the client may cause confusion for some browsers, including Mozilla. You can avoid this problem by using ''private_no_expire'' mode. The expire header is never sent to the client in this mode. In case of caching problems (i.e. you edit a page but the changes do not appear when viewing that page) you can try setting: session.cache_limiter = nocache ==== extension ==== Dynamic Extensions. === GD === PHP's [[phpfn>ref.image|GD extension]] for use with [[http://www.boutell.com/gd/|libGD 2]] (a graphics library) is recommended but not needed. When available it will be used for resizing [[:images]]. === SSL === SSL must be activated for update and install functionalities. ''[Extensions] \\ extension=php_openssl.dll'' ==== register_globals (PHP <= 5.3.0 - deleted since PHP 5.4.0) ==== Controls if any passed CGI parameters will be registered as global variable automatically instead of being available through $_GET, $_POST or $_REQUEST only. Enabling this often leads to [[http://php.net/manual/en/security.globals.php|security]] problems. DokuWiki will run with ''register_globals'' set to off. * Suggested: register_globals = Off