Question

I have some code that's working on my server and when I put it up to a different server (both CentOS, Apache), the includeed file doesn't execute the code. So I get the following:

Main file

<div>
    <?php
    //This does include it, but as though it were text
    include( "/var/www/mypath/file.php" );
    ?>
</div>

File.php has the following code:

<div><? php echo $someString; ?></div>

Then the main file loads like this:

<div>
    <div><? php echo $someString; ?></div>
</div>

Why wouldn't the included file's code load?

Was it helpful?

Solution

You probably have short_open_tags off, so

<div><? php echo $someString; ?></div>
     ^^^^^^

with the space isn't recognized as an open tag. <?php would be, but you've got <?[space]php.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top