带有 docker 的 Mediawiki找不到LocalSettings.php,无法访问数据库

问题描述

我已经在我的 RaspBerry Pi3 上使用 docker 设置了一个带有 mariadb 的 mediawiki(版本 1.35.1)。 当我第一次运行 docker-compose 文件时一切正常,我可以创建 LocalSettings.PHP

问题 1:
我将 LocalSettings.PHP 复制到路径 /data/conf/LocalSettings.PHP,取消注释 docker-compose.yml 文件中的行并使用 docker-compose restart 重新启动。但我总是回到“请完成安装”页面。当我将文件复制到路径 /var/www/html
上的 mediawiki 容器时,它才起作用 为什么mediawiki 找不到LocalSettings.PHP?还是我理解错了?

这是我的 docker-compose.yml 文件

version: '3.3'
services:
  mediawiki:
    image: mediawiki
    restart: always
    ports:
      - ${BIND_TO}:${INT_PORT}
    links:
      - database
    volumes:
      - data_mw_images:/var/www/html/images
      - ./data/sitemap:/var/www/html/sitemap
      # After initial setup,download LocalSettings.PHP to data/conf directory
      # and uncomment the following line and use compose to restart
      # the mediawiki service
      #- ./data/conf/LocalSettings.PHP:/var/www/html/LocalSettings.PHP:ro
      # - ./data/conf/.htaccess:/var/www/html/.htaccess:ro
      # Spezial Stuff (Google AdSense & Search Console)
      #- ./data/conf/robots.txt:/var/www/html/robots.txt:ro
      #- ./data/conf/ads.txt:/var/www/html/ads.txt:ro
      # Mediwaiki Extensions
      #- ./data/extensions/WikiCategoryTagCloud:/var/www/html/extensions/WikiCategoryTagCloud:ro
      #- ./data/extensions/CategoryTagCloud:/var/www/html/extensions/CategoryTagCloud:ro
      #- ./data/extensions/SelectCategory:/var/www/html/extensions/SelectCategory:ro
      #- ./data/extensions/googleAnalytics:/var/www/html/extensions/googleAnalytics:ro
      #- ./data/extensions/GoogleAdSense:/var/www/html/extensions/GoogleAdSense:ro
      #- ./data/extensions/Lockdown:/var/www/html/extensions/Lockdown:ro
      #- ./data/extensions/MobileFrontend:/var/www/html/extensions/MobileFrontend:ro
      #- ./data/extensions/CookieWarning:/var/www/html/extensions/CookieWarning:ro
      #- ./data/extensions/RelatedArticles:/var/www/html/extensions/RelatedArticles:ro
      #- ./data/extensions/Description2:/var/www/html/extensions/Description2:ro
      # Mediawiki Skins
      #- ./data/skins/minervaNeue:/var/www/html/skins/minervaNeue:ro

  database:
    image: linuxserver/mariadb:arm32v6-latest
    volumes:
      - data_mw_db:/var/lib/MysqL
    restart: always
    environment:
      # @see https://phabricator.wikimedia.org/source/mediawiki/browse/master/includes/DefaultSettings.PHP
      MysqL_DATABASE: ${MysqL_DATABASE}
      MysqL_USER: ${MysqL_USER}
      MysqL_PASSWORD: ${MysqL_PASSWORD}
      MysqL_RANDOM_ROOT_PASSWORD: ${MysqL_RANDOM_ROOT_PASSWORD}
      TZ: ${TZ}
volumes:
  data_mw_db:
  data_mw_images:

问题 2:
当我将 LocalSettings.PHP 复制到容器中时,它工作正常。 但是当我重新启动我的 Pi 并尝试访问 Mediawiki 页面时,我又收到了另一个错误(但错误不是每次我重新启动时都会出现。有时它会起作用......?‍♂️)

Sorry! This site is experiencing technical difficulties.

Try waiting a few minutes and reloading.

(Cannot access the database)

Backtrace:

#0 /var/www/html/includes/libs/rdbms/loadbalancer/LoadBalancer.PHP(934): Wikimedia\Rdbms\LoadBalancer->reportConnectionError()
#1 /var/www/html/includes/libs/rdbms/loadbalancer/LoadBalancer.PHP(901): Wikimedia\Rdbms\LoadBalancer->getServerConnection(0,'mywikidb',0)
#2 /var/www/html/includes/libs/rdbms/loadbalancer/LoadBalancer.PHP(1046): Wikimedia\Rdbms\LoadBalancer->getConnection(-1,Array,0)
#3 /var/www/html/includes/GlobalFunctions.PHP(2469): Wikimedia\Rdbms\LoadBalancer->getMaintenanceConnectionRef(-1,'mywikidb')
#4 /var/www/html/includes/cache/localisation/LCStoreDB.PHP(56): wfgetDB(-1)
#5 /var/www/html/includes/cache/localisation/LocalisationCache.PHP(449): LCStoreDB->get('en','deps')
#6 /var/www/html/includes/cache/localisation/LocalisationCache.PHP(495): LocalisationCache->isExpired('en')
#7 /var/www/html/includes/cache/localisation/LocalisationCache.PHP(414): LocalisationCache->initLanguage('en')
#8 /var/www/html/includes/cache/localisation/LocalisationCache.PHP(333): LocalisationCache->loadSubitem('en','messages','title-invalid-e...')
#9 /var/www/html/languages/Language.PHP(2645): LocalisationCache->getSubitem('en','title-invalid-e...')
#10 /var/www/html/includes/cache/MessageCache.PHP(1030): Language->getMessage('title-invalid-e...')
#11 /var/www/html/includes/cache/MessageCache.PHP(988): MessageCache->getMessageForLang(Object(LanguageEn),'title-invalid-e...',false,Array)
#12 /var/www/html/includes/cache/MessageCache.PHP(930): MessageCache->getMessageFromFallbackChain(Object(LanguageEn),false)
#13 /var/www/html/includes/language/Message.PHP(1304): MessageCache->get('title-invalid-e...',Object(LanguageEn))
#14 /var/www/html/includes/language/Message.PHP(862): Message->fetchMessage()
#15 /var/www/html/includes/language/Message.PHP(954): Message->toString('text')
#16 /var/www/html/includes/title/MalformedTitleException.PHP(51): Message->text()
#17 /var/www/html/includes/title/MediawikiTitleCodec.PHP(346): MalformedTitleException->__construct('title-invalid-e...','')
#18 /var/www/html/includes/Title.PHP(3413): MediawikiTitleCodec->splitTitleString('',0)
#19 /var/www/html/includes/Title.PHP(427): Title->secureAndSplit('')
#20 /var/www/html/includes/Mediawiki.PHP(88): Title::newFromURL(NULL)
#21 /var/www/html/includes/Mediawiki.PHP(151): Mediawiki->parseTitle()
#22 /var/www/html/includes/Mediawiki.PHP(902): Mediawiki->getTitle()
#23 /var/www/html/includes/Mediawiki.PHP(543): Mediawiki->main()
#24 /var/www/html/index.PHP(53): Mediawiki->run()
#25 /var/www/html/index.PHP(46): wfIndexMain()
#26 {main}

有人知道怎么解决吗?

这是 LocalSettings.PHP

<?PHP
# This file was automatically generated by the Mediawiki 1.35.1
# installer. If you make manual changes,please keep track in case you
# need to recreate them later.
#
# See includes/DefaultSettings.PHP for all configurable settings
# and their default values,but don't forget to make changes in _this_
# file,not there.
#
# Further documentation for configuration settings may be found at:
# https://www.mediawiki.org/wiki/Manual:Configuration_settings

# Protect against web entry
if ( !defined( 'MEdiawiKI' ) ) {
        exit;
}


## Uncomment this to disable output compression
# $wgdisableOutputCompression = true;

$wgSitename = "Wiki Home";
$wgMetaNamespace = "Wiki_Home";

## The URL base path to the directory containing the wiki;
## defaults for all runtime URL paths are based off of this.
## For more information on customizing the URLs
## (like /w/index.PHP/Page_title to /wiki/Page_title) please see:
## https://www.mediawiki.org/wiki/Manual:Short_URL
$wgScriptPath = "";

## The protocol and server name to use in fully-qualified URLs
$wgServer = "http://192.168.178.22:9002";

## The URL path to static resources (images,scripts,etc.)
$wgResourceBasePath = $wgScriptPath;

## The URL paths to the logo.  Make sure you change this from the default,## or else you'll overwrite your logo when you upgrade!
$wglogos = [ '1x' => "$wgResourceBasePath/resources/assets/wiki.png" ];

## UPO means: this is also a user preference option

$wgEnableEmail = true;
$wgEnableuserEmail = true; # UPO

$wgEmergencyContact = "apache@?.invalid";
$wgPasswordSender = "apache@?.invalid";

$wgEnotifUserTalk = false; # UPO
$wgEnotifWatchlist = false; # UPO
$wgEmailAuthentication = true;

## Database settings
$wgDBtype = "MysqL";
$wgDBserver = "database";
$wgdbname = "wikidb";
$wgDBuser = "mediawikiuser";
$wgDBpassword = "xxx";

# MysqL specific settings
$wgDBprefix = "";

# MysqL table options to use during installation or update
$wgDBTableOptions = "ENGINE=InnoDB,DEFAULT CHARSET=binary";

# Shared database table
# This has no effect unless $wgSharedDB is also set.
$wgSharedTables[] = "actor";

## Shared memory settings
$wgMainCacheType = CACHE_ACCEL;
$wgMemCachedServers = [];

## To enable image uploads,make sure the 'images' directory
## is writable,then set this to true:
$wgEnableuploads = false;
$wgUseImageMagick = true;
$wgImageMagickConvertCommand = "/usr/bin/convert";

# InstantCommons allows wiki to use images from https://commons.wikimedia.org
$wgUseInstantCommons = false;

# Periodically send a pingback to https://www.mediawiki.org/ with basic data
# about this Mediawiki instance. The Wikimedia Foundation shares this data
# with Mediawiki developers to help guide future development efforts.
$wgPingback = true;

## If you use ImageMagick (or any other shell command) on a
## Linux server,this will need to be set to the name of an
## available UTF-8 locale. This should ideally be set to an English
## language locale so that the behavIoUr of C library functions will
## be consistent with typical installations. Use $wgLanguageCode to
## localise the wiki.
$wgShellLocale = "C.UTF-8";

## Set $wgCacheDirectory to a writable directory on the web server
## to make your wiki go slightly faster. The directory should not
## be publicly accessible from the web.
#$wgCacheDirectory = "$IP/cache";

# Site language code,should be one of the list in ./languages/data/Names.PHP
$wgLanguageCode = "en";

$wgSecretKey = "xxx";

# Changing this will log out all existing sessions.
$wgAuthenticationTokenVersion = "1";

# Site upgrade key. Must be set to a string (default provided) to turn on the
# web installer while LocalSettings.PHP is in place
$wgUpgradeKey = "cbbac7c99e42cd92";

## For attaching licensing Metadata to pages,and displaying an
## appropriate copyright notice / icon. GNU Free Documentation
## License and Creative Commons licenses are supported so far.
$wgRightsPage = ""; # Set to the title of a wiki page that describes your license/copyright
$wgRightsUrl = "";
$wgRightsText = "";
$wgRightsIcon = "";

# Path to the GNU diff3 utility. Used for conflict resolution.
$wgDiff3 = "/usr/bin/diff3";

## Default skin: you can change the default skin. Use the internal symbolic
## names,ie 'vector','monobook':
$wgDefaultSkin = "vector";

# Enabled skins.
# The following skins were automatically enabled:
wfLoadSkin( 'MonoBook' );
wfLoadSkin( 'Timeless' );
wfLoadSkin( 'Vector' );


# End of automatically generated settings.
# Add more configuration options below.

$wgSessionCacheType = CACHE_DB;

希望有人能帮助我。

感谢和问候

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...