1

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?

1
  • Note that with short_open_tags on you can do : <?=$someString?> instead of the usual echo stuff. Commented Apr 28, 2014 at 3:12

1 Answer 1

4

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.