browser downloads php file from apache web server

后端 未结 3 663
隐瞒了意图╮
隐瞒了意图╮ 2021-01-17 23:43

I have an apache web server. Let\'s say this server\'s domain is example.com.

When I access example.com, then the index.php file is co

3条回答
  •  遇见更好的自我
    2021-01-18 00:20

    I've had a similar experience - some php files working OK, but others seem to have the raw php code downloaded.

    In my case, it was due to the broken files using the short tag format of . This is not recommended, and you may find the default php.ini has this support forced off. With support off, the php code is sent down to the browser as if it was HTML.

    If you can't avoid short tags (as in my case - a whole legacy codebase using short tags), then you can set it to be allowed in php.ini:

    short_open_tag = On
    

提交回复
热议问题