PHPを8.4.21に更新したら/home/*/pulic_html/以下の*.phpが実行できない

  • 投稿日:
  • by

/var/log/apache2/error.logを確認したところ以下のエラーが出ていた

client denied by server configuration: /home/sneezy2k/public_html/index.php

どうやら、/etc/apache2/mods-available/php8.4.confを修正する必要があるらしい

# Running PHP scripts in user directories is disabled by default
#
# To re-enable PHP in user directories comment the following lines
# (from <IfModule ...> to </IfModule>.) Do NOT set it to On as it
# prevents .htaccess files from disabling it. This also disables
# serving the files, as the webserver would otherwise serve them
# as plaintext, and many software packages still put passwords in
# .php files. Comment out or remove the FilesMatch directive if
# you really want to serve php as plaintext from user dirs.

ということで、/etc/apache2/mods-available/php8.4.confに記載の
<IfModule ...>から</IfModule>をコメントアウトしてApacheを再起動したところ元に戻りました