Apache shows PHP code instead of executing it

前端 未结 26 1473
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-11-22 02:23

I have recently been trying to install PHP and Apache on my computer. After many hours, they\'re installed. I have modified the httpd.conf and php.ini files like everyone sa

26条回答
  •  南笙
    南笙 (楼主)
    2020-11-22 03:19

    Posting what worked for me in case in helps someone down the road, though it is an unusual case.

    I had set a handler to force my web host to use a higher version of php than their default. There's was 5.1, but I wanted 5.6 so I had this:

    
        SetHandler php56-cgi
    
    

    in my .htaccess file.

    When trying to run my site locally, having that in there caused php code to be output to the browser. Removing it solved the problem.

提交回复
热议问题