0

How can I run php code in a .html file

Jolders 8 year бұрын updated by Alex Strij 7 year бұрын 3

Hi, I have looked for ages and have tried many configuration options to try and run php code in a .html file.

[^/]\.(php|html)(/|$) Regex Nginx

Each time I get either Access Denied in web page

or

in the log file a Denied access result.

(2016/07/04 22:18:23 [error] 4493#0: *1 FastCGI sent in stderr: "Access to the script '/var/www/html/php.html' has been denied (see security.limit_extensions)" while reading response header from upstream, client: 192.168.0.5, server: , request: "GET /php.html HTTP/1.1", upstream: "fastcgi://unix:/var/run/ajenti-v-php-fcgi-test-php-fcgi-0.sock:", host: "192.168.0.12")

I think the problem is passing a .html file to the php-fpm socket. I have added .html to security.limit_extensions in www.conf.

I really don't know what else to do. Can you point me in the right direction ?

Thanks

Jonathan

Just to add a note to the problem above relates to Ajenti V.


I have sucessfully managed to run php code in a .html file by installing php-fpm Nginx and not running them under Ajenti V.



Hi. Adding some findings to help anyone else with this issue which is work arround that works for me.


Install Ajenti

Configure Nginx to accept .html file = \.(php|html)$

Configure php5-fpm to accept .html file = security.limit_extensions = .php .html


Check all is working.

Install Ajenti-v and the configuration is passed over to the V install.

Activate Nginx in websites.

Cheers :-)