【发布时间】:2016-10-14 15:57:43
【问题描述】:
我迷路了。
我已经设置了一个 AWC EC2 RHEL 服务器,并安装了 php 和 apache。除了 index.php 文件不会执行之外,一切似乎都正常。如果我直接调用它们,所有其他 *.php 文件都可以使用。
index.php 包含:
<?php echo "test"; ?>
在/etc/httpd/conf/httpd.conf我有设置:
<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>
虽然如果我删除 index.php 仍然不起作用。
我在index.php 上拥有-rw-r--r-- ec2-user ec2-user 的权限
我不确定还有什么其他信息在这里有用,因为除了 index.php 之外的所有其他 php 文件都可以工作。 (例如:如果我调用/index.php 什么都不输出,如果我将index.php 移动到index2.php 并调用/index2.php 输出test)
对于为什么会发生这种情况有什么想法吗?
编辑
我现在意识到在调用 index.php 文件检查访问日志时会出现 500 内部服务器错误。
"GET /index.php HTTP/1.1" 500
也许这将有助于指明正确的方向?我仍然不清楚如何解决这个问题。同样,将文件名更改为 index.php 以外的任何名称(例如:index2.php)将正确执行文件。
此外,启用错误报告后,我收到此错误:
PHP Warning: Unknown: failed to open stream: Permission denied in Unknown on line 0
PHP Fatal error: Unknown: Failed opening required '/var/www/html/index.php' (include_path='.:/usr/share/pear:/usr/share/php') in Unknown on line 0
我尝试将权限更改为各种变体,包括 777、755、655、644、664 等……甚至尝试将所有者更改为 apache。不走运。
【问题讨论】:
标签: php linux amazon-web-services amazon-ec2 rhel