1

Can you please help us to execute php in html file. As we are using Apache 2.4 , php-fpm on centos 6.9(64 Bit). We have used below code to execute php as html but I think it is not correct.

I have added below code in /opt/rh/httpd24/root/etc/httpd/conf/httpd.conf file:

# 2.4.10+ can proxy to unix socket # SetHandler "proxy:unix:/var/run/php5-fpm.sock|fcgi://localhost/"

# Else we can just use a tcp socket:
SetHandler "proxy:fcgi://127.0.0.1:9000"

# 2.4.10+ can proxy to unix socket # SetHandler "proxy:unix:/var/run/php5-fpm.sock|fcgi://localhost/"

# Else we can just use a tcp socket:
SetHandler "proxy:fcgi://127.0.0.1:9000"

Now I can execute php in htm file but every htm file render as php. So any body can help to resolve this issue.

We want to execute php in html file through handler.

1
  • Side note: Tried to clean up your code, but it appears you pasted the same code twice? Commented Jul 12, 2018 at 12:57

1 Answer 1

1

Take a look here: https://www.server-world.info/en/note?os=CentOS_6&p=httpd&f=25.

Replace the "AddHandler" with this:

AddHandler php-fastcgi .php .htm .html

This should solve your problem.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.