0

I am having a hard time figuring this out. I hadn't changed anything on the site before this, however my webhost (BlueHost) sometimes messes with my files.

Anyway, I am not able to bring up anything on the page that is published with an include. Below is a copy of the code for the page (minus content) and a copy of my .htaccess file. I am not sure what else you need. The site is located at: https://templemountfaithful.org/ and here is the page with the code below: https://templemountfaithful.org/articles/

<?php $thisPage='news';?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
    <title>Commentaries and News Updates from the Temple Mount Faithful</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta name="description" content="These articles cover the Third Temple,The Temple Mount, Jerusalem, the Jewish people, Israel, Bible prophecy, the Middle East and more.">

    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
  <link rel="stylesheet" type="text/css" media="screen" href="/style/main.css">

</head>

<body>

<div id="header">
    <?php include("/includestmf/topNavTMF-Main.inc"); ?>
</div>

<div class="colmask leftmenu">
    <div class="colleft">
        <div class="col1">
            <!-- Column 1 start -->

<!-- content -->

<h1 style="margin-bottom: .2em;">Commentaries and News Updates</h1>
<hr>
<p>
All commentaries are written by Gershon Salomon, Chairman of the Temple Mount Faithful, unless otherwise noted.</p>

<h2 class="article2">2022</h2>
<ul>

</ul>

<!--   CONTENT   -->

<!-- content //-->

<div style="font-size: .8em; color: #8f8f8f; padding-top: 10px;">
 <?php
  putenv("TZ=America/Miami");
  echo "Last modified: " . date( "F j, Y", getlastmod() );
?>
</div>

            <!-- Column 1 end -->
        </div>

        <div class="col2">
            <!-- Column 2 start -->
  <?php include("/includestmf/leftNavTMF.inc"); ?>
            <!-- Column 2 end -->
        </div>
    </div>

</div>
<div id="footer">
  <?php include("/includestmf/footerTMF.inc"); ?>
</div>

<script type="text/javascript" src="/javascript/common.js"></script>

</body>
</html>

========

# Last changed: April 27, 2022

AddHandler server-parsed .htm .html .inc
AddType audio/x-m4a MPEG-4 media m4a
AddType video/mp4 MPEG-4 media mp4
AddType video/x-m4v MPEG-4 media m4v

# Use PHP7 as default
Options +ExecCGI
# AddType text/html .html .htm
# AddHandler server-parsed .html .htm
AddType text/html .inc
AddHandler server-parsed .inc

# AddHandler application/x-httpd-ea-php72 .php
# AddType application/x-httpd-php .html .htm .inc

RewriteEngine on
RewriteBase /
ServerSignature Off

ServerSignature Off

# Used for the errorpage.php file
ErrorDocument 400 /errorpage.php
ErrorDocument 401 /errorpage.php
ErrorDocument 403 /errorpage.php
ErrorDocument 404 /errorpage.php
ErrorDocument 500 /errorpage.php

SetEnv TZ America/New_York

Help!

1
  • "I hadn't changed anything on the site before this" - What did you change exactly? Are you implying that this used to work (as written)?
    – MrWhite
    Apr 28, 2022 at 10:46

1 Answer 1

1
<?php include("/includestmf/topNavTMF-Main.inc"); ?>

It looks like are trying to use a document root relative URL-path as argument to the include statement. This is unlikely going to work. When you include a slash prefix on the file-path, PHP looks for the file in the root of the server's filesystem. You should be using an absolute file-path here. For example:

<?php include($_SERVER['DOCUMENT_ROOT']."/includestmf/topNavTMF-Main.inc"); ?>

However, you should have been seeing an E_WARNING in the PHP error log, or even on screen, alerting you to the incorrect file path?

UPDATE: You also have issues with your Server-Side-Includes (SSI) - they are being downloaded (eg. request /includestmf/topNavTMF-Main.inc in the browser). These "SSI" in fact look like PHP files as they contain "raw" (unprocessed) PHP code. I would avoid mixing SSI with PHP for this very reason. (You don't need SSI when you are using PHP.)

AddHandler server-parsed .inc

This should be OK, however, AddOutputFilter INCLUDES .inc is the more usual way to activate SSI. (But staying with the .shtml extension is preferable to avoid conflicts.)

RewriteEngine on
RewriteBase /

You're not using mod_rewrite in the code you've posted, so these two directives should be removed.

3
  • Thanks, but none of that really made a difference. (BTW, the includes are HTML files.)
    – Lee
    May 1, 2022 at 20:14
  • @Lee If the includes are "HTML files" then why are you using a .inc extension? Why are you (trying to) parsing it for SSI? Why does it contain PHP code?
    – MrWhite
    May 3, 2022 at 11:20
  • The site was built several years ago so I don't remember the reasons. I am currently in the process of changing the entire site to ".HTML". Thanks for the help!
    – Lee
    May 5, 2022 at 19:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.