Apache is downloading php files instead of displaying them

后端 未结 26 1575
陌清茗
陌清茗 2020-11-22 01:03

OS and server information:

  • CentOS 6.4 (Final)
  • Apache 2.2.15
  • PHP 5.5.1

I previously had php 5.3.x installed but decided to upgr

26条回答
  •  孤城傲影
    2020-11-22 01:43

    I had a similar problem to the OP when upgrading php5 from an older version, to 5.5.9, which is the version installed with Mint 17.

    I'm running a LAMP setup on a machine on my local network, which I use to preview changes to websites before I upload those changes to the actual live server. So I maintain a perfect local mirror of the actual site.

    After the upgrade, files which run and display perfectly on the actual site would not display, or would only display html on the local machine. PHP was not parsed. The phpinfo() command worked, so I knew php was otherwise working. The log generated no errors. Viewing the page source showed me the actual php code.

    I had constructed a test.php page that contained the following code:

    This worked. Then I discovered when I changed to the command no longer worked. All my php sites use instead of which might not be ideal, but it's the reality. I fixed the problem by going to /etc/php5/apache2 , searching for "short_open_tag" and changing the value from Off to On.

提交回复
热议问题