PHP 7 & Related Issues

Background

After installing a WordPress plugin - WP Health, it's reminded that PHP5 had no longer been supported since late 2018, thus there may be risk in all WordPress websites.

Issue

Since removing PHP5 (retrospectively known that it's not necessary), and installed remi's repository's PHP72, some WordPress sites could not be accessed with message: "Internal Server Error. The server encountered an internal error or misconfiguration and was unable to complete your request." Then using VirtualBox's snapshot to roll back and finally got every site back to normal.

However, using re-check configuration of Virtualmin to see if there's anything need to follow up, it's known that mod_actions of Apache wasn't enabled. Then after enabling mod_actions by uncommenting the following:

LoadModule actions_module modules/mod_action.so

in /etc/httpd/conf.modules.d/00-base.conf, something weird that instead of executing php page, these pages were downloaded. Some members on forums suggested that the following in /etc/httpd/conf.d/php.conf should be commented out:

SetHandler application/x-httpd-php

This really solved the problem of not executing php pages, but another weird thing happened. Some other websites couldn't be accessed again with message: 500 Internal Server Error.

Solution

  1. The permission of some html directories all granted to 775 and changed owner as apache.
  2. In Virtualmin, Server Config -> Website Options -> PHP script execution mode must select FPM if mod_fpm is installed and enable.

Tricks

Before comment out SetHandler application/x-httpd-php, directory permission was not a problem. What and how does something change the permission or why is the permission of html directories should be further granted to eliminated 500 Internal Server Error?

Config

  • WordPress 5.1
  • Virtualmin 6
  • PHP7.2 remi
  • CentOS7

Leave a Reply

Close Menu