Hiding PHP extension

Hi,

Pls i’m having problems with hiding php file extensions.

Editing httpd conf file:
Using DefaultType application/x-httpd-php ,will not work.
Using ForceType application/x-httpd-php , will work work but not allow your image files (jpg, gif, png and swf ) to show, if you browse to the files directly from your browser.

Pls i’d like to know the best way to hide php in interworx, that will hide both php and leave all other things working.

thanks.

DefaultType should work. It worked for me. This is what I did:

  1. Open /etc/httpd/conf/httpd.conf

  2. Looked for the line:

DefaultType text/plain

and changed it to:

DefaultType application/x-httpd-php
  1. Restarted apache
service httpd restart
  1. Created a file with no extension in one of my webroots:
echo "<? phpinfo(); ?>" > /home/testcom/public_html/blankfile
  1. Browsed to test.com/blankfile and I saw the expected phpinfo() output.

Hope that helps,
Socheat

Socheat,

Thanks, but that didn’t help. If use
DefaultType application/x-httpd-php
when you right click on any image on your site, and choose to view image all you will see is a code. This will make some images to show ,whilel some won’t.

For example: the interworx logo on my home test page, looks like this, when right clicked and view is choosen:

GIF89a"

So i had to remove it.

Any other option?

That’s odd, I specifically tested viewing images directly, and they all loaded fine (jpgs, gifs, and pngs).

Perhaps serverman’s Apache install is missing its MIME magic file or configuration? Internet Explorer will guess at MIME types based on file extension if they are not supplied (in certian cases) which would explain why a lack of MIME type would let the image show propery (if IE is in use) but specifying a default type breaks the image.