Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Aug 28th, 2006, 6:20 PM   #1
kruptof
Professional Programmer
 
kruptof's Avatar
 
Join Date: May 2006
Location: UK - London
Posts: 333
Rep Power: 3 kruptof is on a distinguished road
Embeding into html?

i am bit new to php so can anybody please inform how to get a php script to execute inside a html document..............i tried it an its not working at all......is there some configuration i have to change on the apache or the php configuration files or isn't it possible at all?

here is an example of type of thing i am talking about:
Quote:
<HTML>
<BODY>
<?php phpinfo(); ?>
</BODY>
</HTML>
__________________
Quote:
When I was young it seemed that life was so wonderful,a miracle, oh it was beautiful, magical.
Now watch what you say or they'll be calling you a radical,a liberal, oh fanatical, criminal. Oh won't you sign up your name,we'd like to feel you're acceptable, respectable, oh presentable, a vegetable
kruptof is offline   Reply With Quote
Old Aug 28th, 2006, 6:32 PM   #2
Booooze
Expert Programmer
 
Booooze's Avatar
 
Join Date: Mar 2006
Location: Igloo
Posts: 710
Rep Power: 3 Booooze is on a distinguished road
Send a message via MSN to Booooze
Are you naming the files with the .php extension? Your code should work. Sloppy in my opinion, but should work:p
Booooze is offline   Reply With Quote
Old Aug 28th, 2006, 6:34 PM   #3
LOI Kratong
Professional Programmer
 
Join Date: May 2005
Location: Woo - Boot Sector!
Posts: 294
Rep Power: 4 LOI Kratong is on a distinguished road
Yeah, just name the script .php and it'll be right as rain! If you were confused, all the html is still parsed and rendered beautifully!

Basically the script is executed on the server, and only the html is given over the http connection, so that's all the browser sees...
__________________
www.heldtogether.co.uk
LOI Kratong is offline   Reply With Quote
Old Aug 28th, 2006, 7:36 PM   #4
kruptof
Professional Programmer
 
kruptof's Avatar
 
Join Date: May 2006
Location: UK - London
Posts: 333
Rep Power: 3 kruptof is on a distinguished road
is there any other way to do this without renamong the file.
__________________
Quote:
When I was young it seemed that life was so wonderful,a miracle, oh it was beautiful, magical.
Now watch what you say or they'll be calling you a radical,a liberal, oh fanatical, criminal. Oh won't you sign up your name,we'd like to feel you're acceptable, respectable, oh presentable, a vegetable
kruptof is offline   Reply With Quote
Old Aug 28th, 2006, 7:44 PM   #5
Sane
Programming Guru
 
Sane's Avatar
 
Join Date: Apr 2005
Location: Waterloo, Ontario
Posts: 2,076
Rep Power: 6 Sane will become famous soon enough
Send a message via MSN to Sane
Apache is set to associate the php extention with the c:/php5/php.exe executable. That's what triggers it to be parsed in the php language. You'll have to set your server to use a different extention. May it be Apache, it should be fairly obvious from where you set it up when you were configuring the conf file.
Sane is online now   Reply With Quote
Old Aug 28th, 2006, 8:15 PM   #6
Jimbo
Battle Programmer
 
Jimbo's Avatar
 
Join Date: Feb 2006
Location: Bellevue, WA, USA
Posts: 770
Rep Power: 3 Jimbo is on a distinguished road
it's easiest to just name the file to .php. You can (as Sane mentioned) tell the webserver to parse different file types as PHP files (not sure if it's in httpd.conf or php.ini), but if you do that with, say, the .html extension, remember that any .html file will then be parsed by the PHP engine (more work for your server).
Jimbo is offline   Reply With Quote
Old Aug 28th, 2006, 8:16 PM   #7
Booooze
Expert Programmer
 
Booooze's Avatar
 
Join Date: Mar 2006
Location: Igloo
Posts: 710
Rep Power: 3 Booooze is on a distinguished road
Send a message via MSN to Booooze
You could do what sane says and change the extension, but why would you? Regardless, you have to point it at some extension, and by default, its *.php . You might as well leave it at that, it's kind of a given standard. Although some people do change it, perhaps for security reasons.
Booooze is offline   Reply With Quote
Old Aug 28th, 2006, 8:24 PM   #8
pal
Programmer
 
pal's Avatar
 
Join Date: Mar 2005
Location: Washington
Posts: 91
Rep Power: 4 pal is on a distinguished road
do you have the file named .php and
placed in the localhost folder?
here is a good php/mysql/apache package
you could download, it's quite neat.
www.appservnetwork.com
pal is offline   Reply With Quote
Old Aug 29th, 2006, 12:11 PM   #9
kruptof
Professional Programmer
 
kruptof's Avatar
 
Join Date: May 2006
Location: UK - London
Posts: 333
Rep Power: 3 kruptof is on a distinguished road
i will try what sane have said............the reason why i don't want to change the extension because i am scared then my site won't be search engine freindly......as i will use the embeding feature in quite alott of pages.

@pal: i will try that link.................currently i am using easyphp which is really neat.
__________________
Quote:
When I was young it seemed that life was so wonderful,a miracle, oh it was beautiful, magical.
Now watch what you say or they'll be calling you a radical,a liberal, oh fanatical, criminal. Oh won't you sign up your name,we'd like to feel you're acceptable, respectable, oh presentable, a vegetable
kruptof is offline   Reply With Quote
Old Aug 29th, 2006, 2:21 PM   #10
Mocker
Hobbyist Programmer
 
Mocker's Avatar
 
Join Date: Oct 2005
Location: Indiana
Posts: 224
Rep Power: 0 Mocker is an unknown quantity at this point
Send a message via AIM to Mocker
If your server is apache and has php running as a module, add this to your .htaccess
AddType application/x-httpd-php .html .php .htm

It should make all .html .php and .htm parse for php. But then, it will also cause more work for the server which was already stated. If php runs as cgi, then it is different.

As far as I know, .php files are not rated any differently than .html on search engines. They are both indexed the same way.
__________________
#programmingforums relay - http://thegupstudio.com/cgi-bin/pforelay.cgi
freelance scripts - http://ryanguthrie.com/index.html
Mocker is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Basics of HTML Tutorial crawforddavid2006 HTML / XHTML / CSS 14 Jul 11th, 2006 8:40 AM
Basic HTML Tutorial - Reuben Keeney ReubenK HTML / XHTML / CSS 14 Mar 26th, 2006 6:50 AM
HTML =/= Programming Sane Coder's Corner Lounge 32 Mar 8th, 2006 3:50 AM
Python Client for an HTML Server sabz Python 4 Aug 18th, 2005 8:49 AM
Want to upload, show as HTML and other things.... Invisible Other Web Development Languages 4 Jun 19th, 2005 8:51 PM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 11:57 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC