为什么我的 PHP 源代码显示? [英] Why is my PHP source code showing?
问题描述
因此,我在 http.conf 文件中添加了以下内容:
So, I added the following to my http.conf file:
Listen443
NameVirtualHost *:443
<VirtualHost *:443>
DocumentRoot /PATH_TO/www
ServerName www.domain.com
SSLEngine on
SSLCertificateFile /PATH_TO/domain.crt
SSLCertificateKeyFile /PATH_TO/domain.key
SSLCertificateChainFile /PATH_TO/intermediate.crt
</VirtualHost>
https://www.domain.com 现在可以使用,但它显示 PHP 源代码?这可能是什么原因?
https://www.domain.com works now, but it displays the PHP source code? What could be the reason for this?
推荐答案
服务器配置错误"是的原因;-)
"Server configuration error" is the reason ;-)
它选择将 PHP 文件作为纯内容"提供,而不是将它们交给 PHP 引擎进行处理.这与 SSL 没有任何关系(它会很高兴地通过安全连接发送纯内容").
It is choosing to serve PHP files as "plain content" instead of handing them to a PHP engine for processing. This doesn't have anything to do with SSL (it will just as happily send the "plain content" over a secure connection).
来自PHP:安装:
AddModule mod_php.c
LoadModule php_module modules/mod_php.so
LoadModule php5_module modules/libphp5.so
AddType application/x-httpd-php .php
来自 PHP 页面无法加载:
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
看到图案了吗?:-) 无论如何,请阅读特定平台/服务器的详细安装说明.
See a pattern? :-) In any case, read the fine installation instructions for the particular platform/server.
快乐编码.
这篇关于为什么我的 PHP 源代码显示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!