Je viens d'installer drupal 8.8.1 en utilisant Composer.
Au démarrage de l'installation, il affiche la source HTML dans la fenêtre du navigateur au lieu de restituer le code HTML du script d'installation. Le code ci-dessous est ce qui est affiché:
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8" />
<meta name="Generator" content="Drupal 8 (https://www.drupal.org)" />
<meta name="MobileOptimized" content="width" />
<meta name="HandheldFriendly" content="true" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="robots" content="noindex, nofollow" />
<link rel="shortcut icon" href="/core/misc/favicon.ico" type="image/vnd.Microsoft.icon" />
<title>Choose language | Drupal</title>
<link rel="stylesheet" media="all" href="/core/assets/vendor/normalize-css/normalize.css?0" />
<link rel="stylesheet" media="all" href="/core/misc/normalize-fixes.css?0" />
<link rel="stylesheet" media="all" href="/core/themes/stable/css/system/components/ajax-progress.module.css?0" />
<link rel="stylesheet" media="all" href="/core/themes/stable/css/system/components/align.module.css?0" />
<link rel="stylesheet" media="all" href="/core/themes/stable/css/system/components/autocomplete-loading.module.css?0" />
<link rel="stylesheet" media="all" href="/core/themes/stable/css/system/components/fieldgroup.module.css?0" />
<link rel="stylesheet" media="all" href="/core/themes/stable/css/system/components/container-inline.module.css?0" />
<link rel="stylesheet" media="all" href="/core/themes/stable/css/system/components/clearfix.module.css?0" />
<link rel="stylesheet" media="all" href="/core/themes/stable/css/system/components/details.module.css?0" />
<link rel="stylesheet" media="all" href="/core/themes/stable/css/system/components/hidden.module.css?0" />
<link rel="stylesheet" media="all" href="/core/themes/stable/css/system/components/item-list.module.css?0" />
<link rel="stylesheet" media="all" href="/core/themes/stable/css/system/components/js.module.css?0" />
<link rel="stylesheet" media="all" href="/core/themes/stable/css/system/components/nowrap.module.css?0" />
<link rel="stylesheet" media="all" href="/core/themes/stable/css/system/components/position-container.module.css?0" />
<link rel="stylesheet" media="all" href="/core/themes/stable/css/system/components/progress.module.css?0" />
<link rel="stylesheet" media="all" href="/core/themes/stable/css/system/components/reset-appearance.module.css?0" />
<link rel="stylesheet" media="all" href="/core/themes/stable/css/system/components/resize.module.css?0" />
<link rel="stylesheet" media="all" href="/core/themes/stable/css/system/components/sticky-header.module.css?0" />
<link rel="stylesheet" media="all" href="/core/themes/stable/css/system/components/tabledrag.module.css?0" />
<link rel="stylesheet" media="all" href="/core/themes/stable/css/system/components/tablesort.module.css?0" />
<link rel="stylesheet" media="all" href="/core/themes/stable/css/system/components/tree-child.module.css?0" />
<link rel="stylesheet" media="all" href="/core/themes/stable/css/system/system.admin.css?0" />
<link rel="stylesheet" media="all" href="/core/themes/stable/css/system/system.maintenance.css?0" />
<link rel="stylesheet" media="all" href="/core/themes/seven/css/base/elements.css?0" />
<link rel="stylesheet" media="all" href="/core/themes/seven/css/base/typography.css?0" />
<link rel="stylesheet" media="all" href="/core/themes/seven/css/base/print.css?0" />
<link rel="stylesheet" media="all" href="/core/themes/seven/css/layout/layout.css?0" />
<link rel="stylesheet" media="all" href="/core/themes/classy/css/components/action-links.css?0" />
<link rel="stylesheet" media="all" href="/core/themes/classy/css/components/breadcrumb.css?0" />
<link rel="stylesheet" media="all" href="/core/themes/classy/css/components/button.css?0" />
<link rel="stylesheet" media="all" href="/core/themes/classy/css/components/collapse-processed.css?0" />
<link rel="stylesheet" media="all" href="/core/themes/classy/css/components/container-inline.css?0" />
<link rel="stylesheet" media="all" href="/core/themes/classy/css/components/exposed-filters.css?0" />
<link rel="stylesheet" media="all" href="/core/themes/classy/css/components/field.css?0" />
<link rel="stylesheet" media="all" href="/core/themes/classy/css/components/form.css?0" />
<link rel="stylesheet" media="all" href="/core/themes/classy/css/components/icons.css?0" />
<link rel="stylesheet" media="all" href="/core/themes/classy/css/components/inline-form.css?0" />
<link rel="stylesheet" media="all" href="/core/themes/classy/css/components/item-list.css?0" />
<link rel="stylesheet" media="all" href="/core/themes/classy/css/components/link.css?0" />
<link rel="stylesheet" media="all" href="/core/themes/classy/css/components/links.css?0" />
<link rel="stylesheet" media="all" href="/core/themes/classy/css/components/menu.css?0" />
<link rel="stylesheet" media="all" href="/core/themes/classy/css/components/more-link.css?0" />
<link rel="stylesheet" media="all" href="/core/themes/classy/css/components/pager.css?0" />
<link rel="stylesheet" media="all" href="/core/themes/classy/css/components/tabledrag.css?0" />
<link rel="stylesheet" media="all" href="/core/themes/classy/css/components/tableselect.css?0" />
<link rel="stylesheet" media="all" href="/core/themes/classy/css/components/tablesort.css?0" />
<link rel="stylesheet" media="all" href="/core/themes/classy/css/components/tabs.css?0" />
<link rel="stylesheet" media="all" href="/core/themes/classy/css/components/textarea.css?0" />
<link rel="stylesheet" media="all" href="/core/themes/classy/css/components/ui-dialog.css?0" />
<link rel="stylesheet" media="all" href="/core/themes/classy/css/components/messages.css?0" />
<link rel="stylesheet" media="all" href="/core/themes/seven/css/components/admin-list.css?0" />
<link rel="stylesheet" media="all" href="/core/themes/seven/css/components/content-header.css?0" />
<link rel="stylesheet" media="all" href="/core/themes/seven/css/components/container-inline.css?0" />
<link rel="stylesheet" media="all" href="/core/themes/seven/css/components/container-inline.module.css?0" />
<link rel="stylesheet" media="all" href="/core/themes/seven/css/components/breadcrumb.css?0" />
<link rel="stylesheet" media="all" href="/core/themes/seven/css/components/buttons.css?0" />
<link rel="stylesheet" media="all" href="/core/themes/seven/css/components/details.css?0" />
<link rel="stylesheet" media="all" href="/core/themes/seven/css/components/messages.css?0" />
<link rel="stylesheet" media="all" href="/core/themes/seven/css/components/dropbutton.component.css?0" />
<link rel="stylesheet" media="all" href="/core/themes/seven/css/components/entity-meta.css?0" />
<link rel="stylesheet" media="all" href="/core/themes/seven/css/components/field-ui.css?0" />
<link rel="stylesheet" media="all" href="/core/themes/seven/css/components/form.css?0" />
<link rel="stylesheet" media="all" href="/core/themes/seven/css/components/help.css?0" />
<link rel="stylesheet" media="all" href="/core/themes/seven/css/components/menus-and-lists.css?0" />
<link rel="stylesheet" media="all" href="/core/themes/seven/css/components/modules-page.css?0" />
<link rel="stylesheet" media="all" href="/core/themes/seven/css/components/node.css?0" />
<link rel="stylesheet" media="all" href="/core/themes/seven/css/components/page-title.css?0" />
<link rel="stylesheet" media="all" href="/core/themes/seven/css/components/pager.css?0" />
<link rel="stylesheet" media="all" href="/core/themes/seven/css/components/panel.css?0" />
<link rel="stylesheet" media="all" href="/core/themes/seven/css/components/skip-link.css?0" />
<link rel="stylesheet" media="all" href="/core/themes/seven/css/components/tables.css?0" />
<link rel="stylesheet" media="all" href="/core/themes/seven/css/components/search-admin-settings.css?0" />
<link rel="stylesheet" media="all" href="/core/themes/seven/css/components/tablesort-indicator.css?0" />
<link rel="stylesheet" media="all" href="/core/themes/seven/css/components/system-status-report-general-info.css?0" />
<link rel="stylesheet" media="all" href="/core/themes/seven/css/components/system-status-report.css?0" />
<link rel="stylesheet" media="all" href="/core/themes/seven/css/components/tabs.css?0" />
<link rel="stylesheet" media="all" href="/core/themes/seven/css/components/system-status-report-counters.css?0" />
<link rel="stylesheet" media="all" href="/core/themes/seven/css/components/system-status-counter.css?0" />
<link rel="stylesheet" media="all" href="/core/themes/seven/css/components/views-ui.css?0" />
<link rel="stylesheet" media="all" href="/core/themes/seven/css/theme/colors.css?0" />
<link rel="stylesheet" media="all" href="/core/themes/seven/css/theme/maintenance-page.css?0" />
<link rel="stylesheet" media="all" href="/core/themes/seven/css/theme/install-page.css?0" />
<!--[if lte IE 8]>
<script src="/core/assets/vendor/html5shiv/html5shiv.min.js?v=3.7.3"></script>
<![endif]-->
</head>
<body class="install-page path-frontpage db-offline">
<a href="#main-content" class="visually-hidden focusable skip-link">
Skip to main content
</a>
<div class="dialog-off-canvas-main-canvas" data-off-canvas-main-canvas>
<div class="layout-container">
<header role="banner">
<h1 class="page-title">
Drupal
<span class="site-version">8.8.1</span>
</h1>
</header>
<aside class="layout-sidebar-first" role="complementary">
<h2 class="visually-hidden">Installation tasks</h2>
<ol class="task-list">
<li class="is-active">
Choose language
<span class="visually-hidden"> (active)</span> </li>
<li>
Choose profile
</li>
<li>
Verify requirements
</li>
<li>
Set up database
</li>
<li>
Install site
</li>
<li>
Configure site
</li>
</ol>
</aside>
<main role="main">
<h2 class="heading-a">Choose language</h2>
<form class="install-select-language-form" data-drupal-selector="install-select-language-form" action="/core/install.php" method="post" id="install-select-language-form" accept-charset="UTF-8">
<div class="js-form-item form-item js-form-type-select form-type-select js-form-item-langcode form-item-langcode form-no-label">
<label for="edit-langcode" class="visually-hidden">Choose language</label>
<select data-drupal-selector="edit-langcode" id="edit-langcode" name="langcode" class="form-select"><option value="af">Afrikaans</option><option value="ast">Asturianu</option><option value="az">AzÉ™rbaycanca</option><option value="id">Bahasa Indonesia</option><option value="jv">Basa Java</option><option value="bs">Bosanski</option><option value="ca">Català </option><option value="cy">Cymraeg</option><option value="da">Dansk</option><option value="de">Deutsch</option><option value="et">Eesti</option><option value="en" selected="selected">English</option><option value="es">Español</option><option value="eo">Esperanto</option><option value="eu">Euskera</option><option value="fil">Filipino</option><option value="fr">Français</option><option value="fy">Frysk</option><option value="fo">Føroyskt</option><option value="ga">Gaeilge</option><option value="gl">Galego</option><option value="Gd">Gà idhlig</option><option value="hr">Hrvatski</option><option value="it">Italiano</option><option value="sw">Kiswahili</option><option value="ht">Kreyòl ayisyen</option><option value="ku">Kurdî</option><option value="lv">LatvieÅ¡u</option><option value="lt">Lietuvių</option><option value="xx-lolspeak">Lolspeak</option><option value="hu">Magyar</option><option value="mg">Malagasy</option><option value="nl">Nederlands</option><option value="nb">Norsk, bokmÃ¥l</option><option value="nn">Norsk, nynorsk</option><option value="oc">Occitan</option><option value="pl">Polski</option><option value="pt-br">Português, Brasil</option><option value="pt-pt">Português, Portugal</option><option value="ro">Română</option><option value="gsw-berne">Schwyzerdütsch</option><option value="sco">Scots</option><option value="sq">Shqip</option><option value="en-x-simple">Simple English</option><option value="sk">SlovenÄina</option><option value="sl">SlovenÅ¡Äina</option><option value="fi">Suomi</option><option value="sv">Svenska</option><option value="se">Sámi</option><option value="vi">Tiếng Việt</option><option value="tr">Türkçe</option><option value="is">Ãslenska</option><option value="cs">ÄŒeÅ¡tina</option><option value="el">Ελληνικά</option><option value="be">БеларуÑкаÑ</option><option value="bg">БългарÑки</option><option value="ky">Кыргызча</option><option value="mk">МакедонÑки</option><option value="ru">РуÑÑкий</option><option value="sr">СрпÑки</option><option value="tyv">Тыва дыл</option><option value="uk">УкраїнÑька</option><option value="mn">монгол</option><option value="kk">Қазақ</option><option value="hy">Õ€Õ¡ÕµÕ¥Ö€Õ¥Õ¶</option><option value="he">עברית</option><option value="ug">ئۇيغۇرچە</option><option value="ur">اردو</option><option value="ar">العربية</option><option value="ms">بهاس ملايو</option><option value="fa">Ùارسی</option><option value="ne">नेपाली</option><option value="mr">मराठी</option><option value="hi">हिनà¥à¤¦à¥€</option><option value="bn">বাংলা</option><option value="pa">ਪੰਜਾਬੀ</option><option value="gu">ગà«àªœàª°àª¾àª¤à«€</option><option value="ta">தமிழà¯</option><option value="ta-lk">தமிழà¯, இலஙà¯à®•à¯ˆ</option><option value="te">తెలà±à°—à±</option><option value="kn">ಕನà³à²¨à²¡</option><option value="ml">മലയാളം</option><option value="si">සිංහල</option><option value="th">ภาษาไทย</option><option value="lo">ພາສາລາວ</option><option value="bo">བོད་སà¾à½‘་</option><option value="dz">རྫོང་à½</option><option value="my">ဗမာစကား</option><option value="ka">ქáƒáƒ თული ენáƒ</option><option value="am">አማáˆáŠ›</option><option value="km">ភាសាážáŸ’មែរ</option><option value="ja">日本語</option><option value="zh-hans">简体ä¸æ–‡</option><option value="zh-hant">ç¹é«”ä¸æ–‡</option><option value="ko">í•œêµì–´</option></select>
</div>
<div data-drupal-states="{"invisible":{"select[name=\u0022langcode\u0022]":{"value":"en"}}}" id="edit-help" class="js-form-item form-item js-form-type-item form-type-item js-form-item-help form-item-help form-no-label">
<p>Translations will be downloaded from the <a href="http://localize.drupal.org">Drupal Translation website</a>. If you do not want this, select <a href="https://actionfund.nfb.org/core/install.php?langcode=en">English</a>.</p>
</div>
<input autocomplete="off" data-drupal-selector="form-i-o33hif7d1m-uxztfnjrb8op-dmeqk-qza61jsd-mm" type="hidden" name="form_build_id" value="form-i_o33hif7D1m_uxztfNjRB8op-DMeqK-qZA61Jsd-mM" />
<input data-drupal-selector="edit-install-select-language-form" type="hidden" name="form_id" value="install_select_language_form" />
<div data-drupal-selector="edit-actions" class="form-actions js-form-wrapper form-wrapper" id="edit-actions"><input data-drupal-selector="edit-submit" type="submit" id="edit-submit" name="op" value="Save and continue" class="button button--primary js-form-submit form-submit" />
</div>
</form>
</main>
</div>
</div>
<script type="application/json" data-drupal-selector="drupal-settings-json">{"path":{"baseUrl":"\/core\/install.php\/","scriptPath":null,"pathPrefix":"","currentPath":"","currentPathIsAdmin":false,"isFront":false,"currentLanguage":"en","currentQuery":{"rewrite":"ok"}},"pluralDelimiter":"\u0003","suppressDeprecationErrors":true,"ajaxTrustedUrl":{"form_action_p_pvdeGsVG5zNF_XLGPTvYSKCf43t8qZYSwcfZl2uzM":true}}</script>
<script src="/core/assets/vendor/jquery/jquery.min.js?v=3.4.1"></script>
<script src="/core/assets/vendor/jquery-once/jquery.once.min.js?v=2.2.0"></script>
<script src="/core/misc/drupalSettingsLoader.js?v=8.8.1"></script>
<script src="/core/misc/drupal.js?v=8.8.1"></script>
<script src="/core/misc/drupal.init.js?v=8.8.1"></script>
<script src="/core/misc/states.js?v=8.8.1"></script>
<script src="/core/themes/seven/js/mobile.install.js?v=8.8.1"></script>
</body>
</html>
J'ai à juste titre supposé que le serveur n'envoie pas d'en-tête Content-Type. J'ouvre ../core/install.php et ajoute:
header("Content-Type: text/html");
à install.php et tout commence à fonctionner comme prévu.
Est-ce un bogue dans cette version de la configuration Drupal ou est-ce que je manque quelque chose dans la configuration de ce serveur? Pas une grosse affaire mais j'aimerais corriger les choses correctement.
Voici ce que le serveur envoie (qui comprend des informations pertinentes sur l'environnement)
Cache-Control: must-revalidate, no-cache, private
Connection: close
Content-Type: text/html;charset=UTF-8
Date: Fri, 27 Dec 2019 16:17:01 GMT
ETag: "1577463421"
Expires: Sun, 19 Nov 1978 05:00:00 GMT
Last-Modified: Fri, 27 Dec 2019 16:17:01 +0000
Server: Apache/2.4.6 (Red Hat Enterprise Linux) OpenSSL/1.0.2k-fips PHP/7.1.27
X-Content-Type-Options: nosniff
X-Powered-By: PHP/7.1.27
Ajout de ce qui suit à .htaccess dans le problème ../web résolu:
<IfModule mod_headers.c>
<Files ~ "\.(php)$">
Header set Content-Type "text/html; charset=utf-8"
</Files>
</IfModule>
Tant que vous définissez explicitement des en-têtes Content-Type lorsque votre php génère des fichiers (tels que .pdf, .csv, etc.) que vous devriez faire de toute façon, cela ne cassera pas votre code.
Il semble que vous utilisiez le serveur Web Apache sur Red Hat. Les conseils sur fixer des URL propres sur Drupal 8 résoudront probablement ce problème.
Tout d'abord, vérifiez qu'il existe un .htaccess
fichier dans la racine de votre document.
Après cela, il y a 2 solutions pour que ces règles soient suivies.
Une solution consiste à permettre à Apache de suivre le .htaccess
règles que Drupal fournit. Citant de cet article:
Vous devrez avoir la directive Allow Override définie dans votre fichier de configuration Apache (cela permettra les remplacements locaux .htaccess sur votre site):
AllowOverride All AccessFileName .htaccess
L'autre solution consiste simplement à copier la configuration du .htaccess dans la configuration de votre serveur Web.
Assurez-vous de redémarrer le serveur Apache après avoir modifié la configuration. Il y a beaucoup plus de conseils dans ce document qui valent la peine d'être lus.