Running PHP files under differed file type suffix

Greetz pplz@ :) Let's say that I wanted to run a file through the PHP interpreter, but do not necessarily want to use file.PHP, but rather, let's say, file.PHPC. (For whatever reason!)

This worked on older version of PHP, but in newer implementations, unsure how to set up Apache for this. In the past, I could set a .htaccess file to make this work.

(Querying about PHP version 7.3.28, specifically. Thanks.)

Upvotes: 0

Views: 113

Answers (1)

Newish
Newish

Reputation: 92

This is a simple fix, you can add to you php.ini. Let's imagine we want to use the file extension .kev We could add

AddType application/x-httpd-php .kev

This will tell php that files with the .kev extention (eg: index.kev) should be run as PHP files.

See more in the very fine manual https://www.php.net/manual/en/security.hiding.php

Upvotes: 1

Related Questions