Forum Moderators: coopster

Message Too Old, No Replies

PHP, HTML & .htaccess

         

Althius

7:57 pm on Aug 10, 2004 (gmt 0)

10+ Year Member



Please forgive my ignorance. I've been trying to solve this problem for awhile, but to no avail. I've searched here, and many other places, but cannot find the solution.

I am trying to get the server to parse php in a .html document. I have tried adding the follow to my .htaccess file:

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

Both together and seperately. It just doesn't seem to work. I try to include php echo statements in the .html file but they do not print. I have HTML statements also, and they print fine.

When I add the 'AddType' instruction IE seems to be trying to download the file, because it 'doesn't recognize the format'. I have no idea why it would do that.

Maybe its something wacky with the server, or maybe my browser? I'm not experienced enough with this stuff to know *why* things are not working.

Thanks in advance.

timster

8:22 pm on Aug 10, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You'll want to find out whether the PHP is parsing at all or not. Just view the source of your Web page. If the PHP code is there, the server didn't parse it.

Your Web server may not be set up to listen to .htaccess files.

What is your Web server platform, and is this is your server or a shared host?

Here are 2 recent threads on this subject, which might help:

[webmasterworld.com ]

[webmasterworld.com ]

Althius

9:16 pm on Aug 10, 2004 (gmt 0)

10+ Year Member



So I checked this out:

[webmasterworld.com...]

(I must have read 20 php html threads, but missed that one)

It seems that perhaps I have the same problem as that fellow. This is all a little above my head, as I am decent with php, but all this .htaccess stuff is new to me.

How can I check to see if having SSI enabled is causing the problem I am having?

My .htaccess file is working BTW...

Philosopher

9:27 pm on Aug 10, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



as timster asked...is your server parsing it at all?

In other words, when you pull up the html page with the php code in it, is the code still there when you view the source code or is there nothing there at all?

Althius

9:32 pm on Aug 10, 2004 (gmt 0)

10+ Year Member



Sorry, yes I checked that and forgot to post the results.

The <?php?> tags and all inbetween are still there.

Philosopher

9:41 pm on Aug 10, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hmmm...just noticed something...

you said

I am trying to get the server to parse php in a .html document. I have tried adding the follow to my .htaccess file:

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

But it should be

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

notice the DASH between httpd and php instead of period.

Althius

9:56 pm on Aug 10, 2004 (gmt 0)

10+ Year Member



Nice catch, but sadly it did not make a difference.

Whenever I include the 'AddType' command in the .htaccess file anytime I try to access ANY file I get the:

'Some files can be harmful to your computer...' Open/Save/Cancel Warning.

Why is that happeneing? It makes my brain hurt.

Philosopher

10:05 pm on Aug 10, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Do you still have the addhandler command in the .htaccess file as well?

Most servers will work fine with just the AddType command but some require both due to their setups.

Your addhandler syntax was incorrect as well (had the period and not the dash). You may need.

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

Althius

10:24 pm on Aug 10, 2004 (gmt 0)

10+ Year Member



I've tried with one, and with both. All combinations.

I tried you fixes, and then all combinations. Still no dice. Seems to be doing to same thing...

I tried to contact the hosting service. Man are they aweful. Told me they don't offer support for quetions like that. "First-class" service my eye!

For future reference steer away from godaddy.com They are cheap as hell, and you get what you pay for.

Althius

4:56 am on Aug 11, 2004 (gmt 0)

10+ Year Member



Thanks for all the help, but I've abandoned my hosting service.

I foolishly paid for a year, now I'm going to have to dispute the charges.... wish me luck!

Philosopher

4:39 pm on Aug 11, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Wow...sorry to hear that. I would imagine you will have better luck with your next hosting provider.

I wish I could have been more help!