Welcome Guest, Not a member yet? Register   Sign In
I am getting <? for all instances of where I expect the PHP to be.

Hi All.

I recently took an already existing codeigniter site off my hosting provider to my localhost. I have correctly changed the database.php file (or at least I don't have any reported problems). I checked the Logs folder but there is only an index.html file there.

For instance the <title> I am getting from the page source looks like this

<title><?= $meta_title; ?></title>

It should of course render to
<title>A nice Page </title>

Even built in items such as
<?= base_url() ?>
are rendering as
<?= base_url() ?>resources/css/reset.css

I downloaded a fresh copy of codeigniter from the codeigniter site, and codeigniter works as expected, so something is amiss with the existing site I downloaded. Dose anyone have any ideas what causes the <? to render instead of the intended php code ?

Thanks a mill,


Check your application/config/config.php file.

$config['global_xss_filtering'] = TRUE;

If it's set to TRUE, that is the behavior. Try setting it to FALSE.

It is most likely a configuration issue of your webserver. Some configurations allow using
<?= $meta_title ?>

to automatically echo the succeeding variable, some environments require you to write

<?php echo $meta_title; ?>

Plus: Is your fileextension .php or anything else? If it's not .php it will not be parsed by the PHP interpreter thus the command <?= is unknown. However, you should not be having any other fileextension but .php when working with CI (except .htaccess)

There is a config setting for that regardless of whether the server supports php short tags (<? instead of <?php)
$config['rewrite_short_tags'] = TRUE;

Hi All,

It was the
$config['rewrite_short_tags'] = TRUE;
that was set as false. I changed it to true and it worked perfectly !. Thank you very much for all the help.

Theme © iAndrew 2016 - Forum software by © MyBB