a wierd problem, cant run php file with tag <? ?>

Discussion in 'PHP' started by shadow_boi, Dec 15, 2008.

  1. #1
    Hi guys.

    I have easyphp installed, php version is 5.27

    I usually program php file starting with this tag:

    <?php
    some codes here...
    ?>

    and my script can run with no problem.



    But I got a php file, it starts using the tag:
    <?
    some codes here
    ?>

    my server cannot render that php file. My broswer just simply output the php codes from that file.

    Do you know why it happens?

    I guess we can use both ways, right? <? and <?php
     
    shadow_boi, Dec 15, 2008 IP
  2. shadow_boi

    shadow_boi Peon

    Messages:
    374
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    oh, found the cause.
    short_open_tag needs to be on.
    XD
     
    shadow_boi, Dec 15, 2008 IP
  3. qualityfirst

    qualityfirst Peon

    Messages:
    147
    Likes Received:
    6
    Best Answers:
    1
    Trophy Points:
    0
    #3
    Yea, some severs will allow shorthand, others won't.

    Best to code with <?php and ?>
     
    qualityfirst, Dec 15, 2008 IP
  4. dprundle

    dprundle Peon

    Messages:
    399
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    0
    #4
    a good standard to follow is to use <?php for portability and reusability mate.
     
    dprundle, Dec 16, 2008 IP