|
PHP, HTML & .htaccess
|
Althius
#:1267650
| 7:57 pm on Aug. 10, 2004 (utc 0) |
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
#:1267651
| 8:22 pm on Aug. 10, 2004 (utc 0) |
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: http://www.webmasterworld.com/forum88/2466.htm http://www.webmasterworld.com/forum88/603.htm
|
Althius
#:1267652
| 9:16 pm on Aug. 10, 2004 (utc 0) |
So I checked this out: http://www.webmasterworld.com/forum88/603.htm (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
#:1267653
| 9:27 pm on Aug. 10, 2004 (utc 0) |
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
#:1267654
| 9:32 pm on Aug. 10, 2004 (utc 0) |
Sorry, yes I checked that and forgot to post the results. The <?php?> tags and all inbetween are still there.
|
Philosopher
#:1267655
| 9:41 pm on Aug. 10, 2004 (utc 0) |
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
#:1267656
| 9:56 pm on Aug. 10, 2004 (utc 0) |
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
#:1267657
| 10:05 pm on Aug. 10, 2004 (utc 0) |
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
#:1267658
| 10:24 pm on Aug. 10, 2004 (utc 0) |
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
#:1267659
| 4:56 am on Aug. 11, 2004 (utc 0) |
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
#:1267660
| 4:39 pm on Aug. 11, 2004 (utc 0) |
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!
|