浏览器中的 localhost/mediawiki-1.30.0/ 在 Firefox 中返回 run(); 并在 Chromium 中返回文件内容

浏览器中的 localhost/mediawiki-1.30.0/ 在 Firefox 中返回 run(); 并在 Chromium 中返回文件内容

从 Ubuntu 17.10 更新到 18.04 后,我的 Wiki 停止工作。

我的系统如下所示:

~$ ls /var/www/html/mediawiki-1.30.0/
api.php                     img_auth.php             phpcs.xml
autoload.php                includes                 profileinfo.php
cache                       index.php                README
CODE_OF_CONDUCT.md          INSTALL                  RELEASE-NOTES-1.30
composer.json               jsduck.json              resources
composer.local.json-sample  languages                serialized
COPYING                     load.php                 skins
CREDITS                     LocalSettings.php        StartProfiler.sample
docs                        LocalSettings.php~       tests
extensions                  maintenance              thumb_handler.php
FAQ                         mediawiki-1.30.0         thumb.php
Gruntfile.js                mediawiki-1.30.0.tar.gz  UPGRADE
HISTORY                     mw-config                vendor
images                      opensearch_desc.php

并指示 Firefoxhttp://localhost/mediawiki-1.30.0/使其显示run();,而 Chromium 显示:

<?php
/**
 * This is the main web entry point for MediaWiki.
 *
 * If you are reading this in your web browser, your server is probably
 * not configured correctly to run PHP applications!
 *
 * See the README, INSTALL, and UPGRADE files for basic setup instructions
 * and pointers to the online documentation.
 *
 * https://www.mediawiki.org/wiki/Special:MyLanguage/MediaWiki
 *
 * ----------
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 * http://www.gnu.org/copyleft/gpl.html
 *
 * @file
 */

// Bail on old versions of PHP, or if composer has not been run yet to install
// dependencies. Using dirname( __FILE__ ) here because __DIR__ is PHP5.3+.
// @codingStandardsIgnoreStart MediaWiki.Usage.DirUsage.FunctionFound
require_once dirname( __FILE__ ) . '/includes/PHPVersionCheck.php';
// @codingStandardsIgnoreEnd
wfEntryPointCheck( 'index.php' );

require __DIR__ . '/includes/WebStart.php';

$mediaWiki = new MediaWiki();
$mediaWiki->run();

我以前也遇到过这种情况,并且得到了一个解决问题的答案。但是,我再也找不到答案了,因此我必须再次提出这个问题。

我认为答案是一个配置项,但是是哪一个呢?apache2、php7.2 还是 mediawiki 的配置?

答案1

为 Apache2 启用 php

sudo a2enmod php

并重新启动 Apache2

systemctl restart apache2

解决了问题。

相关内容