include php script inside HTML

后端 未结 5 1691
闹比i
闹比i 2020-12-09 14:19

I am a newbie and have never used PHP before. I want to execute PHP script from an HTML file on Linux. What do I need to do?

This is the content of my HTML file:

5条回答
  •  温柔的废话
    2020-12-09 14:36

    What output do you receive? Does it just show the PHP code?

    I assume that's the case.

    For a test, change the extension on the file to .php and run it again. Does it work now?

    If so, you will need to associate PHP with .html and .htm files on your server.

    EDIT

    This is the line you want to add to your Apache config:

    AddType application/x-httpd-php .html
    

提交回复
热议问题