|
想建个论坛,于是就安装了Discuz,运行后打开却是PHP原码, 开始以为是Apache配置有问题,但是我在Discuz的目录写了简单的PHP程序,却能执行。实际上,Discuz的PHP程序是被执行了,而且上传到网站上也是好的,所以只好看Discuz源码,最后发现
include template("discuz")
模板文件里的PHP不能执行,打开之后发现所有的模板文件里的PHP标记都是<?, 而一般都是<?php, 这个可以在PHP.ini里找到这个开关short_open_tag,最后问题终于解决了。
; Allow the <? tag. Otherwise, only <?php and <script> tags are recognized. ; NOTE: Using short tags should be avoided when developing applications or ; libraries that are meant for redistribution, or deployment on PHP ; servers which are not under your control, because short tags may not ; be supported on the target server. For portable, redistributable code, ; be sure not to use short tags. short_open_tag = On On 就是允许短标记, Off就是禁止短标记。
|