PHP include in .HTML file not getting parsed

237 Views Asked by At

Migrated from Apache (Godaddy) to Nginx (DigitalOcean), the PHP code below in index.html does not work and as a result, the footer portion of the site disappeared. It works fine on the old server.

<? include("includes/copyright.php") ?>

Server details:

Ubuntu 20.04
PHP 7.14.15
Nginx 1.18.0

sudo systemctl list-units 'php*'

enter image description here

/etc/nginx/mysite.com.conf

enter image description here

1

There are 1 best solutions below

2
forloops On

in your nginx config, update line starting with location ~ \.php(/|$) { with:

location ~ \.(php|html|htm)$ {

then restart services. This will allow your html files to be parsed through php

If passing to fastcgi does not work, you can add a directive to your php-fpm config:

security.limit_extensions = .php .html