Difference between revisions of "Reference:Scribunto"
Extension: Scribunto
Overview | |||
---|---|---|---|
Description: | Supports Lua as script language for templates | ||
State: | stable | Dependency: | MediaWiki |
Developer: | Victor and Tim | License: | - |
Type: | MediaWiki | Category: | Infrastructure |
Edition: | BlueSpice pro | ||
For more info, visit Mediawiki.
|
Features[edit source]
The Scribunto (Latin: "they shall write/let them write (in the future)") extension allows for embedding scripting languages in MediaWiki. Currently the only supported scripting language is Lua.
License
This extension contains code licensed GNU General Public License v2.0 or later (GPL-2.0+) as well as code licensed MIT License (MIT).
Requirements[edit | edit source]
PCRE version compatibility[edit | edit source]
PCRE 8.33 or later is recommended. You can see the version of PCRE used by PHP by viewing a phpinfo() web page, or from the command line with the command php -i | grep 'PCRE'
.
- Scribunto will not work with versions of PCRE lower than 8.10.
- PCRE 8.31 has bugs with JIT pattern studying that breaks various patterns when used with HHVM.
- PCRE 8.32 has a bug that will cause it to reject certain non-character codepoints, which will cause errors in the mw.html module.
CentOS 6 and RHEL 6 are stuck on PCRE 7 and need to be upgraded.
Updating to 8.33 on a server with an older version may be relatively complicated. See Updating to PCRE 8.33 or Higher for details.
PHP pcntl[edit | edit source]
Since Scribunto for MediaWiki 1.25, your PHP server also needs to have pcntl enabled (only works with Unix/Linux platforms) if you want to use "LuaStandAlone" (i.e. running in a separate child process). Under Windows, Scribunto will run Lua only as "LuaSandbox" (within the same PHP thread as the thread used by MediaWiki to run this Scribunto extension, but within the sandboxing PHP environment configured by Scribunto).
PHP mbstring extension[edit | edit source]
PHP needs to have the mbstring extension enabled.
To see if it installed on your server, you can check if it is enabled by running the command php -m
on the server. If the string mbstring is present in the output, the extension is enabled.
Lua binary[edit | edit source]
Bundled binaries[edit | edit source]
Scribunto comes bundled with Lua binary distributions for Linux (x86 and x86-64), Mac OS X Lion, and Windows (32- and 64-bit).
Scribunto should work for you out of the box if:
- Your web server is run on one of the above platforms.
-
PHP's
proc_open
function is not restricted[1] - Your web server is configured to allow the execution of binary files in the MediaWiki tree.
-
Template:Note Execute permissions may need to be set; for example, in Linux use
-
chmod a+x /path/to/extensions/Scribunto/engines/LuaStandalone/binaries/lua5_1_5_linux_64_generic/lua
chcon -t httpd_sys_script_exec_t /path/to/extensions/Scribunto/engines/LuaStandalone/binaries/lua5_1_5_linux_64_generic/lua
-
Additional binaries[edit | edit source]
Additional Lua binary distributions, which may be needed for your web server if its operating system is not in the list above, can be obtained from http://luabinaries.sourceforge.net/ or from your Linux distribution. Only binary files for Lua 5.1.x are supported. Once you've installed the appropriate binary file on your web server, configure the location of the file with:
# where lua is the name of the binary file
# e.g. sourceforge LuaBinaries 5.1.5 - Release 2 name the binary file lua5.1
$wgScribuntoEngineConf['luastandalone']['luaPath'] = '/path/to/binaries/lua5.1';
Note that you should not add the above line unless you've confirmed that Scribunto's built-in binaries don't work for you.
Source: mediawiki-
↑ i.e.
proc_open
is not within the array ofdisable_functions
in your server's "php.ini" file.
{{BSExtensionInfobox |desc=Supports Lua as script language for templates |status=stable |developer=Victor and Tim |type=MediaWiki |edition=BlueSpice pro |active=Yes |compatible=MediaWiki |category=Infrastructure |docu=https://www.mediawiki.org/wiki/Extension:Scribunto }} The '''Scribunto''' ([https://en.wikipedia.org/wiki/Latin Latin]: "''[https://en.wiktionary.org/wiki/scribunto they shall write/let them write (in the future)]''") extension allows for embedding scripting languages in MediaWiki. Currently the only supported scripting language is [http://www.lua.org/ Lua]. '''License''' This extension contains code licensed GNU General Public License v2.0 or later (GPL-2.0+) as well as code licensed MIT License (MIT). '''== Requirements == === PCRE version compatibility === PCRE 8.33 or later is recommended. You can see the version of [[w:PCRE|PCRE]] used by PHP by viewing a phpinfo() web page, or from the command line with the command <code>php -i | grep 'PCRE'</code>. * Scribunto will not work with versions of PCRE lower than 8.10. * PCRE 8.31 has bugs with JIT pattern studying that [[phab:T73922|breaks various patterns when used with HHVM]]. * PCRE 8.32 has [http://bugs.exim.org/show_bug.cgi?id=1340 a bug] that will cause it to reject certain [[w:en:Mapping of Unicode characters#Non-characters|non-character codepoints]], which will cause errors in the mw.html module. CentOS 6 and RHEL 6 are stuck on PCRE 7 and need to be upgraded. Updating to 8.33 on a server with an older version may be relatively complicated. See [[Updating to PCRE 8.33 or Higher]] for details. === PHP pcntl === Since Scribunto for MediaWiki 1.25, your PHP server also needs to have [http://php.net/manual/en/pcntl.installation.php pcntl enabled] (only works with Unix/Linux platforms) if you want to use "LuaStandAlone" (i.e. running in a separate child process). Under Windows, Scribunto will run Lua only as "LuaSandbox" (within the same PHP thread as the thread used by MediaWiki to run this Scribunto extension, but within the sandboxing PHP environment configured by Scribunto). === PHP mbstring extension === PHP needs to have the [http://php.net/mbstring mbstring] extension enabled. To see if it installed on your server, you can check if it is enabled by running the command <code>php -m</code> on the server. If the string <tt>mbstring</tt> is present in the output, the extension is enabled. === Lua binary === ==== Bundled binaries ==== Scribunto comes bundled with Lua binary distributions for Linux (x86 and x86-64), Mac OS X Lion, and Windows (32- and 64-bit). Scribunto should work for you out of the box if: # Your web server is run on one of the above platforms. # PHP's <code>proc_open</code> function is not restricted<ref>i.e. <code>proc_open</code> is not within the array of <code>disable_functions</code> in your server's "php.ini" file.</ref> # Your web server is configured to allow the execution of binary files in the MediaWiki tree. : {{Note}} Execute permissions may need to be set; for example, in Linux use :: <syntaxhighlight lang="bash">chmod a+x /path/to/extensions/Scribunto/engines/LuaStandalone/binaries/lua5_1_5_linux_64_generic/lua</syntaxhighlight>If you are using SELinux in "Enforcing" mode on your server, you might need to set a proper context for the binaries. Example for RHEL/CentOS 7:<syntaxhighlight lang="bash"> chcon -t httpd_sys_script_exec_t /path/to/extensions/Scribunto/engines/LuaStandalone/binaries/lua5_1_5_linux_64_generic/lua </syntaxhighlight> ==== Additional binaries ==== Additional Lua binary distributions, which may be needed for your web server if its operating system is not in the list above, can be obtained from http://luabinaries.sourceforge.net/ or from your Linux distribution. Only binary files for Lua 5.1.x are supported. Once you've installed the appropriate binary file on your web server, configure the location of the file with: <source lang="php"> # where lua is the name of the binary file # e.g. sourceforge LuaBinaries 5.1.5 - Release 2 name the binary file lua5.1 $wgScribuntoEngineConf['luastandalone']['luaPath'] = '/path/to/binaries/lua5.1'; </source> Note that you should not add the above line unless you've confirmed that Scribunto's built-in binaries don't work for you. '''Source: '''[https://www.mediawiki.org/wiki/Extension:Scribunto mediawiki] [[Category:Extension]]
Line 16: | Line 16: | ||
This extension contains code licensed GNU General Public License v2.0 or later (GPL-2.0+) as well as code licensed MIT License (MIT). | This extension contains code licensed GNU General Public License v2.0 or later (GPL-2.0+) as well as code licensed MIT License (MIT). | ||
+ | == Requirements == | ||
+ | === PCRE version compatibility === | ||
+ | PCRE 8.33 or later is recommended. You can see the version of [[w:PCRE|PCRE]] used by PHP by viewing a phpinfo() web page, or from the command line with the command <code>php -i | grep 'PCRE'</code>. | ||
+ | |||
+ | * Scribunto will not work with versions of PCRE lower than 8.10. | ||
+ | * PCRE 8.31 has bugs with JIT pattern studying that [[phab:T73922|breaks various patterns when used with HHVM]]. | ||
+ | * PCRE 8.32 has [http://bugs.exim.org/show_bug.cgi?id=1340 a bug] that will cause it to reject certain [[w:en:Mapping of Unicode characters#Non-characters|non-character codepoints]], which will cause errors in the mw.html module. | ||
+ | |||
+ | CentOS 6 and RHEL 6 are stuck on PCRE 7 and need to be upgraded. | ||
+ | |||
+ | Updating to 8.33 on a server with an older version may be relatively complicated. See [[Updating to PCRE 8.33 or Higher]] for details. | ||
+ | |||
+ | === PHP pcntl === | ||
+ | Since Scribunto for MediaWiki 1.25, your PHP server also needs to have [http://php.net/manual/en/pcntl.installation.php pcntl enabled] (only works with Unix/Linux platforms) if you want to use "LuaStandAlone" (i.e. running in a separate child process). Under Windows, Scribunto will run Lua only as "LuaSandbox" (within the same PHP thread as the thread used by MediaWiki to run this Scribunto extension, but within the sandboxing PHP environment configured by Scribunto). | ||
+ | |||
+ | === PHP mbstring extension === | ||
+ | |||
+ | PHP needs to have the [http://php.net/mbstring mbstring] extension enabled. | ||
+ | |||
+ | To see if it installed on your server, you can check if it is enabled by running the command <code>php -m</code> on the server. If the string <tt>mbstring</tt> is present in the output, the extension is enabled. | ||
+ | |||
+ | === Lua binary === | ||
+ | ==== Bundled binaries ==== | ||
+ | Scribunto comes bundled with Lua binary distributions for Linux (x86 and x86-64), Mac OS X Lion, and Windows (32- and 64-bit). | ||
+ | |||
+ | Scribunto should work for you out of the box if: | ||
+ | # Your web server is run on one of the above platforms. | ||
+ | # PHP's <code>proc_open</code> function is not restricted<ref>i.e. <code>proc_open</code> is not within the array of <code>disable_functions</code> in your server's "php.ini" file.</ref> | ||
+ | # Your web server is configured to allow the execution of binary files in the MediaWiki tree. | ||
+ | : {{Note}} Execute permissions may need to be set; for example, in Linux use | ||
+ | :: <syntaxhighlight lang="bash">chmod a+x /path/to/extensions/Scribunto/engines/LuaStandalone/binaries/lua5_1_5_linux_64_generic/lua</syntaxhighlight>If you are using SELinux in "Enforcing" mode on your server, you might need to set a proper context for the binaries. Example for RHEL/CentOS 7:<syntaxhighlight lang="bash"> | ||
+ | chcon -t httpd_sys_script_exec_t /path/to/extensions/Scribunto/engines/LuaStandalone/binaries/lua5_1_5_linux_64_generic/lua | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | ==== Additional binaries ==== | ||
+ | Additional Lua binary distributions, which may be needed for your web server if its operating system is not in the list above, can be obtained from http://luabinaries.sourceforge.net/ or from your Linux distribution. Only binary files for Lua 5.1.x are supported. Once you've installed the appropriate binary file on your web server, configure the location of the file with: | ||
+ | |||
+ | <source lang="php"> | ||
+ | # where lua is the name of the binary file | ||
+ | # e.g. sourceforge LuaBinaries 5.1.5 - Release 2 name the binary file lua5.1 | ||
+ | $wgScribuntoEngineConf['luastandalone']['luaPath'] = '/path/to/binaries/lua5.1'; | ||
+ | </source> | ||
+ | Note that you should not add the above line unless you've confirmed that Scribunto's built-in binaries don't work for you. | ||
'''Source: '''[https://www.mediawiki.org/wiki/Extension:Scribunto mediawiki] | '''Source: '''[https://www.mediawiki.org/wiki/Extension:Scribunto mediawiki] | ||
[[Category:Extension]] | [[Category:Extension]] |