PHP模板包括未能在Ubuntu的Apache + PHP +
问题描述:
如果我跑我的本地模板,模板代码可以展开适当PHP模板包括未能在Ubuntu的Apache + PHP +
<html>
<head>
<? include $template ?>
</head>
<body>
<div id="chart_div"></div>
</body>
</html>
但是,如果我从Apache + PHP跑,未能扩大。
我查了error.log中在/ var /日志/ Apache2的,但无法找到与此相关的模板/ PHP文件中的任何错误消息。
在我的本地PC(OSX),PHP版本5.5.20是
的Apache,PHP版本是:
$ dpkg -s php5
Package: php5
Status: install ok installed
Priority: optional
Section: php
Installed-Size: 29
Maintainer: Ubuntu Developers <[email protected]>
Architecture: all
Version: 5.5.9+dfsg-1ubuntu4.5
Depends: libapache2-mod-php5 (>= 5.5.9+dfsg-1ubuntu4.5) | libapache2-mod-php5filter (>= 5.5.9+dfsg-1ubuntu4.5) | php5-cgi (>= 5.5.9+dfsg-1ubuntu4.5) | php5-fpm (>= 5.5.9+dfsg-1ubuntu4.5), php5-common (>= 5.5.9+dfsg-1ubuntu4.5)
我应该在哪里开始调查这个问题?
我以前没有接触过php。
答
大多数安装不允许使用短标签,因此您需要<?php ?>
才能获得正确的语法。
答
的语法为PHP短标签必须包含开幕PHP标签之后等号..
尝试了这一点<?=include $template; ?>
+0
或者你可以做Twisty建议的''。 –
答
你应该改变short_open_tag
1内php.ini
。
可能是一个愚蠢的错误。你确定'php.ini'文件中的'short_open_tag'设置为1吗? – icecub
大多数安装不允许使用短标签,因此您需要''来获得正确的语法。 – Twisty
@Twisty你是对的。它解决了这个问题。请将您的评论转换为答案,以便我可以接受 –