简体   繁体   English

PHP文件正在下载,而不是通过ssl在浏览器中呈现

[英]php files being downloaded instead of rendered in browser over ssl

having an issue with my php/apache config. 我的php / apache配置有问题。 Files will render fine over http. 文件将通过http正常渲染。 Over https, however, files are prompted for download/saving. 但是,通过https会提示文件下载/保存。 Weird thing is that images are rendering over https. 奇怪的是,图像是通过https渲染的。

SSL Config tested as installed correctly on several sites. SSL Config已测试在多个站点上是否已正确安装。 Also, should be noted that this is in a plesk environment, but I am installing via shell access. 另外,应该注意,这是在整体环境中,但是我是通过shell访问来安装的。

Virtual Host section is below: 虚拟主机部分如下:

 AddType text/html .php 
 AddType application/x-httpd-php .php

   ErrorLog /etc/httpd/logs/smartsites_error_log

   CustomLog /etc/httpd/logs/smartsites_access_log common

ServerName secure.cognitionsmartsites.com

     <Directory "/var/www/vhosts/default/htdocs">
    Allow from all
            Options +Indexes
</Directory>

    IndexOptions
ServerAlias  secure.cognitionsmartsites.com

#UseCanonicalName Off
DocumentRoot /var/www/vhosts/default/htdocs

#ScriptAlias /cgi-bin/ "/var/www/vhosts/default/cgi-bin/"

SSLEngine On

#SSLVerifyClient none
#SSLCertificateFile /usr/local/psa/var/certificates/cert-L6E8a0

    SSLCertificateFile /usr/local/psa/var/certificates/cert.crt
    SSLCertificateKeyFile /usr/local/psa/var/certificates/private.key
    SSLCertificateChainFile /usr/local/psa/var/certificates/intermediate.crt

Change the AddType on line 2 to AddHandler . 将第2行的AddType更改为AddHandler This will tell php to process your .php files instead of just setting the mimetype like AddType does. 这将告诉php处理您的.php文件,而不仅仅是像AddType那样设置mimetype。

Also, make sure you are starting your php code with <?php and not just <? 另外,请确保您使用<?php而不只是<?开始您的php代码<? .

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM