[英]On AWS EC2 Linux RHEL all PHP files are executing, except for index.php
我迷失了這一點。
我已經安裝了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
outpus 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。 沒運氣。
AWS EC2 RedHat Web Server內部鏈接不起作用。 解
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Note that "MultiViews" must be named explicitly --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.4/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride none
新值應更改為AllowOverride all
嘗試以許可或禁用模式配置selinux。
我有同樣的問題。 我試圖安裝Moodle,但失敗了。 我上面有同樣的錯誤。
我將selinux配置為寬松,以查看這是否是根本原因,並且確實可以安裝。
我的問題是,我已經以普通用戶的名義在他的主目錄下打開了moodle存檔(moodle ... tar.gz),並將其移至apache的DocumentRoot。 這使selinux內容字段錯誤。
我啟用了selinux,並直接在DocumentRoot(/ var / www / html)下打開tar.gz存檔。 這為文件(httpd_sys_content_t)提供了正確的內容屬性。 我能夠啟用selinux來運行moodle。
莫什
需要將權限設置為由Apache用戶讀取。 當前權限不允許它以Apache用戶身份讀取文件。
另外,最好檢查一下Apache日志中出現的錯誤,如果我沒有記錯的話,應該為“ 403 Forbidden”。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.