Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #9561 > unrolled thread
| Started by | steve nospam <steve.nospamm@gmail.com> |
|---|---|
| First post | 2013-05-24 01:08 -0700 |
| Last post | 2023-07-11 22:22 -0700 |
| Articles | 20 on this page of 44 — 16 participants |
Back to article view | Back to comp.lang.php
why php echo does not show up in HTML? steve nospam <steve.nospamm@gmail.com> - 2013-05-24 01:08 -0700
Re: why php echo does not show up in HTML? "Andy" <andy@NOSPAMmanyplay.com> - 2013-05-24 09:50 +0100
Re: why php echo does not show up in HTML? Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-24 09:25 -0400
Re: why php echo does not show up in HTML? steve nospam <steve.nospamm@gmail.com> - 2013-05-24 01:53 -0700
Re: why php echo does not show up in HTML? steve nospam <steve.nospamm@gmail.com> - 2013-05-24 01:57 -0700
Re: why php echo does not show up in HTML? Denis McMahon <denismfmcmahon@gmail.com> - 2013-05-24 22:25 +0000
Re: why php echo does not show up in HTML? steve nospam <steve.nospamm@gmail.com> - 2013-05-24 02:06 -0700
Re: why php echo does not show up in HTML? steve nospam <steve.nospamm@gmail.com> - 2013-05-24 06:20 -0700
Re: why php echo does not show up in HTML? Tim Streater <timstreater@greenbee.net> - 2013-05-24 14:40 +0100
Re: why php echo does not show up in HTML? Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-24 09:55 -0400
Re: why php echo does not show up in HTML? Tim Streater <timstreater@greenbee.net> - 2013-05-24 16:47 +0100
Re: why php echo does not show up in HTML? Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-24 12:07 -0400
Re: why php echo does not show up in HTML? Tim Streater <timstreater@greenbee.net> - 2013-05-24 18:04 +0100
Re: why php echo does not show up in HTML? Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-24 13:30 -0400
Re: why php echo does not show up in HTML? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-24 22:32 +0200
Re: why php echo does not show up in HTML? steve nospam <steve.nospamm@gmail.com> - 2013-05-24 07:19 -0700
Re: why php echo does not show up in HTML? Doug Miller <doug_at_milmac_dot_com@example.com> - 2013-05-24 15:02 +0000
Re: why php echo does not show up in HTML? Denis McMahon <denismfmcmahon@gmail.com> - 2013-05-24 22:37 +0000
Re: why php echo does not show up in HTML? The Natural Philosopher <tnp@invalid.invalid> - 2013-05-24 15:00 +0100
Re: why php echo does not show up in HTML? steve nospam <steve.nospamm@gmail.com> - 2013-05-24 07:20 -0700
Re: why php echo does not show up in HTML? Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-24 10:35 -0400
Re: why php echo does not show up in HTML? The Natural Philosopher <tnp@invalid.invalid> - 2013-05-24 16:59 +0100
Re: why php echo does not show up in HTML? Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-24 10:34 -0400
Re: why php echo does not show up in HTML? "Peter H. Coffin" <hellsop@ninehells.com> - 2013-05-24 10:51 -0500
Re: why php echo does not show up in HTML? Richard Yates <richard@yatesguitar.com> - 2013-05-26 07:02 -0700
Re: why php echo does not show up in HTML? "J.O. Aho" <user@example.net> - 2013-05-24 20:26 +0200
Re: why php echo does not show up in HTML? Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-24 15:34 -0400
Re: why php echo does not show up in HTML? Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-24 09:35 -0400
Re: why php echo does not show up in HTML? steve nospam <steve.nospamm@gmail.com> - 2013-05-24 07:14 -0700
Re: why php echo does not show up in HTML? Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-24 10:38 -0400
Re: why php echo does not show up in HTML? steve nospam <steve.nospamm@gmail.com> - 2013-05-24 07:53 -0700
Re: why php echo does not show up in HTML? Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-24 11:06 -0400
Re: why php echo does not show up in HTML? Doug Miller <doug_at_milmac_dot_com@example.com> - 2013-05-24 15:18 +0000
Re: why php echo does not show up in HTML? Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-24 12:04 -0400
Re: why php echo does not show up in HTML? gordonb.aykca@burditt.org (Gordon Burditt) - 2013-05-24 22:59 -0500
Re: why php echo does not show up in HTML? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-25 09:20 +0200
Re: why php echo does not show up in HTML? Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-25 09:22 -0400
Re: why php echo does not show up in HTML? Denis McMahon <denismfmcmahon@gmail.com> - 2013-05-24 22:49 +0000
Re: why php echo does not show up in HTML? Scott Johnson <noonehome@chalupasworld.com> - 2013-05-24 17:06 -0700
Re: why php echo does not show up in HTML? Doug Miller <doug_at_milmac_dot_com@example.com> - 2013-05-24 15:12 +0000
Re: why php echo does not show up in HTML? Richard Yates <richard@yatesguitar.com> - 2013-05-26 07:13 -0700
Re: why php echo does not show up in HTML? yousafali3949@gmail.com - 2017-07-16 07:14 -0700
Re: why php echo does not show up in HTML? Mark Lloyd <not@mail.invalid> - 2017-07-16 09:55 -0500
Re: why php echo does not show up in HTML? V <vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvva@hotmail.com> - 2023-07-11 22:22 -0700
Page 1 of 3 [1] 2 3 Next page →
| From | steve nospam <steve.nospamm@gmail.com> |
|---|---|
| Date | 2013-05-24 01:08 -0700 |
| Subject | why php echo does not show up in HTML? |
| Message-ID | <78f2c263-051b-4b12-b2fc-049aeae3fdd6@z8g2000yqd.googlegroups.com> |
newbie. could someone explain why this does not work? <!DOCTYPE html> <html> <body> <p>before <?php echo "do you see this?"; ?> <p>after </body> </html> I spend 2 hrs and tried everything and read many things, but message in echo does not show on the browser. I upload this to the web server. I also have local web server running. Both support php. I see no error in the access log file and no error in the php error log file. So the page is bring loaded OK by the web server. But I do not see the echo. What Ami doing wrong? cheers, steve
[toc] | [next] | [standalone]
| From | "Andy" <andy@NOSPAMmanyplay.com> |
|---|---|
| Date | 2013-05-24 09:50 +0100 |
| Message-ID | <RRFnt.19529$tD4.16511@fx04.am4> |
| In reply to | #9561 |
"steve nospam" <steve.nospamm@gmail.com> wrote in message news:78f2c263-051b-4b12-b2fc-049aeae3fdd6@z8g2000yqd.googlegroups.com... > newbie. > > could someone explain why this does not work? > > <!DOCTYPE html> > <html> > <body> > <p>before > > <?php echo "do you see this?"; ?> > > <p>after > </body> > </html> > > I spend 2 hrs and tried everything and read many things, but message > in echo does not show on the browser. I upload this to the web server. > I also have local web server running. Both support php. I see no error > in the access log file and no error in the php error log file. So the > page is bring loaded OK by the web server. But I do not see the echo. > What Ami doing wrong? > > cheers, > steve > Hi Steve, I'm no expert but try these suggestions... 1: Ensure the file is named whatever.php and not whatever.html 2: Put <?php at the very top of page (e.g. <?php // comment ?>) 3: Try <?php $test = "do you see this?";?> <?php echo $test;?> Hope this helps Andy
[toc] | [prev] | [next] | [standalone]
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2013-05-24 09:25 -0400 |
| Message-ID | <knnpgl$pl8$2@dont-email.me> |
| In reply to | #9562 |
On 5/24/2013 4:50 AM, Andy wrote: > > > "steve nospam" <steve.nospamm@gmail.com> wrote in message > news:78f2c263-051b-4b12-b2fc-049aeae3fdd6@z8g2000yqd.googlegroups.com... >> newbie. >> >> could someone explain why this does not work? >> >> <!DOCTYPE html> >> <html> >> <body> >> <p>before >> >> <?php echo "do you see this?"; ?> >> >> <p>after >> </body> >> </html> >> >> I spend 2 hrs and tried everything and read many things, but message >> in echo does not show on the browser. I upload this to the web server. >> I also have local web server running. Both support php. I see no error >> in the access log file and no error in the php error log file. So the >> page is bring loaded OK by the web server. But I do not see the echo. >> What Ami doing wrong? >> >> cheers, >> steve >> > > Hi Steve, > > I'm no expert but try these suggestions... > > 1: Ensure the file is named whatever.php and not whatever.html > Most probably the problem. > 2: Put <?php at the very top of page (e.g. <?php // comment ?>) > Completely unnecessary. The <?php can appear anywhere in the page. > 3: Try <?php $test = "do you see this?";?> <?php echo $test;?> > Which does nothing (except complicate the matter). > > Hope this helps > > Andy -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ==================
[toc] | [prev] | [next] | [standalone]
| From | steve nospam <steve.nospamm@gmail.com> |
|---|---|
| Date | 2013-05-24 01:53 -0700 |
| Message-ID | <43ef7f99-4f41-40b6-9e6a-0df557fcc30a@a8g2000yqp.googlegroups.com> |
| In reply to | #9561 |
On May 24, 3:08 am, steve nospam <steve.nosp...@gmail.com> wrote: > newbie. > > could someone explain why this does not work? > > <!DOCTYPE html> > <html> > <body> > <p>before > > <?php echo "do you see this?"; ?> > > <p>after > </body> > </html> > I have found out by trial and error is that when I change the file extension to .php instead of .htm, then it works. However, I read that php can be used inside .htm? I do not want to change all my .htm file extensions to .php as that will break many links I have.
[toc] | [prev] | [next] | [standalone]
| From | steve nospam <steve.nospamm@gmail.com> |
|---|---|
| Date | 2013-05-24 01:57 -0700 |
| Message-ID | <d96a352c-379c-4f87-be92-5884e7171eb0@d6g2000yqi.googlegroups.com> |
| In reply to | #9563 |
>
> I have found out by trial and error is that when I change the file
> extension to .php instead of .htm, then it works.
>
> However, I read that php can be used inside .htm? I do not want to
> change all my .htm file extensions to .php as that will break many
> links I have.
Another thing I found by trial and error. If I keep the file as .htm,
but change the code to the following, where a <P> was added to inside
the string. That is the only change made.
...........................
<!DOCTYPE html>
<html>
<body>
<p>before
<?php echo '<p>do you see this?'; ?>
<p>after
</body>
</html>
...................
Then I get the echo ! But it looks not correct:
before do you see this?'; ?>
So I have no idea what is going on.
[toc] | [prev] | [next] | [standalone]
| From | Denis McMahon <denismfmcmahon@gmail.com> |
|---|---|
| Date | 2013-05-24 22:25 +0000 |
| Message-ID | <knopdn$qpi$4@dont-email.me> |
| In reply to | #9564 |
On Fri, 24 May 2013 01:57:54 -0700, steve nospam wrote: >> I have found out by trial and error is that when I change the file >> extension to .php instead of .htm, then it works. >> >> However, I read that php can be used inside .htm? I do not want to >> change all my .htm file extensions to .php as that will break many >> links I have. This is a matter for the webserver configuration. If you want the webserver to parse your .htm files with the php preprocessor, then you have to tell the webserver to do so. Normally the webserver by default will only send .php files to the php preprocessor. > Another thing I found by trial and error. If I keep the file as .htm, > but change the code to the following, where a <P> was added to inside > the string. That is the only change made. > <?php echo '<p>do you see this?'; ?> > Then I get the echo ! But it looks not correct: > > before do you see this?'; ?> > > So I have no idea what is going on. Right. What happens here is that the web browser sees: "<?php echo '<p>" As an element tag, startiong at "<" and ending at ">" but it does not recognise it, so it ignores it. Then it sees: "do you see this?'; ?>" as document body text, and it displays it in the document body. By adding the "<p>" you inserted a ">" character after the "<" of "<?php" and that ">" became the closing marker of the tag. I've tried to explain this as clearly as I can, please re-read it until you are sure you understand it. -- Denis McMahon, denismfmcmahon@gmail.com
[toc] | [prev] | [next] | [standalone]
| From | steve nospam <steve.nospamm@gmail.com> |
|---|---|
| Date | 2013-05-24 02:06 -0700 |
| Message-ID | <af70263f-b09f-49cd-b3e3-95b4c04fe39f@z10g2000yqd.googlegroups.com> |
| In reply to | #9561 |
On May 24, 3:08 am, steve nospam <steve.nosp...@gmail.com> wrote: > newbie. > > could someone explain why this does not work? > > <!DOCTYPE html> > <html> > <body> > <p>before > > <?php echo "do you see this?"; ?> > > <p>after > </body> > </html> > > I spend 2 hrs and tried everything and read many things, but message > in echo does not show on the browser. I upload this to the web server. > I also have local web server running. Both support php. I see no error > in the access log file and no error in the php error log file. So the > page is bring loaded OK by the web server. But I do not see the echo. > What Ami doing wrong? > > cheers, > steve 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.
[toc] | [prev] | [next] | [standalone]
| From | steve nospam <steve.nospamm@gmail.com> |
|---|---|
| Date | 2013-05-24 06:20 -0700 |
| Message-ID | <cffe44b6-a68e-49ab-8c19-d0fd55e7f3d1@d6g2000yqi.googlegroups.com> |
| In reply to | #9565 |
> > 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?
[toc] | [prev] | [next] | [standalone]
| From | Tim Streater <timstreater@greenbee.net> |
|---|---|
| Date | 2013-05-24 14:40 +0100 |
| Message-ID | <timstreater-5D50AB.14400724052013@news.individual.net> |
| In reply to | #9575 |
In article <cffe44b6-a68e-49ab-8c19-d0fd55e7f3d1@d6g2000yqi.googlegroups.com>, steve nospam <steve.nospamm@gmail.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
[toc] | [prev] | [next] | [standalone]
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2013-05-24 09:55 -0400 |
| Message-ID | <knnr88$4bg$1@dont-email.me> |
| In reply to | #9580 |
On 5/24/2013 9:40 AM, Tim Streater wrote: > In article > <cffe44b6-a68e-49ab-8c19-d0fd55e7f3d1@d6g2000yqi.googlegroups.com>, > steve nospam <steve.nospamm@gmail.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. > What's the difference between using .phtml and .php (other than the former is non-standard and will not work on all systems)? -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ==================
[toc] | [prev] | [next] | [standalone]
| From | Tim Streater <timstreater@greenbee.net> |
|---|---|
| Date | 2013-05-24 16:47 +0100 |
| Message-ID | <timstreater-80BD7F.16473024052013@news.individual.net> |
| In reply to | #9581 |
In article <knnr88$4bg$1@dont-email.me>, Jerry Stuckle <jstucklex@attglobal.net> wrote: > On 5/24/2013 9:40 AM, Tim Streater wrote: > > 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. > > > > What's the difference between using .phtml and .php (other than the > former is non-standard and will not work on all systems)? None, I don't suppose, but it was the standard where I used to work. I just followed it. I use .php for scripts that *only* contain php. It's a shame that the universe doesn't use proper file metadata but as we seem to be stuck using extensions they may as well mean something. -- Tim "That excessive bail ought not to be required, nor excessive fines imposed, nor cruel and unusual punishments inflicted" -- Bill of Rights 1689
[toc] | [prev] | [next] | [standalone]
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2013-05-24 12:07 -0400 |
| Message-ID | <kno313$kpa$1@dont-email.me> |
| In reply to | #9599 |
On 5/24/2013 11:47 AM, Tim Streater wrote: > In article <knnr88$4bg$1@dont-email.me>, > Jerry Stuckle <jstucklex@attglobal.net> wrote: > >> On 5/24/2013 9:40 AM, Tim Streater wrote: > >> > 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. >> > >> >> What's the difference between using .phtml and .php (other than the >> former is non-standard and will not work on all systems)? > > None, I don't suppose, but it was the standard where I used to work. I > just followed it. I use .php for scripts that *only* contain php. > That's reasonable, as long as you only run on servers you control. Of course, someone else's server could cause a problem. > It's a shame that the universe doesn't use proper file metadata but as > we seem to be stuck using extensions they may as well mean something. > I won't argue that. However, remember when the web started, many os's didn't support metadata (and some still don't do it properly). And, unfortunately, once a standard is implemented, it becomes very difficult to make a non-compatible change (which this would be). -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ==================
[toc] | [prev] | [next] | [standalone]
| From | Tim Streater <timstreater@greenbee.net> |
|---|---|
| Date | 2013-05-24 18:04 +0100 |
| Message-ID | <timstreater-29F360.18043524052013@news.individual.net> |
| In reply to | #9604 |
In article <kno313$kpa$1@dont-email.me>, Jerry Stuckle <jstucklex@attglobal.net> wrote: > On 5/24/2013 11:47 AM, Tim Streater wrote: > > In article <knnr88$4bg$1@dont-email.me>, > > Jerry Stuckle <jstucklex@attglobal.net> wrote: > > > >> On 5/24/2013 9:40 AM, Tim Streater wrote: > > > >> > 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. > >> What's the difference between using .phtml and .php (other than the > >> former is non-standard and will not work on all systems)? > > > > None, I don't suppose, but it was the standard where I used to work. I > > just followed it. I use .php for scripts that *only* contain php. > That's reasonable, as long as you only run on servers you control. Of > course, someone else's server could cause a problem. Yes, in-house servers. > > It's a shame that the universe doesn't use proper file metadata but as > > we seem to be stuck using extensions they may as well mean something. > I won't argue that. However, remember when the web started, many os's > didn't support metadata (and some still don't do it properly). And, > unfortunately, once a standard is implemented, it becomes very difficult > to make a non-compatible change (which this would be). Agreed, I was just having a whinge. :-) (fed up with it being cold - it's about 6C today - and we just had a 90 min power outage) -- Tim "That excessive bail ought not to be required, nor excessive fines imposed, nor cruel and unusual punishments inflicted" -- Bill of Rights 1689
[toc] | [prev] | [next] | [standalone]
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2013-05-24 13:30 -0400 |
| Message-ID | <kno7sq$iac$1@dont-email.me> |
| In reply to | #9605 |
On 5/24/2013 1:04 PM, Tim Streater wrote: > In article <kno313$kpa$1@dont-email.me>, > Jerry Stuckle <jstucklex@attglobal.net> wrote: > >> On 5/24/2013 11:47 AM, Tim Streater wrote: >> > In article <knnr88$4bg$1@dont-email.me>, >> > Jerry Stuckle <jstucklex@attglobal.net> wrote: >> > >> >> On 5/24/2013 9:40 AM, Tim Streater wrote: >> > >> >> > 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. > >> >> What's the difference between using .phtml and .php (other than the >> >> former is non-standard and will not work on all systems)? >> > >> > None, I don't suppose, but it was the standard where I used to work. I >> > just followed it. I use .php for scripts that *only* contain php. > >> That's reasonable, as long as you only run on servers you control. Of >> course, someone else's server could cause a problem. > > Yes, in-house servers. > I should also add - I do something kinda similar, but not. Files which only contain PHP code are going to be included in other files. So I'll have .php as the main extension, and those which will be included as .inc.php (for included php). Then there is a subset of that - class files, which I define as .class.php. You'll never see any of those in a URL, though, since they are all kept outside the website's document root. I find it works for me, and is compatible with most hosting companies (those who do not allow storing files outside of the document root aren't work using, IMHO). -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ==================
[toc] | [prev] | [next] | [standalone]
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Date | 2013-05-24 22:32 +0200 |
| Message-ID | <1610733.vASnu692iJ@PointedEars.de> |
| In reply to | #9599 |
Tim Streater wrote: > Jerry Stuckle <jstucklex@attglobal.net> wrote: >> On 5/24/2013 9:40 AM, Tim Streater wrote: >> > 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. >> > >> >> What's the difference between using .phtml and .php (other than the >> former is non-standard and will not work on all systems)? > > None, I don't suppose, but it was the standard where I used to work. I > just followed it. I use .php for scripts that *only* contain php. “.phtml” for *templates* is a quasi-standard *at least* since Zend Framework uses it. IIRC, Eclipse PDT and Zend Studio assign files with “.phtml” suffix the PHP Editor plugin as default. Using “.phtml” for anything other than templates is unwise. The convention probably stems from “.shtml” for SSI. > It's a shame that the universe doesn't use proper file metadata but as > we seem to be stuck using extensions they may as well mean something. ACK. PointedEars -- > If you get a bunch of authors […] that state the same "best practices" > in any programming language, then you can bet who is wrong or right... Not with javascript. Nonsense propagates like wildfire in this field. -- Richard Cornford, comp.lang.javascript, 2011-11-14
[toc] | [prev] | [next] | [standalone]
| From | steve nospam <steve.nospamm@gmail.com> |
|---|---|
| Date | 2013-05-24 07:19 -0700 |
| Message-ID | <d52747cd-b74d-4242-8ffe-ef95fe376a68@g3g2000yqg.googlegroups.com> |
| In reply to | #9580 |
> > You get your: > > AddType application/x-httpd-php .htm > > added to the apache config file on the server. > What I did is add the above line to my .htaccess file on my home page. And it worked for apache server on my PC. But when I did the same for my hosting company, then what happens when I clicked on the file, the browser was asking me to download the .htm file ! instead of opening it as a web page. Do you think I need to add the above line to apache config file? But my hosting company is public company, I have no control over what web server they are using and I can't ask them to edit the web server config files for me. This is a shared 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. > It is not the delay isssue. It simply did not work as I said above. > 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. > I can't edit the web server config files on the my hosting ISP computer !
[toc] | [prev] | [next] | [standalone]
| From | Doug Miller <doug_at_milmac_dot_com@example.com> |
|---|---|
| Date | 2013-05-24 15:02 +0000 |
| Message-ID | <XnsA1CA710205385dougmilmaccom@78.46.70.116> |
| In reply to | #9585 |
steve nospam <steve.nospamm@gmail.com> wrote in news:d52747cd-b74d-4242-8ffe- ef95fe376a68@g3g2000yqg.googlegroups.com: > >> >> You get your: >> >> AddType application/x-httpd-php .htm >> >> added to the apache config file on the server. >> > > What I did is add the above line to my .htaccess file on my home page. Wrong place. As Tim told you, you need to add this to the Apache config file. > And it worked for apache server on my PC. I doubt that. If you added it to the .htaccess file on your PC, it didn't work. If it did work, you added to the Apache config file, not the .htaccess file. >But when I did the same for > my hosting company, then what happens when I clicked on the file, the > browser was asking me to download the .htm file ! instead of opening > it as a web page. Right, that's what happens when you don't have things configured correctly... > > Do you think I need to add the above line to apache config file? That's where Tim told you to add it.... > But > my hosting company is public company, I have no control over what web > server they are using and I can't ask them to edit the web server > config files for me. This is a shared server. The way this is normally done is that you create your own Apache config file in your web root directory, and put whatever you need there that is specific to your configuration. Check with your hosting provider for details on how to do this on their server.
[toc] | [prev] | [next] | [standalone]
| From | Denis McMahon <denismfmcmahon@gmail.com> |
|---|---|
| Date | 2013-05-24 22:37 +0000 |
| Message-ID | <knoq3l$qpi$5@dont-email.me> |
| In reply to | #9594 |
On Fri, 24 May 2013 15:02:47 +0000, Doug Miller wrote: > steve nospam <steve.nospamm@gmail.com> wrote in > news:d52747cd-b74d-4242-8ffe- ef95fe376a68@g3g2000yqg.googlegroups.com: >>> AddType application/x-httpd-php .htm >> What I did is add the above line to my .htaccess file on my home page. > Wrong place. As Tim told you, you need to add this to the Apache config > file. >> And it worked for apache server on my PC. It may depend on the security settings in the config file. See the docs: http://httpd.apache.org/docs/2.2/mod/mod_mime.html#addtype Context: server config, virtual host, directory, .htaccess and: http://httpd.apache.org/docs/2.2/mod/core.html#allowoverride "When this directive is set to All, then any directive which has the .htaccess Context is allowed in .htaccess files." If he has "allowoverride all" (or anything else that allows an addtype in an .htaccess) specified in a the relevant <directory> section of the apache conf, then inserting addtype in the .htaccess will work as he describes. If he wants it to work on the server, he has to convince the server admins to: allowoverride fileinfo for his directory(ies), but the server admins will most likely be very reluctant to do that because what he intends to do is going to increase cpu load on the server by sending all his html files through the php preprocessor. -- Denis McMahon, denismfmcmahon@gmail.com
[toc] | [prev] | [next] | [standalone]
| From | The Natural Philosopher <tnp@invalid.invalid> |
|---|---|
| Date | 2013-05-24 15:00 +0100 |
| Message-ID | <knnrpm$hpg$2@news.albasani.net> |
| In reply to | #9575 |
On 24/05/13 14:20, 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. > 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? |echo (file_get_contents( "filename.htm" ));| ? > > 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? > > -- Ineptocracy (in-ep-toc’-ra-cy) – a system of government where the least capable to lead are elected by the least capable of producing, and where the members of society least likely to sustain themselves or succeed, are rewarded with goods and services paid for by the confiscated wealth of a diminishing number of producers.
[toc] | [prev] | [next] | [standalone]
| From | steve nospam <steve.nospamm@gmail.com> |
|---|---|
| Date | 2013-05-24 07:20 -0700 |
| Message-ID | <b273cc28-0fd5-4943-a37e-abf6860898a6@g3g2000yqg.googlegroups.com> |
| In reply to | #9583 |
On May 24, 9:00 am, The Natural Philosopher <t...@invalid.invalid> wrote: > > |echo (file_get_contents( "filename.htm" ));| > > ? > huh? what is this?
[toc] | [prev] | [next] | [standalone]
Page 1 of 3 [1] 2 3 Next page →
Back to top | Article view | comp.lang.php
csiph-web