如何防止浏览器显示php代码? [英] How to prevent browser from displaying php code?

查看:425
本文介绍了如何防止浏览器显示php代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我访问 http://mysite.com/script.php。必须有办法防止它!

The browser shows php source code if I go to http://mysite.com/script.php. There must be a way to prevent it!

UPD:嗯这个问题不正确。发生什么是当error_reporting(E_ALL)打开时,我可以看到一些错误。在firefox上,我可以点击发生错误的脚本的链接。然后firefox显示源代码!我不想要它发生。我不需要它。

UPD: Well. The question is not correct. What happens is that when error_reporting(E_ALL) is on I can see some errors. On firefox I can click on a link of a script where the error occures. Then firefox show the source code! I do not want it happen. I do not need it.

UPD2:将敏感数据的文件放在公共目录之上。是非常好的建议,thanx。我会使用它。

UPD2: To place file with sensitive data above public dir. is very good advice, thanx. I'll use it.

推荐答案

这意味着您的服务器未配置为使用* .php文件扩展名解释文件。您确定在服务器上正确安装和配置PHP?

This means your server is not configured to interpret files with the *.php file extension. Are you sure that PHP is installed and configured properly on your server?

如果您确定安装了PHP,请检查您的 httpd.conf 。它应该包含一个类似于下面的行。

If you're certain PHP is installed, check your httpd.conf. It should contain a line similar to the one below.

AddType application/x-httpd-php .php .phtml

这篇关于如何防止浏览器显示php代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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