0

My apache runs php files with or without .php extension, How can I disable this and force apache to run php files only with .php extension. I don't want to use .htaccess, this might be an apache config. does anyone know how to disable this option?

2 Answers 2

1

Thanks for the answer but using Addtype as you mentioned did not ever work for me, all by itself, even in PHP 5..

Here's what I've tried that DOESN'T work with this version of PHP:

Options +ExecCGI

AddType application/x-httpd-php .php .nusuffix

AddHandler x-httpd-php5 .php .nusuffix

This worked for PHP 5. Now, does not.

This is for a hosted account, so I must do this via .haccess.

Sign up to request clarification or add additional context in comments.

Comments

0

You can check your httpd.conf what extensions are configured, it need need to be following. if there is change in your file you can change it to following and restart the apache

AddType application/x-httpd-php .php 

more details : https://wiki.archlinux.org/index.php/Apache_HTTP_Server

please add if anything is missing

4 Comments

:-| I want to disable this not make it more disturbing !
I need to stop apache to processing php files without .php extension
httpd.apache.org/docs/2.4/mod/mod_mime.html#addtype clearly says that addtype is for making extensions to have custom mime-types
check your httpd.conf file , and search for AddType application/x-httpd-php add Replace with AddType application/x-httpd-php .php it should work. check what is configured for you

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.