Math safe mode

De WikiLICC
Revisão de 14h34min de 22 de abril de 2009 por Dago (Discussão | contribs) (Mediawiki <nowiki><math></nowiki> support with PHP safe_mode)
Ir para: navegação, pesquisa

Usando <math> no MediaWiki com PHP safe_mode

Autor: Mattias Guns http://xylofaan.ulyssis.org/patch/mediawiki/math_safe_mode/

Estes foram os passos tomados para funcionar <math> numa máquina usando PHP com safe_mode=on.

1) safe_mode_exec_dir

Primeiro, cheque qual é o valor do setting `safe_mode_exec_dir` do PHP.

  • Sem safe_mode_exec_dir : Edite a configuração apache de seu host e aponte ele para o diretório math da sua instalação wiki:
 php_admin_value safe_mode_exec_dir /srv/www/wiki/math/
  • safe_mode_exec_dir aponta para algum diretório : Tenha certeza que você pode adicionar algo nele.

2) patch includes/Math.php

It uses backticks ` ` to execute the command, this doesn't work in safe mode, apply the patch named:

includes_Math.php_safemode.patch

It uses exec() but also drops the escaping which, for some reason, is necessary. It also ignores checking if the created file exists, which is necessary if you don't want (or can't) add that directory to `safe_mode_include_dir`.

3) copy the texvc-wrapper script

Because the data is not escaped, spaces in the latex code confuse texvc. I have written a wrapper that fixes this by grouping the arguments the right way, copy this wrapper script `texvc-wrapper` to the directory set in the PHP value `safe_mode_exec_dir`. Next, edit the wrapper script so that the `TEXVC` points to the texfc executable of your installation. Don't forget to make the wrapper executable ; )

4) edit your LocalSettings.php

Lastly, edit your LocalSettings.php:

  • Of course, enable <math> support
$wgUseTeX  = true;
  • enable the features provided by the patch
define('FIX_TEX_SAFE_MODE', 1);
  • point the Texvc var to the wrapper script
$wgTexvc   = "{$IP}/math/texvc-wrapper";