2017-02-12 63 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然后尝试从另一个浏览器中查看网页 - 我有天,当铬固执地高速缓存结果,并继续下载的源代码,而在另一个浏览器,它只是罚款。