移动媒体wiki目录后500服务器错误

时间:2022-09-25 23:25:12

I had a media wiki installation on the main directory /public_html/ of my domain and had short URLs enabled to http://example.org/wiki/Page_title so I had an .htaccess file with the following rules

我在我的域的主目录/ public_html /上安装了媒体wiki,并且启用了http://example.org/wiki/Page_title的短URL,因此我有一个.htaccess文件,其中包含以下规则

# Enable the rewrite engine
RewriteEngine On

# Short url for wiki pages
RewriteRule ^/?wiki(/.*)?$ %{DOCUMENT_ROOT}/index.php [L]

# Redirect / to Main Page
RewriteRule ^/*$ %{DOCUMENT_ROOT}/index.php [L]

I want to install other applications in the main directory of that domain so I am trying to move this media wiki installation from the root /public_html/ directory to the /public_html/w/ while keeping the same short url format. So all I did was copy the content from the main directory to the /public_html/w/ directory and modify the .htaccess rules to

我想在该域的主目录中安装其他应用程序,所以我试图将此媒体wiki安装从root / public_html /目录移动到/ public_html / w /,同时保持相同的短网址格式。所以我所做的就是将内容从主目录复制到/ public_html / w /目录,并将.htaccess规则修改为

## http://www.mediawiki.org/wiki/Manual:Short_URL/Apache

# Enable the rewrite engine
RewriteEngine On

# Short url for wiki pages
RewriteRule ^/?wiki(/.*)?$ %{DOCUMENT_ROOT}/w/index.php [L]

# Redirect / to Main Page
RewriteRule ^/*$ %{DOCUMENT_ROOT}/w/index.php [L]

And also modify the LocalSettings.php file in the new directory from

并且还修改新目录中的LocalSettings.php文件

$wgScriptPath = "";
$wgScriptExtension = ".php";
$wgArticlePath = "/wiki/$1";
$wgUsePathInfo = true;

to

$wgScriptPath = "/w";
$wgScriptExtension = ".php";
$wgArticlePath = "/wiki/$1";
$wgUsePathInfo = true;

In theory, since it's using the same db and all the same settings all I needed to change was the htaccess and localsettings.php directories and it should work fine but after I tried it I got a 500 server error and the site was not working at all and after I checked apache/php error logs I found a lot of the same stuff

理论上,因为它使用相同的数据库和所有相同的设置所有我需要改变的是htaccess和localsettings.php目录,它应该工作正常但我尝试后,我得到500服务器错误,该网站不工作在所有和我检查apache / php错误日志后,我发现了很多相同的东西

[Sun Feb 28 13:59:14.477785 2016] [:error] [pid 12164] [client SERVER IP] script '/home/admin/web/MY DOMAIN/public_html/index.php' not found or unable to stat
[Sun Feb 28 13:59:21.854117 2016] [:error] [pid 12165] [client SERVER IP] script '/home/admin/web/MY DOMAIN/public_html/index.php' not found or unable to stat
[Sun Feb 28 13:59:32.073190 2016] [:error] [pid 12374] [client SERVER IP] script '/home/admin/web/MY DOMAIN/public_html/index.php' not found or unable to stat
[Sun Feb 28 13:59:33.574025 2016] [:error] [pid 12166] [client SERVER IP] script '/home/admin/web/MY DOMAIN/public_html/index.php' not found or unable to stat
[Sun Feb 28 13:59:35.873162 2016] [:error] [pid 12167] [client SERVER IP] PHP Warning:  require_once(/home/admin/web/MY DOMAIN/public_html/w/extensions/MsUpload/msupload.php): failed to open stream: No such file or directory in /home/admin/web/MY DOMAIN/public_html/w/LocalSettings.php on line 301
[Sun Feb 28 13:59:35.873207 2016] [:error] [pid 12167] [client SERVER IP] PHP Fatal error:  require_once(): Failed opening required '/home/admin/web/MY DOMAIN/public_html/w/extensions/MsUpload/msupload.php' (include_path='.:/usr/share/php:/usr/share/pear') in /home/admin/web/MY DOMAIN/public_html/w/LocalSettings.php on line 301

Notice the first errors are still referring to the previous root /public_html/ directory while the extensions errors are already referring to the /public_html/w/ directory

请注意,第一个错误仍然是指前一个root / public_html /目录,而扩展错误已经引用了/ public_html / w /目录

I have no clue where I went wrong here so I would appreciate some help. So far I had to revert the changes and restore a backup I had for the old directory but I still want to move the wiki directory.

我不知道我在哪里错了所以我会感激一些帮助。到目前为止,我不得不恢复更改并恢复旧目录的备份,但我仍然想移动wiki目录。

3 个解决方案

#1


1  

If you are still keeping /home/admin/web/MY DOMAIN/public_html/ as the root directory (as identified from the webserver) but, moving Mediawiki down a level, you might need to change the following:

如果您仍然将/ home / admin / web / MY DOMAIN / public_html /保留为根目录(从Web服务器中识别),但是,将Mediawiki向下移动一级,则可能需要更改以下内容:

RewriteBase /w/

#2


0  

There is no need to move media wiki from the currently operational location. As you are installing additional applications and media wiki already uses short URL's which makes accessing articles work using the form example.org/wiki/Article_Title what you can do is install the new applications in sub folders right along side the mediawiki installation without any issues at all, as the .htaccess rules will provide exceptions for files and folders which exist on the server.

无需从当前操作位置移动媒体wiki。当你安装其他应用程序和媒体维基已经使用的短网址,这使得使用形式example.org/wiki/Article_Title你可以做的是安装在子文件的新应用程序一起边权MediaWiki的安装没有任何问题访问文章的工作所有,因为.htaccess规则将为服务器上存在的文件和文件夹提供例外。

Example folder structure

示例文件夹结构

public_html /
    app1/
        index.php
        ...
    app2/
        index.php
        ...
    app3/
        index.php
        ...
    ... (all media wiki files and folders)

#3


0  

I'm not familiar with MediaWiki, but given this comment:

我不熟悉MediaWiki,但鉴于此评论:

Notice the first errors are still referring to the previous root /public_html/ directory while the extensions errors are already referring to the /public_html/w/ directory

请注意,第一个错误仍然是指前一个root / public_html /目录,而扩展错误已经引用了/ public_html / w /目录

I found the following comment on mediawiki.org:

我在mediawiki.org上发现了以下评论:

If you redefine this [$wgScriptPath] in your LocalSettings.php then all dependent variables will need redefining too!

如果在LocalSettings.php中重新定义[$ wgScriptPath],则所有因变量也需要重新定义!

I'd investigate what else is set during installation time using this value, as that may be the cause of your issue.

我会调查使用此值在安装时设置的其他内容,因为这可能是导致问题的原因。

#1


1  

If you are still keeping /home/admin/web/MY DOMAIN/public_html/ as the root directory (as identified from the webserver) but, moving Mediawiki down a level, you might need to change the following:

如果您仍然将/ home / admin / web / MY DOMAIN / public_html /保留为根目录(从Web服务器中识别),但是,将Mediawiki向下移动一级,则可能需要更改以下内容:

RewriteBase /w/

#2


0  

There is no need to move media wiki from the currently operational location. As you are installing additional applications and media wiki already uses short URL's which makes accessing articles work using the form example.org/wiki/Article_Title what you can do is install the new applications in sub folders right along side the mediawiki installation without any issues at all, as the .htaccess rules will provide exceptions for files and folders which exist on the server.

无需从当前操作位置移动媒体wiki。当你安装其他应用程序和媒体维基已经使用的短网址,这使得使用形式example.org/wiki/Article_Title你可以做的是安装在子文件的新应用程序一起边权MediaWiki的安装没有任何问题访问文章的工作所有,因为.htaccess规则将为服务器上存在的文件和文件夹提供例外。

Example folder structure

示例文件夹结构

public_html /
    app1/
        index.php
        ...
    app2/
        index.php
        ...
    app3/
        index.php
        ...
    ... (all media wiki files and folders)

#3


0  

I'm not familiar with MediaWiki, but given this comment:

我不熟悉MediaWiki,但鉴于此评论:

Notice the first errors are still referring to the previous root /public_html/ directory while the extensions errors are already referring to the /public_html/w/ directory

请注意,第一个错误仍然是指前一个root / public_html /目录,而扩展错误已经引用了/ public_html / w /目录

I found the following comment on mediawiki.org:

我在mediawiki.org上发现了以下评论:

If you redefine this [$wgScriptPath] in your LocalSettings.php then all dependent variables will need redefining too!

如果在LocalSettings.php中重新定义[$ wgScriptPath],则所有因变量也需要重新定义!

I'd investigate what else is set during installation time using this value, as that may be the cause of your issue.

我会调查使用此值在安装时设置的其他内容,因为这可能是导致问题的原因。