我在我的本地主机中使用Drupal8,当转到我的索引页面时,以下代码出现在我的浏览器中:
<?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);我试图寻找答案,但直到现在都没有成功。
发布于 2017-02-16 00:59:28
看起来您的服务器没有正确配置,所以这并不是Drupal特有的问题。看这里:PHP code is not being executed, instead code shows on the page
发布于 2017-08-30 14:18:03
这不是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的时候,试着在另一个浏览器上查看页面--我曾经有过这样的经历,那就是chrome顽固地缓存结果,它会一直下载源代码,而在另一个浏览器里,这是很好的。
https://stackoverflow.com/questions/42190302
复制相似问题