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.
Asked
Active
Viewed 113 times
0
-
1Try 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 Answers
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/');

Manjeet Sharma
- 174
- 2