Page 1 of 1
filename.php.html is parsing as PHP and I don't want it to
Posted: Tue Jun 24, 2008 7:29 pm
by RobertGonzalez
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.
Re: filename.php.html is parsing as PHP and I don't want it to
Posted: Tue Jun 24, 2008 7:41 pm
by Eran
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
Re: filename.php.html is parsing as PHP and I don't want it to
Posted: Tue Jun 24, 2008 8:00 pm
by RobertGonzalez
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.
Re: filename.php.html is parsing as PHP and I don't want it to
Posted: Tue Jun 24, 2008 8:14 pm
by Eran
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.
Re: filename.php.html is parsing as PHP and I don't want it to
Posted: Tue Jun 24, 2008 8:41 pm
by Benjamin
Turn off short tag support.
Re: filename.php.html is parsing as PHP and I don't want it to
Posted: Tue Jun 24, 2008 10:06 pm
by RobertGonzalez
I will sort this out tomorrow with the AddType declaration to test it.
@astions: short tags are off.
Re: filename.php.html is parsing as PHP and I don't want it to
Posted: Wed Jun 25, 2008 11:31 am
by RobertGonzalez
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.
Re: filename.php.html is parsing as PHP and I don't want it to
Posted: Wed Jun 25, 2008 11:34 am
by RobertGonzalez
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
Posted: Wed Jun 25, 2008 12:10 pm
by Benjamin
Everah wrote:This results in parse errors because of the opening <?xml in the file.
I don't understand how that could happen if short tags are off. <?xml != <?php
Re: filename.php.html is parsing as PHP and I don't want it to
Posted: Wed Jun 25, 2008 12:15 pm
by RobertGonzalez
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.

Re: filename.php.html is parsing as PHP and I don't want it to
Posted: Wed Jun 25, 2008 1:51 pm
by Benjamin
Hey at least it's fixed.
Re: filename.php.html is parsing as PHP and I don't want it to
Posted: Wed Jun 25, 2008 1:54 pm
by Kieran Huggins
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.
Re: filename.php.html is parsing as PHP and I don't want it to
Posted: Wed Jun 25, 2008 2:10 pm
by RobertGonzalez
Frick, that was funny Kieran. One of these days I hope to be that cool.
Re: filename.php.html is parsing as PHP and I don't want it to
Posted: Wed Jun 25, 2008 3:29 pm
by John Cartwright
Kieran for Governor++
Re: filename.php.html is parsing as PHP and I don't want it to
Posted: Wed Jun 25, 2008 3:42 pm
by RobertGonzalez
Jcart wrote:Kieran for Governor++
I would so vote for him.