Anthony Kong
Anthony Kong

Reputation: 40754

php include template failed on ubuntu+apache+php

If I ran my template locally, the template code can expand properly

<html>
<head>
<? include $template ?> 
</head>
  <body>
    <div id="chart_div"></div>
  </body>
</html>

However if I ran from an apache+php, it failed to expand.

enter image description here

I checked the error.log under /var/log/apache2 but cannot find any error message related to this template/php file.

On my local PC (OSX), php version is 5.5.20

On the apache, php version is:

$ 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)

Where should I start to investigate this problem?

I have zero exposure to php before.

Upvotes: 0

Views: 63

Answers (3)

Twisty
Twisty

Reputation: 30893

Most installs do not allow short tags, so you need <?php ?> for proper syntax.

Upvotes: 1

icecub
icecub

Reputation: 8773

You should change short_open_tag to 1 inside php.ini.

Upvotes: 1

Sam Teng Wong
Sam Teng Wong

Reputation: 2439

the syntax for your php short tags must contain equal sign after the opening php tag..

try this out <?=include $template; ?>

Upvotes: 1

Related Questions