PHP5 code doesnt work

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • raaman rai
    New Member
    • Oct 2007
    • 114

    #1

    PHP5 code doesnt work

    Hi guys, i installed WAMP Server 2 yesterday but i waz surprised to see that the following code doesnt work.

    [HTML]Today is <? print strftime("%m/%d/%Y"); ?>[/HTML]

    The output is just: Today is

    If i use the proper php tag i.e <?php ?> it works but what i feel is that php5 files do not have the <?php ?> style. So, whats the problem???
  • Markus
    Recognized Expert Expert
    • Jun 2007
    • 6092

    #2
    but what you feel is "php5 files do not have the <?php ?> style"?

    What? lol.

    If it works by using <?php ?> then use them. Simple.

    Comment

    • raaman rai
      New Member
      • Oct 2007
      • 114

      #3
      Yeah fren, u r right but since all the php5 files that we find today is without the standard php tags. I mean i have downloaded some of the popular files like the Login System with admin features from evolt.org and i m very eager to make it work in my system. but i have not been able to do it.

      i dont know how to do it. I just need s'body who can tell me how i sud go about.

      Comment

      • Markus
        Recognized Expert Expert
        • Jun 2007
        • 6092

        #4
        Have a look in your php_ini file.

        And switch short_tag_open to 'on'

        :)

        Comment

        • Atli
          Recognized Expert Expert
          • Nov 2006
          • 5062

          #5
          Hi.

          As Markus says, you can modify the short_tag_open directive to enable or disable the short_tags feature.

          In PHP5 this defaults to OFF, while PHP4 defaults to ON, which causes the problem you described.

          One of the reason why PHP5 defaults to OFF is that the <? ... ?> tags do not comply with the XHML standard. They are considered invalid syntax in a XHML document.

          I recommend designing all code using the <?php ... ?> tags rather than the <? ... ?> tags. That way it will be usable on all servers without any problems.

          Comment

          Working...