enabling in php.ini?

Discussion in 'PHP' started by chrisj, Sep 27, 2007.

  1. #1
    Someone gave me this suggestion, but I don't know what it means.

    Can someone give me an idea of what this sentence means please?

    "also check your php config
    <? ?> php tags must be enabled in php ini file"

    then I was told "short tags must be enabled. Without it being enabled you can only use long tags: <?php ?>"


    In newbie terms please: How/where do I enable what exactly?

    thanks
     
    chrisj, Sep 27, 2007 IP
  2. andrew1810

    andrew1810 Peon

    Messages:
    13
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    In your PHP.ini file look for this:

    ; Allow the <? tag. Otherwise, only <?php and <script> tags are recognized.
    ; NOTE: Using short tags should be avoided when developing applications or
    ; libraries that are meant for redistribution, or deployment on PHP
    ; servers which are not under your control, because short tags may not
    ; be supported on the target server. For portable, redistributable code,
    ; be sure not to use short tags.
    short_open_tag = On

    Make sure that is set to On and isn't commented out

    If you don't know where the php ini is, create a php script and enter this code:

    
    <?php
    phpinfo()
    ?>
    
    PHP:
    Save it and load it in a browser, that will tell you the php.ini location
     
    andrew1810, Sep 27, 2007 IP
  3. chrisj

    chrisj Well-Known Member

    Messages:
    606
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    101
    #3
    thank you.........................
     
    chrisj, Sep 27, 2007 IP
  4. nabil_kadimi

    nabil_kadimi Well-Known Member

    Messages:
    1,065
    Likes Received:
    69
    Best Answers:
    0
    Trophy Points:
    195
    #4
    Wow wow wow

    Never use short open tags if you want to write portable code.

    <?php ?> and <script language="php"></script> will work everywhere whereas <? ?> and <% %> will not work unless you modify the (recommended) php.ini file.
     
    nabil_kadimi, Sep 27, 2007 IP
  5. krt

    krt Well-Known Member

    Messages:
    829
    Likes Received:
    38
    Best Answers:
    0
    Trophy Points:
    120
    #5
    Yes, get into a habit of using <?php and ?> instead of short tags.
     
    krt, Sep 27, 2007 IP