FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » why php echo does not show up in HTML?
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: why php echo does not show up in HTML? [message #181632 is a reply to message #181627] Fri, 24 May 2013 13:40 Go to previous messageGo to previous message
Tim Streater is currently offline  Tim Streater
Messages: 328
Registered: September 2010
Karma:
Senior Member
In article
<cffe44b6-a68e-49ab-8c19-d0fd55e7f3d1(at)d6g2000yqi(dot)googlegroups(dot)com>,
steve nospam <steve(dot)nospamm(at)gmail(dot)com> wrote:

>>
>> I found the problem.
>>
>> I needed to modify the .htaccess file. added this line
>>
>> AddType application/x-httpd-php .htm
>>
>> Now it works. php works from inside htm file. No need to change file
>> extension.
>
> guys, the above fix did not work on the server. Must be something with
> the php used there. It worked on my local apache server. So, I still
> looking for a solution. My question is this:
>
> If I change my index.htm to index.php, is there a way to make an alias
> or something so that not all my links are broken? so that a link to
> index.htm will use index.php?
>
> Ok, let me go back one step: This is all crazy, because all what I
> wanted to do is simple: use php to include some common html code into
> all my html web pages. So how is one supposed to do this if one can't
> use php inside html?
>
> I want to use php call to include common HTML code into an html page,
> but can't use php from HTML? what is the deal here? So, how do people
> do this thing then?

You get your:

AddType application/x-httpd-php .htm

added to the apache config file on the server.

However, you should note if if you do that, any .htm file will be sent
to PHP by apache, even if there is no PHP in it. That adds an extra step
to getting your files served up. That is why people have been suggesting
to change the files which use PHP to have a .php extension.

Personally I add:

AddType application/x-httpd-php .phtml

to the apache config file, and use that for files containing any PHP.
That way the PHP interpreter is only involved when a file actually has
PHP in it.

--
Tim

"That excessive bail ought not to be required, nor excessive fines imposed,
nor cruel and unusual punishments inflicted" -- Bill of Rights 1689
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: PHP Contact Form, mt-rand(), problem Validating 1 input
Next Topic: Parsing mbox files with Windows Php
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sun Nov 24 14:36:06 GMT 2024

Total time taken to generate the page: 0.03879 seconds