Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news-1.dfn.de!news.dfn.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: "J.O. Aho" Newsgroups: comp.lang.php Subject: Re: why php echo does not show up in HTML? Date: Fri, 24 May 2013 20:26:08 +0200 Lines: 53 Message-ID: References: <78f2c263-051b-4b12-b2fc-049aeae3fdd6@z8g2000yqd.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net iFryuWWA12DdUs0VWviVjAUmeoLP8g8OC/nH9e6tPT33HnCyD2 Cancel-Lock: sha1:8YYfSXWsDWY9VKCtVAv1PNq9A/c= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130408 Thunderbird/17.0.5 In-Reply-To: Xref: csiph.com comp.lang.php:9608 On 24/05/13 11:06, steve nospam 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. No, you didn't solve anything at all, you just managed to break your site to not work properly. When you add that line, all the pages ending with ".htm" will be sent trough the PHP parser and the majority of your pages will not include PHP which means you do something unnecessary by sending them to the PHP engine which has to read the whole file and do nothing more. The fix is rename the files to .php and remove the line from your htaccess file. If pages which before been called whatever.htm will suddenly be whatever.php, then use Rewrite rules to redirect the user to the new page. RewriteEngine On RewriteRule ^whatever.htm$ whatever.php Now your site will work at the majority of web hosting companies as you have your PHP in .php files and RewriteRule is in most cases allowed. Note: When people say you can use PHP in HTML, they ain't talking about the file extension, but that you can mix plain HTML with PHP code, for example: --- example.php --- example file with mixed php and html

--- eof --- -- //Aho