LoginSignup
1

More than 3 years have passed since last update.

CentOS8 + Apache2.4.37 + php7.2(php-fpm) で HTML ファイルの中で PHP を実行する

Last updated at Posted at 2020-05-28

Apache と PHP のインストール

# yum install httpd php

Apache と PHP の起動と自動起動の設定

# systemctl start httpd
# systemctl enable httpd
# systemctl start php-fpm
# systemctl enable php-fpm

PHP の設定変更

# vi /etc/php-fpm.d/www.conf

security.limit_extensions のコメントアウトを外し、末尾に .html を追加する。

# vi /etc/httpd/conf.d/php.conf

<FilesMatch \.(php|phar)$>
を
<FilesMatch \.(php|phar|html)$>
のようにファイルの種類に html を追加する。

各サービスを再起動する

# systemctl restart httpd
# systemctl restart php-fpm

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1