![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 | ||
|
Professional Programmer
Join Date: May 2006
Location: UK - London
Posts: 333
Rep Power: 3
![]() |
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:
__________________
Quote:
|
||
|
|
|
|
|
#2 |
|
Expert Programmer
|
Are you naming the files with the .php extension? Your code should work. Sloppy in my opinion, but should work:p
|
|
|
|
|
|
#3 |
|
Professional Programmer
Join Date: May 2005
Location: Woo - Boot Sector!
Posts: 294
Rep Power: 4
![]() |
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 |
|
|
|
|
|
#4 | |
|
Professional Programmer
Join Date: May 2006
Location: UK - London
Posts: 333
Rep Power: 3
![]() |
is there any other way to do this without renamong the file.
__________________
Quote:
|
|
|
|
|
|
|
#5 |
|
Programming Guru
![]() ![]() |
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.
|
|
|
|
|
|
#6 |
|
Battle Programmer
Join Date: Feb 2006
Location: Bellevue, WA, USA
Posts: 770
Rep Power: 3
![]() |
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).
|
|
|
|
|
|
#7 |
|
Expert Programmer
|
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.
|
|
|
|
|
|
#8 |
|
Programmer
Join Date: Mar 2005
Location: Washington
Posts: 91
Rep Power: 4
![]() |
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 |
|
|
|
|
|
#9 | |
|
Professional Programmer
Join Date: May 2006
Location: UK - London
Posts: 333
Rep Power: 3
![]() |
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:
|
|
|
|
|
|
|
#10 |
|
Hobbyist Programmer
|
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 |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
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 |