Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

AddType Directive and PHP

Status
Not open for further replies.

robertx2

Technical User
May 3, 2002
8
US
The web host I'm working with has php/mysql, but currently the php module only parses php. I asked them to extend this in httpd.conf:

AddType application/x-httpd php .php .html .htm .shtml
AddType application/x-httpd-php-source .phps

They tell me that when they do this, html will not display in the browser, but instead the browser offers to download the page. I can't see their httpd.conf, of course, so don't know what to tell them.

If you have any suggestions, I would be very grateful.
Thank You!
 
Instead of asking 'why would I want this', the better question would be "why limit php?". But since you ask, search engine spiders won't index php files. The site I'm developing is an e-commerce site, and indexing of the pages is important.

As for a possible typo, I don't think so. Below are the exact lines from my own httpd.conf on my own server, and things work just fine -- it's merely a matter of uncommenting what's already in the default httpd.conf:

#AddType application/x-httpd-php3 .php3
#AddType application/x-httpd-php3-source .phps
#
# And for PHP 4.x, use:
#
AddType application/x-httpd-php .php .html .htm .shtml
AddType application/x-httpd-php-source .phps

I can't, of course, review the webhost's config files, but I'm certain that there's something simple they're overlooking, else why, when they uncomment the above lines, would a browser offer to download an html doc instead of displaying it?

Thanks,
RR
 
Wully: To my knowledge, no one's calling you a liar. I included the lines from my own httpd.conf, and they work, on my server. Period. If yours is different, great.

Please...just address the question I asked in the first place.
 
To my knowledge, no one said you are a liar. I included the exact lines from my own httpd.conf. It works on my server. If yours is different, great.

Please ... just address the question I asked in the first place. Thank You.
 
Hi mate,

From your first post.

AddType application/x-httpd php

From your second post.

AddType application/x-httpd-php

Notice the missing - in the first?? That was the typo..

The reason that I asked why you wanted to do this is because that gives me a better idea if a work around is possible.

I am on this forum to learn more and help myself as well, not just others!!

About the search engines, yahoo etc. DO search php pages.

The reason that php is restricted to certain files is so that every file on the server is not parsed for php which would result in the usage of a lot more system resources when they are not needed. If you inlcude php in one file and the rest do not have it, then the server still has to parse every single file for php. It is the same for SSI if that is enabled for every page..

If the host is going to do this then I would advise you to tell them only to do this on your domain as it will affect your domain if this is configured this way for the whole server.

Ask your host to give you full control over your htaccess files if you do not already have this, then try it yourself in a htaccess file.. There is nothing that I can help with if I can't see the code behind the problem..

Hope this helps Wullie

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top