Apache2 no longer parses php scripts in html files
Members - Reputation: 810
Posted 04 August 2012 - 05:12 AM
Im a linux beginner. about a year ago I managed to set up a dedicated server to host my game servers and my website. Starting with a barebones centos instalation I had to install everything myself. I use apache2, oracle db, php and java for my game servers. The server has been running happely all these months without a restart. And of course noob as I am I dont have any startup scripts installed.
A week ago my oracle db dies! (or so I thought). Freaking out a bit becuase my game servers and highscore pages on my website stopped working I restarted my box for the first time. (Later I realised that the oracle db was infact fine and the problem was that the db user account that EVERYTHING was using password expired ^^). When i went to my website after the restart it gave me the "apache succussfully installed" default page. I saw on that page that for some reason the websites path on the harddrive has changed. It was /usr/local/apache2/htdocs but now after the restart its at /var/www/html. So to just went and copied everything from the old location to the new. My website worked again but php did not... It took me freaking forever to get apache+php+oracle db to play together nicely the first time so i wasnt very pleased . However after fidling abit more I saw that php pages ending with.php still worked but that apache was no longer parsing php scripts in html pages. Now i could not remember how I made apache parse html pages as php pages the first time but every site i googled states that i need to include either AddType application/x-httpd-php .html or AddHandler application/x-httpd-php .html in my .htacces. But this is not how got it to work the first time. Else those lines would stil be in my htacces file to begin with wich it is not. I have of course tried adding them in now but it doesnt work.
Is there any other way to get apache to parse html pages as if they were .php? Does things not working maybe have anything to do with my websites path changing? Anything else?
Thnx in Advance!
Crossbones+ - Reputation: 1923
Posted 04 August 2012 - 11:20 AM
Actually I'm not sure about that...
My first guess would also be AddHandler/AddType. Did you test it?
I think you rather added those directives to the httpd.conf for a certain directory instead of the .htaccess. That would explain why it isn't working anymore.
Edited by Madhed, 04 August 2012 - 11:28 AM.
Moderators - Reputation: 4359
Posted 04 August 2012 - 01:01 PM
If you want everything to be PHP no matter what, then you can use <Location /> with a SetHandler directive.
Members - Reputation: 137
Posted 04 August 2012 - 08:35 PM