ApacheはPHPの空白ページを表示します。

ApacheはPHPの空白ページを表示します。

新しいバージョンをインストールし、Centos 7Linuxを初めて使用します。

を使用して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: ファイルなし

ベストアンサー1

?開始タグに欠落しています。それが必要です:

<?php
phpinfo();
?>

おすすめ記事