如何在 Apache 中将 php 文件显示为纯文本 [英] How to show php-files as plain text in Apache

查看:27
本文介绍了如何在 Apache 中将 php 文件显示为纯文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

for a certain folder on my local Apache-Server (running with Ubuntu) I'd like that all *php-files will be displayed as if they were plain text-files. I need this since I only want to see the source code of these files and NOT run them.

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

While searching, I found that most people have the opposite problem :-) and couldn't really find a solution for me.

我需要在文件夹的 .htacces-file 中包含什么?

What would I need to include in the .htacces-file of my folder?

谢谢!

推荐答案

答案:

在 .htaccess 文件类型中

in .htaccess-file type

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!)

感谢布拉德!

这篇关于如何在 Apache 中将 php 文件显示为纯文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆