tags:

views:

18

answers:

3

I'm trying to set up my .htaccess file correctly and I'm having an issue.

The only thing my .htaccess file at the moment is:

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

This is included because my server is not parsing php in my html files.

However when this is included in my .htaccess file, when I open a page in my browser, the user is prompted to save or open the file locally.

I believe the answer to my issues is setting up an action to be done (run with php) however I cannot find out the path to my php files.

Any help is appreciated.

A: 

This is not supposed to work in all cases. It depends on the AllowOverride directive of the web server.

You shoud specify the AddType in the serveur config file rather than in the htaccess.

Aif
His `AddType` is working, otherwise the client wouldn't be receiving a content-type of `application/x-httpd-php` (which it cannot handle and therefore presents the download box). But anyway, he shouldn't be using `AddType`.
Artefacto
where have you read that the client receives a content type of application/x-httpd-php?
Aif
`when this is included in my .htaccess file, when I open a page in my browser, the user is prompted to save or open the file locally.` – it's the most likely explanation; the alternative being PHP is handling the request but sending another content type explicitly.
Artefacto
I have already add this issue, but the server prompted me to save the file, beeing the actual source. (so the addtype didn't work in my case).
Aif
A: 

You will need to edit the configuration for enabled modules. On a Debian/Ubuntu type system this will be in /etc/apache2/mods-enabled The file you are looking for is php5.conf

So far all you have done is specify that (dot) htm, html or php files should be served -by default- as application/x-httpd-php, and to my knowledge there is not a single web browser that would attempt to interpret such content -- hence the save-as dialog.

Either you could fix your .htaccess file not to be broken (it is broken behaviour to serve html files as application/x-httpd-php), or you could manually output the correct HTTP headers using the PHP header() function.

A: 

Unfortunately, everyone seems to love abusing AddType (and then complain e.g. that MultiViews is broken). See this article, please.

Artefacto
I laught. The gay says how people should configure their server, even pretending that php.net is wrong, but first of all, he explains how to configure a server under windows --> fail.
Aif
Artefacto
there was some sarcasm. sorry about that, let's say bad day. There are actually interesting things in this document.
Aif