FAQ:MediaWiki

来自Wikioe
Eijux讨论 | 贡献2020年9月7日 (一) 01:51的版本 (建立内容为“category:MediaWiki <span style="font-weight:bold; font-size:150%;"> [https://www.mediawiki.org/wiki/Manual:FAQ/zh 官网FAQ] </span> == 无法生成avg缩…”的新页面)
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)
跳到导航 跳到搜索


官网FAQ

无法生成avg缩略图

  • 描述:

上传.svg文件过后,页面中提示“生成缩略图出错:无法创建临时缩略图文件”,在“特殊页面:文件列表”中查看文件时: Warning: symlink() has been disabled for security reasons in /www/wwwroot/wiki.eijux.com/includes/media/SvgHandler.php on line 280

  • 处理:

默认安装的PHP一些函数是没有默认开启的。 我们需要的函数是symlink(),则用在PHP的禁用函数中删除该函数即可。


  • 描述:

生成缩略图处提示:sh: convert: command not found,PHP错误信息为Warning: is_executable(): open_basedir restriction in effect. File(/bin/bash) is not within the allowed path(s): (/www/wwwroot/wiki.eijux.com/:/tmp/) in /www/wwwroot/wiki.eijux.com/includes/shell/Command.php on line 311

  • 处理:

先考虑是PHP配置的问题,

PHP错误'''require(): open_basedir restriction in effect”''',即访问脚本不在'''<code>open_basedir</code>'''的限定目录里面,'''<code>open_basedir</code>'''的作用是将php所能打开的文件限制在指定的目录或文件。<br/>

修改PHP配置文件PHP.iniopen_basedir之后错误依旧,而后一直都盯着open_basedir打转。兜兜转转许久才注意到sh: convert: command not found的提示,想到可能没有配置Svg Converter,从而进一步发现MediaWiki没有默认安装Converter。最后在| 官网手册SVG节了解到支持信息,相关的Converter("ImageMagick", "ImagickExt", "sodipodi", "inkscape", "batik", "rsvg", and "imgserv")均需单独安装。相较之下,选用了| NativeSvgHandler扩展(将SVG文件直接发送至客户端以进行客户端渲染)。步骤如下:

  1. 下载文件,并将其放置在extensions/文件夹中的NativeSvgHandler目录内。(注意修改所有者及读写权限)
  2. 将下列代码放置在您的LocalSettings.php的底部:'wfLoadExtension( 'NativeSvgHandler' );'
  3. 导航至Special:Version,以验证扩展已成功安装。

再于网页刷新,svg缩略图显示正常。


open_basedir restriction in effect

  • 描述:

错误信息为Warning: is_executable(): open_basedir restriction in effect. File(/bin/bash) is not within the allowed path(s): (/www/wwwroot/wiki.eijux.com/:/tmp/) in /www/wwwroot/wiki.eijux.com/includes/shell/Command.php on line 311

  • 处理:

PHP错误require(): open_basedir restriction in effect”,即访问脚本不在open_basedir的限定目录里面,open_basedir的作用是将php所能打开的文件限制在指定的目录或文件。
查阅PHP配置文件php.ini搜索open_basedir如下:

; open_basedir, if set, limits all file operations to the defined directory
; and below.  This directive makes most sense if used in a per-directory
; or per-virtualhost web server configuration file.
; Note: disables the realpath cache
; http://php.net/open-basedir
;open_basedir =

可知,当前未配置open_basedir ,添加配置如下:

open_basedir = /www/wwwroot/wiki.eijux.com/:/tmp/
  • 注意

注意用open_basedir 指定的限制是路径前缀,而非目录名。所以如果要将访问限制在仅为指定的目录,应用斜线结束路径名。
如:若"open_basedir = /dir/user", 那么目录 "/dir/user""/dir/user1"都是可以访问的。

结果还是不好使
因为没有安装任何的svg渲染相关的扩展("ImageMagick", "ImagickExt", "sodipodi", "inkscape", "batik", "rsvg", and "imgserv".)