Forum Moderators: phranque

Message Too Old, No Replies

php include not executing in my .shtml file

Prolly my .htaccess file, but what?

         

LipstickFace

8:32 pm on Nov 19, 2007 (gmt 0)

10+ Year Member



Hi, folks:

I have the following in my index.shtml file:

<?php include("front_ad/banners.php");?

The same line executes on several other servers I have.

Here's what's in my .htaccess file:

AddType application/x-httpd-php .html .htm .php
AddHandler application/x-httpd-php .html .htm .php

When I attempt to add ".shtml" to the mix, thing go *seriously" wrong. When added to the first line, my include executes, but none of the HTML does. When added to the second line, the page downloads instead of displaying.

I'm feeling like a total doof. What the heck am I doing wrong? I've googled until I'm blue in the face, but nowhere does any page that I've found address the issue of my page showing nothing BUT my executed php and no HTML. (My images show, and the banner my script's trying to rotate, but no HTML text.) May I have a clue please? This is *totally* anti-nueno!

Thanks mucho!

PS: The script executs flawlessly when I call it directly, in case you were gonna ask. (I would!)

jdMorgan

10:34 pm on Nov 19, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You have specified MIME-types for both directives. Generally AddHandler would not use a MIME-type as an argument, but rather a handler-name, such as "server-parsed."

Jim

LipstickFace

1:16 am on Nov 20, 2007 (gmt 0)

10+ Year Member



Hi, Jim:

Well *that* whooshed right over my head, but trying to read between the lines, I decided you must be trying to tell me that the "AddHandler" ought not be there, so I removed that line, then added ".shtml" to the previous line. My page didn't break (yay!), but my include didn't execute, either (boo). What didn't I get?

Binky

vincevincevince

1:23 am on Nov 20, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Use this kind of include instead, and don't request that .shtml be handled by PHP:
<!--#include virtual="front_ad/banners.php"-->

IncludesNoExec needs to be off, I think it's off by default.

LipstickFace

1:41 am on Nov 20, 2007 (gmt 0)

10+ Year Member



vvv!

That worked! But ... I don't understand. I use that nomenclature for text files. The way I've been doing it is how I've been doing it for php scripts, and it's been working (on other servers, I mean)! (rolling eyes) This never even crossed my mind! I've been hammering away at .htaccess and php.ini, and pulling my hair out in bloody tufts, and all I had to do was a regular include?! Oh, my freakin' god! Sometimes I make things waaaaaaay too hard on myself. And all that googling! EVERY SINGLE PLACE I LOOKED suggested the EXACT way I was doing it! I sooo totally don't get it!

But it's working! Gots me little 125x125 pixel banners rotating now. Whew! This shouldn'ta been this hard! Thanks bunches, Vince! You rock! Smoochies!

Binky