Php commented out on ssl only


Php commented out on ssl only



I have centos 7 running php 5, and two vhosts.



One vhost works perfectly, rendering php as expected and everything is working.
The other vhost is not.



The problem is that php code is commenting out in one of them, although the file is .php NOT html.



Both have same configuration as I copied/pasted everything when first created them, here it is:


<Directory "/var/www/html/XX/public_html/">
DirectoryIndex index.html index.php
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
<FilesMatch ".+.ph(p[345]?|t|tml)$">
SetHandler None
</FilesMatch>

<IfModule mod_suphp.c>
suPHP_Engine on
<FilesMatch ".php[345]?$">
SetHandler x-httpd-suphp
</FilesMatch>
suPHP_AddHandler x-httpd-suphp
</IfModule>



I have checked SELINUX, it is disabled.



The only different is that the vhost which commenting php codes has a SSL certificate installed.



if you need more information to sort this problem, tell me.



Thanks in advance.



EDIT:



By Commented out, I mean:


<?php echo "something"; ?>



becomes:


<--!?php echo "something"; ?-->



when I view page source in the browser.





What do you mean by “commenting out?” Questions seeking debugging help (“why isn’t this code working?”) must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Complete, and Verifiable example.
– Ed Cottrell
Jul 2 at 13:52





@EdCottrell It took me half hour to re-write the question so it would be clear to understand, I did my best honestly. I have updated the question.
– Dohab
Jul 2 at 13:59






Your server is not processing your file as PHP. The comments aren’t “real;” they’re your browser’s attempt to handle what looks to it like an unknown HTML tag. I’m not sure this is an exact duplicate, but it’s relevant: stackoverflow.com/questions/15098940/…
– Ed Cottrell
Jul 2 at 14:15





it's not the same problem, my server can process php files in one virtualhost, but not the other one which runs over ssl. Never the less, I changed the file encoding, still not parsing php.
– Dohab
Jul 2 at 14:24




1 Answer
1



I don't know how, but adding this line to the php.conf (maybe httpd.conf for you), fixed the issue:


suPHP_Engine on
<FilesMatch ".+.ph(p[345]?|t|tml)$">
suPHP_AddHandler x-httpd-suphp
SetHandler x-httpd-suphp
</FilesMatch>



As I said, the problem was for one virtualhost which has a SSL.
Maybe the problem is in the virtualhost inside ssl.conf.






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

api-platform.com Unable to generate an IRI for the item of type

How to set up datasource with Spring for HikariCP?

Display dokan vendor name on Woocommerce single product pages