Php code in HTML files


#1

Hi I created a static html site using easy engine.

The site is opening fine but there is php code

             <?php  $includeFile = file_get_contents("http://www.domain.com/cms/hospital.html");  echo $includeFile; ?>

It is not showing the content. allow_url_include = On and allow_url_fopen = On

My domain.conf

server {server_name domain.com www.domain.com;

access_log   /var/log/nginx/domain.com.access.log;
error_log    /var/log/nginx/domain.com.error.log;

root /var/www/domain.com/htdocs;
index index.html index.htm;

location / {
	try_files $uri $uri/ /index.html; 
}

include common/locations.conf;}

Any ideas?


#2

@wyamout

If you need php then create php websit.

ee site create php.com --php

Now you have to update your HTML website to PHP website using following command

ee site update example.com --php

#3

@miteshshah

Thank you but still not working its not parsing the php in the html file


#4

@wyamout

reload nginx service nginx reload

could you provide me output for ee site show example.com


#5
    server {server_name domain.com www.domain.com;

    access_log   /var/log/nginx/domain.com.access.log rt_cache;
    error_log    /var/log/nginx/domain.com.error.log;

    root /var/www/domain.com/htdocs;
    index index.html index.htm index.php;

    index index.php index.htm index.html;

    include common/php.conf;
    include common/locations.conf;}

#6

@wyamout

Try restart services:

ee stack restart 

Also monitor website logs

ee site log example.com

#7

Weird still not working I read around and some say should add something like this to the conf file but tried that not working

location ~ \.htm$ { 
    root           html;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.htm;
        include        fastcgi.conf;
}

#8

@wyamout, Have you tried any other PHP code? Can you check whether phpinfo works fine or not? Also make sure that your all file permissions are www-data:www-data


#9

Hello @wyamout

It’s been a long time, and we haven’t heard from you. It looks like your issue is resolved.

I am closing this support topic for now. Feel free to create a new support topic if you have any queries further. :slight_smile:


#10