Forum Moderators: coopster

Message Too Old, No Replies

Parsing PHP Code in an HTML Page!

Any help will be appreciated! Thank you!

         

freetheflash

5:22 am on Jun 28, 2005 (gmt 0)

10+ Year Member



Hello. I am trying to run PHP code from an HTML file.

In my HTML file I have the following code:

<?php include("<counter/counter.php");?>

Now I have read several threads here on Webmaster World, and I have concluded that I need to create a ".htaccess" file, and place the following code in it:

AddType application/x-httpd-php .php .htm .html

But, once I have done this, every time I visit a page on my site, I get the Open/Save this file dialog. It seems like the server is telling my browser, to open all HTML files with the external application called "application/x-httpd-php".

So, adding that line to my .htaccess file ruins my entire website. I need to know what to do to allow PHP code to be parsed from an HTML file.

My webhost is GoDaddy.com, and I am using a Shared Server, so I do not have direct access to the "httpd.conf" file. In fact, when I log on through FTP, I don't even see a "Public_HTML" folder. I just see all my files from my site. I don't know if I need to call GoDaddy and ask to have them change my httpd.conf file, or if I should do something else. I have tried everything I can think of.

My Apache Server is version 1.3.31, and it is running PHP version 4.3.11.

Thanks in advance for any help. I appreciate it very much! Thank you!

dreamcatcher

7:49 am on Jun 28, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Does your server support mod_rewrite?

Try this thread for more info:
[webmasterworld.com...]

freetheflash

5:04 pm on Jun 28, 2005 (gmt 0)

10+ Year Member



I am not sure if my server supports mod_rewrite. I am going to call GoDaddy today. I will get back to you on that.

But I think mod_rewrite is supported, because my changes to the .htaccess file are causing changes to the way the code on my pages is being parsed. Unfortunately the changes are bad. I get the open/save diaolog when viewing an HTML page.

But because I could change the way code is parsed doesn't that mean that mod_rewrite is supported?

Anyango

7:01 pm on Jun 28, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hey There

I am not 100% sure but even then please do this:

What you are trying is good way to parse php in html files, i mean putting AddType code in .htaccess is good but you notice you are trying to put Two values of AddType in one line, Thats AddType , not AddTypes.

you already have the solution,, you just need to do remove your line from your htaccess and paste these,

AddType application/x-httpd-php .html
AddType application/x-httpd-php .htm

See you need to define them seperately.
Simple!
and i am pretty much sure that thats the reason for that file open save dialogue box.

Leme know if it helped.

Thanks
Kamran

freetheflash

5:39 pm on Jun 29, 2005 (gmt 0)

10+ Year Member



Unfortunately, I still get the file open/save dialouge in Internet Explorer, but not in Firefox. Weird.

Well, the whole reason I needed help was to implement a PHP web counter in an HTML page. But, I have found a javascript/cgi solution, that doesn't need PHP.

But thanks for all the help. I appreciated it.

Anyango

6:24 pm on Jun 29, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Great

Best of Luck

Have Fun

freetheflash

9:30 pm on Jun 29, 2005 (gmt 0)

10+ Year Member



Thanks for your help.

I appreciated it.