0

If I host a PHP file on Apache, it will just be executed. I want clients to be able to download the PHP file without changing the .php extension. I don't want to disable PHP either.

René Höhle
  • 26,716
  • 22
  • 73
  • 82
user4757174
  • 416
  • 2
  • 4
  • 14
  • 1
    Try this using [.htaccess][1]. This should help you get the results you want. [1]: http://stackoverflow.com/a/18457702/1920638 – MrTechie Apr 07 '15 at 05:06

1 Answers1

2

if you don't want to play with apache configuration or .htaccess, then use PHP itself to get it done

create a file showcode.php with following code

echo file_get_contents('/path/to/your/php/file/having/viewable/code/for/users/');