如何在Apache中将php文件显示为纯文本

mdt*_*thh 8 php apache

对于我本地Apache-Server上的某个文件夹(使用Ubuntu运行)我希望所有*php文件都显示为纯文本文件.我需要这个,因为我只想查看这些文件的源代码而不是运行它们.

在搜索时,我发现大多数人都有相反的问题:-)并且无法真正为我找到解决方案.

我需要包含在我的文件夹的.htacces文件中?

谢谢!

mdt*_*thh 13

答案:

在.htaccess文件类型中

php_flag engine off 
#This will prevent apache from executing *.php-files

AddType text/plain php
#this wil display php-files in browser (if not, browser will want to download file!)
Run Code Online (Sandbox Code Playgroud)

感谢Brad!