1 year ago
#329829
MadHatter365
Cannot execute SSI with file_get_contents on Apache 2.4
I'm working with a very legacy project, made on PHP 5.4. We need to move it over a new server as is, but at the same time, upgrading the web server from apache 2.2 to 2.4, and the OS. SSI works fine on normal HTML files.
The problem itself is a core script that echoes the content of an HTML file using file_get_contents. For some reason, file_get_contents outputs the HTML file just fine, but it doesn't execute the SSI inside of it.
By any chance, would you know why it's not executing the SSI?
It works fine in Apache 2.2, but not in 2.4, and any other HTML files with SSI works fine. If I get the content of the HTML file, save it in an html file and then proceed browsing it, it's executed fine. It doesn't happen when echoing the output using file_get_contents
. Already tried with include()
, readfile()
, and even passthru()
with a bash command to cat
the file, but none of that works. It just prints the directives themselves.
I can't modify the project, because it's too legacy and quite big in size, so I cannot replace the SSI inside the files.
Thanks for your attention and support on this,
What have I tried:
- echo file_get_contents($html);
- readfile($html);
- include($html);
- passthru("cat " . $html);
- Putting the html code from $html and browsing it (this works)
What I expected:
- HTML page executing SSI
Actual result:
- HTML page without SSI (it shows the
<!--#include virtual="/misc-content.html"-->
directives in the HTML code)
php
apache
apache2.4
ssi
server-side-includes
0 Answers
Your Answer