ApacheとPHPのインストール
CentOS-8.2.2004(minimal)の初期設定後に行うことを想定しています。
行頭に#がついているものはrootユーザーで実行してください。
行頭に$がついているものは一般ユーザーで実行してください。
Apacheインストールと起動
※CentOS8標準版 2.4.37を導入します。
# dnf -y install httpd mod_ssl mod_ldap wget
# systemctl enable httpd.service
# systemctl start httpd.service
PHPのインストール
※最新版&FPM(FastCGI Process Manager)を導入します。
リポジトリの追加
# dnf -y install "https://rpms.remirepo.net/enterprise/remi-release-8.rpm"
# vi /etc/yum.repos.d/remi-safe.repo
-----[remi-safe]Setting
10 enabled=0
-----
# vi /etc/yum.repos.d/remi-modular.repo
※変更なしでいいと思います。
-----[remi-modular]Setting
10 enabled=1
-----
インストール
# dnf --enablerepo=remi -y install oniguruma-devel
# dnf module install -y php:remi-7.4
PHP(FPM)の起動
# systemctl enable php-fpm.service
# systemctl start php-fpm.service
PHP 7.4.11の設定(参考程度)
# vi /etc/php.ini
-----
379 expose_php = Off
388 max_execution_time = 300
694 post_max_size = 80M
846 upload_max_filesize = 20M
923 date.timezone = Asia/Tokyo
1502 mbstring.language = Japanese
1509 mbstring.internal_encoding = UTF-8
-----
拡張子HTMLをPHPで動かす
# vi /etc/php-fpm.d/www.conf
-----[追記]
392 security.limit_extensions = .php .html
-----
# vi /etc/httpd/conf.d/php.conf
-----
60 <FilesMatch \.(php|phar|html)$>
-----
モジュール版ではない為、<IfModule !mod_php*.c>に合致する為、本記載のみでOK
# systemctl restart php-fpm.service
この記事が気に入ったらサポートをしてみませんか?