Pejman
Pejman

Reputation: 2636

Apache runs php files with or without .php extension

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?

Upvotes: 0

Views: 2850

Answers (2)

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.

Upvotes: 1

Mahesh Hegde
Mahesh Hegde

Reputation: 1209

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

Upvotes: 0

Related Questions