前提・実現したいこと
さくらVPS上のUbuntu18.04にPHP7.2をインストールしましたが、
http://IPアドレス/index.php にて、白い画面しか表示されません。
これは何が問題なのでしょうか。
該当のソースコード
以下の手順でインストール、設定変更しました。
$ sudo apt install php libapache2-mod-php php-mysql php-mbstring php-gd $ cd /etc/php/7.2/apache2 $ sudo vi php.ini error_log = /var/log/php.log mbstring.language = Japanese mbstring.internal_encoding = UTF-8 mbstring.http_input = auto mbstring.detect_order = auto expose_php = Off date.timezone = Asia/Tokyo $ vi /var/www/html/index.php <? php phpinfo(); ?> ~ $ sudo systemctl restart apache2
試したこと
下記ページを参考に、short_open_tagの設定をOnにすると、アクセスエラーとなりました。
https://qiita.com/awesam/items/ba6ba6eaa12761e58401
PHPは動いているようです。
$ php -v PHP 7.2.24-0ubuntu0.18.04.10 (cli) (built: Oct 25 2021 17:47:59) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies with Zend OPcache v7.2.24-0ubuntu0.18.04.10, Copyright (c) 1999-2018, by Zend Technologies
補足情報(FW/ツールのバージョンなど)
Ubuntu(18.04)
Apache インストール済み
PHP 7.2.24
/var/log/php.log や apache2 の管理下の error_log はチェックしていますか?
php.ini の設定はerror_log = /var/log/php_errors.logにしていました。
以下それぞれの表示結果になります。
$ cat /var/log/php_errors.log
[26-Dec-2021 18:56:49 Asia/Tokyo] test msg
$ tail -f /var/log/apache2/error.log
[Sun Dec 26 18:15:50.339192 2021] [core:notice] [pid 16606] AH00094: Command line: '/usr/sbin/apache2'
[Sun Dec 26 18:16:55.352951 2021] [mpm_prefork:notice] [pid 16606] AH00169: caught SIGTERM, shutting down
[Sun Dec 26 18:16:55.414311 2021] [mpm_prefork:notice] [pid 16627] AH00163: Apache/2.4.29 (Ubuntu) configured -- resuming normal operations
[Sun Dec 26 18:16:55.414356 2021] [core:notice] [pid 16627] AH00094: Command line: '/usr/sbin/apache2'
[Sun Dec 26 18:55:43.725636 2021] [mpm_prefork:notice] [pid 16627] AH00169: caught SIGTERM, shutting down
[Sun Dec 26 18:55:43.788006 2021] [mpm_prefork:notice] [pid 16833] AH00163: Apache/2.4.29 (Ubuntu) configured -- resuming normal operations
[Sun Dec 26 18:55:43.788072 2021] [core:notice] [pid 16833] AH00094: Command line: '/usr/sbin/apache2'
[Sun Dec 26 18:56:18.972955 2021] [mpm_prefork:notice] [pid 16833] AH00169: caught SIGTERM, shutting down
[Sun Dec 26 18:56:19.038667 2021] [mpm_prefork:notice] [pid 16852] AH00163: Apache/2.4.29 (Ubuntu) configured -- resuming normal operations
[Sun Dec 26 18:56:19.038717 2021] [core:notice] [pid 16852] AH00094: Command line: '/usr/sbin/apache2'
このあとどうすればよろしいでしょうか。
回答1件
あなたの回答
tips
プレビュー
