我在这里搜索了几个问题,但似乎没有一个能回答我的问题。我使用 Apache 2.2.21/PHP 5.3.9 已经有一段时间了,仍然运行良好。我下载并安装了 Apache 2.4.10/PHP 5.5.14,到目前为止似乎无法执行 PHP 代码。PHP 模块已加载。我猜问题出在 PHP 方面。以下是控制台的输出。
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]
当我切换到 Apache 2.2/PHP 5.3 时,一切正常。我尝试添加AddType application/x-httpd-php .php .phtml .php3
但没有成功。我没有在 PHP 中使用短标签。
php.ini 和 httpd.conf 的副本在此处 =>https://www.dropbox.com/sh/b0dejatwn6ephid/AACbZ6ORcJwncVqRs7S1KrCxa
如果有人能帮助我解决这个问题我将不胜感激。
答案1
快速浏览一下你发布的配置后,似乎添加处理程序缺少设置:
#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
文件而不是将其作为纯文本提供的内容。