首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >PHP代码显示在浏览器上

PHP代码显示在浏览器上
EN

Server Fault用户
提问于 2014-07-22 13:08:55
回答 1查看 5.8K关注 0票数 1

我在这里找了几个问题,但似乎都没有回答我的问题。我使用Apache2.2.21/PHP5.3.9已经有一段时间了,而且仍然很好。我下载并安装了Apache2.4.10/PHP5.5.14,到目前为止似乎没有执行PHP代码。加载PHP模块。我猜问题就在PHP方面。这是控制台的输出。

代码语言:javascript
复制
C:\server\Apache2.4\bin>httpd -v
Server version: Apache/2.4.10 (Win32)
Apache Lounge VC11 Server built:   Jul 17 2014 11:50:08

C:\server\Apache2.4\bin>httpd -M
Loaded Modules:
 core_module (static)
 win32_module (static)
 mpm_winnt_module (static)
 http_module (static)
 so_module (static)
 access_compat_module (shared)
 actions_module (shared)
 alias_module (shared)
 allowmethods_module (shared)
 asis_module (shared)
 auth_basic_module (shared)
 authn_core_module (shared)
 authn_file_module (shared)
 authz_core_module (shared)
 authz_groupfile_module (shared)
 authz_host_module (shared)
 authz_user_module (shared)
 autoindex_module (shared)
 cgi_module (shared)
 dir_module (shared)
 env_module (shared)
 include_module (shared)
 isapi_module (shared)
 log_config_module (shared)
 mime_module (shared)
 negotiation_module (shared)
 rewrite_module (shared)
 setenvif_module (shared)
 php5_module (shared)

 C:\server\Apache2.4\bin>..\..\php-5.5\php -v
 PHP 5.5.14 (cli) (built: Jun 25 2014 12:40:49)
 Copyright (c) 1997-2014 The PHP Group
 Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies

 C:\server\Apache2.4\bin>..\..\php-5.5\php -m
 [PHP Modules]
 bcmath
 calendar
 Core
 ctype
 curl
 date
 dom
 ereg
 filter
 ftp
 hash
 iconv
 json
 libxml
 mbstring
 mcrypt
 mhash
 mongo
 mysql
 mysqli
 mysqlnd
 odbc
 openssl
 pcre
 PDO
 pdo_mysql
 Phar
 Reflection
 session
 SimpleXML
 SPL
 standard
 tokenizer
 wddx
 xml
 xmlreader
 xmlwriter
 zip
 zlib

 [Zend Modules]

当我切换到Apache2.2/PHP5.3时,一切正常。我尝试过添加AddType application/x-httpd-php .php .phtml .php3,但没有运气。我不使用PHP中的短标签。

php.ini和httpd.conf的副本在这里=> https://www.dropbox.com/sh/b0dejatwn6ephid/AACbZ6ORcJwncVqRs7S1KrCxa

如果有人能帮我解决这个问题会很感激的。

EN

回答 1

Server Fault用户

回答已采纳

发布于 2014-07-22 14:57:46

在快速查看发布的配置之后,似乎缺少了AddHandler设置:

代码语言:javascript
复制
#BEGIN PHP-5.5
PHPIniDir "C:\server\php-5.5\"
LoadModule php5_module "C:\server\php-5.5\php5apache2_4.dll"
AddHandler application/x-httpd-php .php

这就是指示web服务器与PHP5模块一起解析.php文件而不是以纯文本形式提供它们的原因。

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

https://serverfault.com/questions/614496

复制
相关文章

相似问题

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