filename.php.html is parsing as PHP and I don't want it to
Moderator: General Moderators
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
filename.php.html is parsing as PHP and I don't want it to
I just ran a PHPDocumentor process on an application and the generated HTML pages are now made using an XML declaration at the top of the file. Not that this is that important, except for the fact that for some reason my local apache server wants to parse .php.html names files as PHP. This results in parse errors because of the opening <?xml in the file.
Does anyone know how I go about telling apache to just treat those files as HTML instead of parsing them as PHP?
I am not about to chance every file that is generated after every generation so I really need to handle this at the server level.
Does anyone know how I go about telling apache to just treat those files as HTML instead of parsing them as PHP?
I am not about to chance every file that is generated after every generation so I really need to handle this at the server level.
Re: filename.php.html is parsing as PHP and I don't want it to
In your apache configuration file (httpd.conf) you will find something similar to 'AddType application/x-httpd-php .php' under <IFModule mime_module>
You might try adding a line like: 'AddType text/html .php.html', though I fear it will only recognize the extension after the first dot.
Don't forget to restart your server after you save changes
You might try adding a line like: 'AddType text/html .php.html', though I fear it will only recognize the extension after the first dot.
Don't forget to restart your server after you save changes
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
Re: filename.php.html is parsing as PHP and I don't want it to
Here's the thing... I want .php,html files to be read as HTML. Right now they are read as PHP for some reason (and I cannot figure out why).
There is no AddType handler anywhere in my apache conf files that would tell it to do that.
There is no AddType handler anywhere in my apache conf files that would tell it to do that.
Re: filename.php.html is parsing as PHP and I don't want it to
Did you try adding the addtype handler i suggested? you might to read about it more here - http://httpd.apache.org/docs/2.0/mod/mo ... ml#addtype
Apparently it can be run from htaccess directly so you might want to set it up only for the directories that need it instead of inside the apache config.
Apparently it can be run from htaccess directly so you might want to set it up only for the directories that need it instead of inside the apache config.
Re: filename.php.html is parsing as PHP and I don't want it to
Turn off short tag support.
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
Re: filename.php.html is parsing as PHP and I don't want it to
I will sort this out tomorrow with the AddType declaration to test it.
@astions: short tags are off.
@astions: short tags are off.
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
Re: filename.php.html is parsing as PHP and I don't want it to
This has to do with mod_negotiation I believe. I am reading more, like how to turn it off, but for now, I think I found it.
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
Re: filename.php.html is parsing as PHP and I don't want it to
And for the record, adding the AddType line did not work.
Re: filename.php.html is parsing as PHP and I don't want it to
I don't understand how that could happen if short tags are off. <?xml != <?phpEverah wrote:This results in parse errors because of the opening <?xml in the file.
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
Re: filename.php.html is parsing as PHP and I don't want it to
Yeah, I'm an idiot.
I turned of Short Open Tags on all of my machines everywhere whenever I install PHP. But apparently I did not on this one. Thanks astions. That was totally n00bish of me.
It is fixed. And now I feel hella stupid.
I turned of Short Open Tags on all of my machines everywhere whenever I install PHP. But apparently I did not on this one. Thanks astions. That was totally n00bish of me.
It is fixed. And now I feel hella stupid.
Re: filename.php.html is parsing as PHP and I don't want it to
Hey at least it's fixed.
- Kieran Huggins
- DevNet Master
- Posts: 3635
- Joined: Wed Dec 06, 2006 4:14 pm
- Location: Toronto, Canada
- Contact:
Re: filename.php.html is parsing as PHP and I don't want it to
don't blame yourself!

They come at night with their electronic keyboards, messing with your config files.
Set traps, you'll find them in the morning.

They come at night with their electronic keyboards, messing with your config files.
Set traps, you'll find them in the morning.
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
Re: filename.php.html is parsing as PHP and I don't want it to
Frick, that was funny Kieran. One of these days I hope to be that cool.
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Re: filename.php.html is parsing as PHP and I don't want it to
Kieran for Governor++
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
Re: filename.php.html is parsing as PHP and I don't want it to
I would so vote for him.Jcart wrote:Kieran for Governor++