Hugo
Hugo

Reputation: 145

PHP include in .HTML file not getting parsed

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

Upvotes: 0

Views: 248

Answers (1)

forloops
forloops

Reputation: 329

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 

Upvotes: 0

Related Questions