2017-02-12 61 views
0

我使用Drupal的8在我的本地主機,而當去我的索引頁,該代碼將出現在我的瀏覽器:Drupal的8索引問題

<?php 

/** 
* @file 
* The PHP page that serves all page requests on a Drupal installation. 
* 
* All Drupal code is released under the GNU General Public License. 
* See COPYRIGHT.txt and LICENSE.txt files in the "core" directory. 
*/ 

use Drupal\Core\DrupalKernel; 
use Symfony\Component\HttpFoundation\Request; 

$autoloader = require_once 'autoload.php'; 

$kernel = new DrupalKernel('prod', $autoloader); 

$request = Request::createFromGlobals(); 
$response = $kernel->handle($request); 
$response->send(); 

$kernel->terminate($request, $response); 

我試圖尋找一個答案,但沒有成功,直到現在。

+0

如果在Ubuntu上你需要安裝libapache2-mod-php5/libapache2-mod-php7 apt-get install libapache2-mod-php5或者你正在運行的任何合適的版本pf php – vishwa

回答

0

這不是Drupal錯誤。您的本地服務器未配置爲處理PHP頁面。您可以按照以下步驟解決您的問題。

The correct AddType for php is application/x-httpd-php 

AddType application/x-httpd-php   .php 
AddType application/x-httpd-php-source .phps 
Also make sure your php module is loaded 

LoadModule php5_module  modules/mod_php55.so 

當你配置Apache然後嘗試從另一個瀏覽器中查看網頁 - 我有天,當鉻固執地高速緩存結果,並繼續下載的源代碼,而在另一個瀏覽器,它只是罰款。