This is a discussion on php doesn't work in html files within the PHP General forums, part of the PHP Programming Forums category; Hi there all, I use Apache version 1.3 and WIndows 2000. The site is not global but only local ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hi there all,
I use Apache version 1.3 and WIndows 2000. The site is not global but only local so I use the url http://localhost/index.html This index.html look's like this: <html> <body> This is a line </body> </html> <? echo "this is the second line"; ?> Output is: This is a line So the php part is not done at all. Is that right? I always believed php should work in html? Nico |
|
|||
|
Nico Berg wrote:
> Hi there all, > This index.html look's like this: > > <html> > <body> > This is a line > </body> > </html> > > <? > echo "this is the second line"; > ?> > > Output is: This is a line > > So the php part is not done at all. Is that right? I always believed php > should work in html? Assuming you have the web server set up according to PHP's installation docs, you either need to rename index.html to index.php or tell the web server to run .html files through PHP (refer to the PHP manual for details on how to do this). -- Stuart |
|
|||
|
On Sunday 11 January 2004 21:04, Nico Berg wrote:
> I use Apache version 1.3 and WIndows 2000. The site is not global but only > local so I use the url http://localhost/index.html > > This index.html look's like this: [snip] > So the php part is not done at all. Is that right? I always believed php > should work in html? By default the webserver only treats files with the .php extension (and a few others, see your webserver config) as PHP files. If you want it to process .html files as PHP then look for the following line (or similar) in httpd.conf: AddType application/x-httpd-php .php4 .php3 .phtml .php .inc and add .html to the end of it, then restart Apache. -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * ------------------------------------------ Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general ------------------------------------------ /* "I got everybody to pay up front...then I blew up their planet." "Now why didn't I think of that?" -- Post Bros. Comics */ |
|
|||
|
----- Original Message -----
From: "Nico Berg" To: "'PHP General'" Sent: Sunday, January 11, 2004 2:04 PM Subject: [php] php doesn't work in html files > Hi there all, > > I use Apache version 1.3 and WIndows 2000. The site is not global but only > local so I use the url http://localhost/index.html > > This index.html look's like this: > > <html> > <body> > This is a line > </body> > </html> > > <? > echo "this is the second line"; > ?> > > Output is: This is a line > > So the php part is not done at all. Is that right? I always believed php > should work in html? Try to rename the .html file in .php (index.html -> index.php) and test it. You can reconfigure apache to pass all .html files to php compiler but i don't recommend it because it reduce drastically the performance. Heber |
|
|||
|
--- Nico Berg <nberg@gandalf.xs4all.nl> wrote:
> I use Apache version 1.3 and WIndows 2000. [snip] > <? > echo "this is the second line"; > ?> > > Output is: This is a line > > So the php part is not done at all. Do you have PHP installed? Chris ===== Chris Shiflett - http://shiflett.org/ PHP Security Handbook Coming mid-2004 HTTP Developer's Handbook http://httphandbook.org/ |
|
|||
|
Wow, my posts on the average get 0 or 1 (not helpful reply)... This one
gets 4 identical replies!!! -Shawn :) "Nico Berg" <nberg@gandalf.xs4all.nl> wrote in message news:IEEBJCNANAAAMKCGAEKLEEMBCHAA.nberg@gandalf.xs 4all.nl... > Hi there all, > > I use Apache version 1.3 and WIndows 2000. The site is not global but only > local so I use the url http://localhost/index.html > > This index.html look's like this: > > <html> > <body> > This is a line > </body> > </html> > > <? > echo "this is the second line"; > ?> > > Output is: This is a line > > So the php part is not done at all. Is that right? I always believed php > should work in html? > > Nico |
|
|||
|
--- Shawn McKenzie <nospam@mckenzies.net> wrote:
> Wow, my posts on the average get 0 or 1 (not helpful reply)... > This one gets 4 identical replies!!! Because the replies to the question that you quoted were all different, your comment makes no sense (I'm not sure that it would make sense anyway). If you are trying to make an important point, please rephrase your comment. Otherwise, please refrain from making off-topic comments. Thanks. Chris ===== Chris Shiflett - http://shiflett.org/ PHP Security Handbook Coming mid-2004 HTTP Developer's Handbook http://httphandbook.org/ |
|
|||
|
Hi,
It works. I decided to add .html to the list of extensions that will be opend by php if asked for in apache. I understand here that it will take more time before html files are processed? True? Thanks all, Nico Berg > -----Oorspronkelijk bericht----- > Van: Nico Berg [mailto:nberg@gandalf.xs4all.nl] > Verzonden: zondag 11 januari 2004 14:05 > Aan: 'PHP General' > Onderwerp: [php] php doesn't work in html files > > > Hi there all, > > I use Apache version 1.3 and WIndows 2000. The site is not global but only > local so I use the url http://localhost/index.html > > This index.html look's like this: > > <html> > <body> > This is a line > </body> > </html> > > <? > echo "this is the second line"; > ?> > > Output is: This is a line > > So the php part is not done at all. Is that right? I always believed php > should work in html? > > Nico > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > |