首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >已经安装了PHP5,但是Apache将PHP显示为未解释的文本。如何让它作为PHP处理?

已经安装了PHP5,但是Apache将PHP显示为未解释的文本。如何让它作为PHP处理?
EN

Server Fault用户
提问于 2013-07-13 20:49:07
回答 2查看 27.9K关注 0票数 3

在Drupal安装中,它将根PHP文件显示为下面的纯文本。a2enmod表示启用了php5,智能表示安装了libasache2-mod-php5,启用了mods/有php5.conf和php5.load,VirtualHost指定了DirectoryIndex和ScriptHandler。这有点像政府经济学家的电脑病毒:你能找到的每一个指标都表明你的系统很好,但它不起作用。我还应该怎么做才能启动这个Drupal 7站点?

显示的页面如下:

代码语言:javascript
复制
<?php

/**
 * @file
 * The PHP page that serves all page requests on a Drupal installation.
 *
 * The routines here dispatch control to the appropriate handler, which then
 * prints the appropriate page.
 *
 * All Drupal code is released under the GNU General Public License.
 * See COPYRIGHT.txt and LICENSE.txt.
 */

/**
 * Root directory of Drupal installation.
 */
define('DRUPAL_ROOT', getcwd());

require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
menu_execute_active_handler();
EN

回答 2

Server Fault用户

发布于 2013-07-13 21:35:03

这听起来像是apache没有正确配置来运行php脚本。

检查这两行文件中的任何一个( /etc/httpd/conf.d/php.conf/etc/httpd/conf/httpd.conf )

代码语言:javascript
复制
AddHandler php5-script .php
AddType text/html .php

然后重新启动apache

service httpd restart

票数 3
EN

Server Fault用户

发布于 2014-08-02 18:40:30

只是遇到了同样的问题,尽管Drupal没有问题--最终发现了short_open_tag参数,这个参数现在显然默认为"Off“--我的应用程序完全使用简短的打开标记编写。把它改为short_open_tag = On,它马上就出现了。

票数 2
EN
页面原文内容由Server Fault提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://serverfault.com/questions/523131

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档