Centos
Apache 顯示 PHP 的空白頁面
我已經安裝了新版本
Centos 7
,我是 Linux 新手。我使用安裝了 Apache
yum -y install httpd
,我可以打開測試頁面,一切正常。之後我使用安裝 PHP(5.4.16)
yum -y install php
並成功安裝。之後我使用
sudo systemctl restart httpd
. 現在我info.php
用這段程式碼創建了一個文件:<php phpinfo(); ?>
當我打開時,
http://localhost/info.php
我得到一個空白螢幕,裡面什麼都沒有。我已經閱讀了很多關於此的主題和問題,我做了一切,但沒有任何幫助。
以下是可能對您有所幫助的內容。
錯誤日誌:
[Sat Mar 12 12:56:33.235215 2016] [core:notice] [pid 12938] SELinux policy enabled; httpd running as context system_u:system_r:httpd_t:s0 [Sat Mar 12 12:56:33.236027 2016] [suexec:notice] [pid 12938] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec) [Sat Mar 12 12:56:33.251732 2016] [so:warn] [pid 12938] AH01574: module php5_module is already loaded, skipping AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using ::1. Set the 'ServerName' directive globally to suppress this message [Sat Mar 12 12:56:33.253398 2016] [auth_digest:notice] [pid 12938] AH01757: generating secret for digest authentication ... [Sat Mar 12 12:56:33.266274 2016] [lbmethod_heartbeat:notice] [pid 12938] AH02282: No slotmem from mod_heartmonitor [Sat Mar 12 12:56:33.271424 2016] [mpm_prefork:notice] [pid 12938] AH00163: Apache/2.4.6 (CentOS) PHP/5.4.16 configured -- resuming normal operations [Sat Mar 12 12:56:33.271462 2016] [core:notice] [pid 12938] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND' [Sat Mar 12 12:58:08.594101 2016] [:error] [pid 12940] [client ::1:44873] script '/var/www/html/info.php' not found or unable to stat [Sat Mar 12 13:01:56.086456 2016] [mpm_prefork:notice] [pid 12938] AH00170: caught SIGWINCH, shutting down gracefully [Sat Mar 12 13:02:55.938198 2016] [core:notice] [pid 1400] SELinux policy enabled; httpd running as context system_u:system_r:httpd_t:s0 [Sat Mar 12 13:02:56.048201 2016] [suexec:notice] [pid 1400] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec) [Sat Mar 12 13:02:56.077712 2016] [so:warn] [pid 1400] AH01574: module php5_module is already loaded, skipping AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using ::1. Set the 'ServerName' directive globally to suppress this message [Sat Mar 12 13:02:56.079255 2016] [auth_digest:notice] [pid 1400] AH01757: generating secret for digest authentication ... [Sat Mar 12 13:02:57.017924 2016] [lbmethod_heartbeat:notice] [pid 1400] AH02282: No slotmem from mod_heartmonitor [Sat Mar 12 13:02:57.038794 2016] [mpm_prefork:notice] [pid 1400] AH00163: Apache/2.4.6 (CentOS) PHP/5.4.16 configured -- resuming normal operations [Sat Mar 12 13:02:57.038866 2016] [core:notice] [pid 1400] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
Apache 配置文件:庫存文件
php.ini : 庫存文件
.htaccess:沒有文件
您缺少
?
開始標籤中的 。它應該是:<?php phpinfo(); ?>
嘗試啟用錯誤報告:
<?php error_reporting(E_ALL); phpinfo(); ?>