I have a very simple, minimal PHP-based page running on my Apache server, that loads perfectly fine from various computers, operating systems, and web browsers. The PHP version is 7.4.33, Apache Server version: Apache/2.4.56 (Raspbian).
But a few people reported that when they try to access it, they see the raw PHP code instead of a web page. These seem to be iOS users who are using either/both Safari and/or Chrome. I have searched for previous questions on SO but only found one related post but it didn't apply in my case -- most of the time the full page is displayed, only certain iOS devices see the code.
The code itself is very simple. It loads a header and a footer which are each .php files but contain mere HTML*:
<?php
include 'header.php';
include 'footer.php';
?>
The above is what some iOS users see instead of the proper page. I reproduce this problem on my iPad (iPadOS 16.6, Safari, Chrome, and/or Brave), but it works fine on my iPhone (iOS 16.6) on which I see the page normally (Safari).
Clearing cookies/cache, starting in private mode, trying yet another browser, all fail to help on the iPad. Also adding some explicit header language like header("Content-Type: text/html; charset=UTF-8");
to the PHP doesn't help.
How can I help these users? This doesn't strike me an Apache config error, because it loads fine on all other devices/browsers/etc (but maybe it is?). Thus, is it Apple-related somehow?
* Example:
$ cat header.php
<center><h2>Welcome to the page</h2></center>