How to include PHP file on SHTML pages?

I have a shtml index.shtml file in which I want to include a PHP file that executes some program and returns HTML data. I am trying to include my PHP file, but I don’t know how to do it, I tried to follow, but nothing works,

The following line simply prints the error " [error processing this directive] ":

<!--#include file="/SSI/test.php"--> 

This line displays some unwanted characters:

<!--#include virtual="/SSI/test.php"--> 

This line does nothing and displays the command as is on the .shtml page

<?PHP 
    include("/SSI/test.php");
?>

thanks

+3
source share
4 answers

, .shtml, , , .htaccess:

<Files *.shtml>
ForceType application/x-httpd-php
</Files>

:

<Files filename.shtml>
ForceType application/x-httpd-php
</Files>

.shtml, .php, PHP , , include. .

+8

, , , include, php, , .

+1

, .shtml .php, , shtml, . , php.

: apache, .htacces, .php

 redirect permanent filename.shtml filename.php

, example.com/filename.shtml, example.com/filename.php

0

, Apache ( -). Apache , 'include_virtual' CGI; PHP CGI- Apache: -.

0

Source: https://habr.com/ru/post/1707937/


All Articles