'<?' versus '<?php'

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • jerrygarciuh

    '<?' versus '<?php'

    Hi folks,

    I recently ran into a PHP5 install that rejects the idiom, <? // code ?
    and in fact renders that in the output that is sent to the browser.
    Yikes!

    The sysadmins could not say why this was but suggested it was a PHP5
    thing.

    So my question to you: is <?php going to become required? And if it
    is will we not be allowed to echo by the shorthand <?php=$foo? as we
    used to <?=$bar?? As that was broken too.

    Thanks for any advice,

    JG
  • Jerry Stuckle

    #2
    Re: '&lt;?' versus '&lt;?php'

    jerrygarciuh wrote:
    Hi folks,
    >
    I recently ran into a PHP5 install that rejects the idiom, <? // code ?
    >and in fact renders that in the output that is sent to the browser.
    Yikes!
    >
    The sysadmins could not say why this was but suggested it was a PHP5
    thing.
    >
    So my question to you: is <?php going to become required? And if it
    is will we not be allowed to echo by the shorthand <?php=$foo? as we
    used to <?=$bar?? As that was broken too.
    >
    Thanks for any advice,
    >
    JG
    >

    This is PHP short_open_tag setting in your php.ini file. In PHP5 it is
    set to off.

    Off is recommended because the short tag can cause problems with xml,
    which uses the same tags.

    It also means you can't use the <?= syntax.

    On Apache, you can override this in your .htaccess file, if the host
    allows it.

    --
    =============== ===
    Remove the "x" from my email address
    Jerry Stuckle
    JDS Computer Training Corp.
    jstucklex@attgl obal.net
    =============== ===

    Comment

    • Curtis

      #3
      Re: '&lt;?' versus '&lt;?php'

      jerrygarciuh wrote:
      Hi folks,
      >
      I recently ran into a PHP5 install that rejects the idiom, <? // code ?
      >and in fact renders that in the output that is sent to the browser.
      Yikes!
      >
      The sysadmins could not say why this was but suggested it was a PHP5
      thing.
      >
      So my question to you: is <?php going to become required? And if it
      is will we not be allowed to echo by the shorthand <?php=$foo? as we
      used to <?=$bar?? As that was broken too.
      >
      Thanks for any advice,
      >
      JG
      The short_open_tag option is a PHP configuration option in php.ini.
      It's not reliable or portable to rely upon the availability of short
      tags. The <?=$foo?synta x relies upon short tags.

      It's not a problem with PHP5, it just depends on how PHP is configured.
      --
      Curtis

      Comment

      • Hugh Oxford

        #4
        Re: '&lt;?' versus '&lt;?php'

        jerrygarciuh wrote:
        Hi folks,
        >
        I recently ran into a PHP5 install that rejects the idiom, <? // code ?
        >and in fact renders that in the output that is sent to the browser.
        Just use sed or awk to change all instances of "<?" to "<?php". You
        don't want short tags.

        Comment

        • FutureShock

          #5
          Re: '&lt;?' versus '&lt;?php'

          Jerry Stuckle wrote:
          jerrygarciuh wrote:
          >Hi folks,
          >>
          >I recently ran into a PHP5 install that rejects the idiom, <? // code ?
          >>and in fact renders that in the output that is sent to the browser.
          >Yikes!
          >>
          >The sysadmins could not say why this was but suggested it was a PHP5
          >thing.
          >>
          >So my question to you: is <?php going to become required? And if it
          >is will we not be allowed to echo by the shorthand <?php=$foo? as we
          >used to <?=$bar?? As that was broken too.
          >>
          >Thanks for any advice,
          >>
          >JG
          >>
          >
          >
          This is PHP short_open_tag setting in your php.ini file. In PHP5 it is
          set to off.
          >
          Off is recommended because the short tag can cause problems with xml,
          which uses the same tags.
          >
          It also means you can't use the <?= syntax.
          >
          On Apache, you can override this in your .htaccess file, if the host
          allows it.
          >
          I think what is really disturbing is he stated that his sysadmins did
          not know what the problem was.

          Scotty

          Comment

          • Curtis

            #6
            Re: '&lt;?' versus '&lt;?php'

            Hugh Oxford wrote:
            jerrygarciuh wrote:
            >Hi folks,
            >>
            >I recently ran into a PHP5 install that rejects the idiom, <? // code ?
            >>and in fact renders that in the output that is sent to the browser.
            >
            Just use sed or awk to change all instances of "<?" to "<?php". You
            don't want short tags.
            Don't forget about the <?=$foo?synta x, it's not as simple as just
            changing "<?" to "<?php". Something equivalent would be:

            <?php echo $foo; ?>
            --
            Curtis

            Comment

            • jerrygarciuh

              #7
              Re: '&lt;?' versus '&lt;?php'

              On Oct 23, 3:52 pm, Curtis <dye...@gmail.c omwrote:
              jerrygarciuh wrote:
              Hi folks,
              >
              I recently ran into a PHP5 install that rejects the idiom, <? // code ?
              and in fact renders that in the output that is sent to the browser.
              Yikes!
              >
              The sysadmins could not say why this was but suggested it was a PHP5
              thing.
              >
              So my question to you: is <?php going to become required? And if it
              is will we not be allowed to echo by the shorthand <?php=$foo? as we
              used to <?=$bar?? As that was broken too.
              >
              Thanks for any advice,
              >
              JG
              >
              The short_open_tag option is a PHP configuration option in php.ini.
              It's not reliable or portable to rely upon the availability of short
              tags. The <?=$foo?synta x relies upon short tags.
              >
              It's not a problem with PHP5, it just depends on how PHP is configured.
              --
              Curtis
              Thanks Curtis, I'll definitely bear this in mind going forward.

              JG

              Comment

              • jerrygarciuh

                #8
                Re: '&lt;?' versus '&lt;?php'

                On Oct 23, 4:31 pm, Hugh Oxford <ares...@fas.co mwrote:
                jerrygarciuh wrote:
                Hi folks,
                >
                I recently ran into a PHP5 install that rejects the idiom, <? // code ?
                and in fact renders that in the output that is sent to the browser.
                >
                Just use sed or awk to change all instances of "<?" to "<?php". You
                don't want short tags.
                Thanks for the reply. I used UltraEdit locally and re-upped.

                JG

                Comment

                • jerrygarciuh

                  #9
                  Re: '&lt;?' versus '&lt;?php'

                  On Oct 23, 3:42 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
                  jerrygarciuh wrote:
                  Hi folks,
                  >
                  I recently ran into a PHP5 install that rejects the idiom, <? // code ?
                  and in fact renders that in the output that is sent to the browser.
                  Yikes!
                  >
                  The sysadmins could not say why this was but suggested it was a PHP5
                  thing.
                  >
                  So my question to you: is <?php going to become required? And if it
                  is will we not be allowed to echo by the shorthand <?php=$foo? as we
                  used to <?=$bar?? As that was broken too.
                  >
                  Thanks for any advice,
                  >
                  JG
                  >
                  This is PHP short_open_tag setting in your php.ini file. In PHP5 it is
                  set to off.
                  >
                  Off is recommended because the short tag can cause problems with xml,
                  which uses the same tags.
                  >
                  It also means you can't use the <?= syntax.
                  >
                  On Apache, you can override this in your .htaccess file, if the host
                  allows it.
                  >
                  --
                  =============== ===
                  Remove the "x" from my email address
                  Jerry Stuckle
                  JDS Computer Training Corp.
                  jstuck...@attgl obal.net
                  =============== ===
                  Thanks Jerry! You are always the man with the answers in clphp! If
                  you find yourself in New Orleans I owe you some beers!

                  JG

                  Comment

                  • jerrygarciuh

                    #10
                    Re: '&lt;?' versus '&lt;?php'

                    On Oct 23, 7:17 pm, Curtis <dye...@gmail.c omwrote:
                    Hugh Oxford wrote:
                    jerrygarciuh wrote:
                    Hi folks,
                    >
                    I recently ran into a PHP5 install that rejects the idiom, <? // code ?
                    >and in fact renders that in the output that is sent to the browser.
                    >
                    Just use sed or awk to change all instances of "<?" to "<?php". You
                    don't want short tags.
                    >
                    Don't forget about the <?=$foo?synta x, it's not as simple as just
                    changing "<?" to "<?php". Something equivalent would be:
                    >
                    <?php echo $foo; ?>
                    --
                    Curtis
                    Thanks

                    Comment

                    • Jerry Stuckle

                      #11
                      Re: '&lt;?' versus '&lt;?php'

                      jerrygarciuh wrote:
                      On Oct 23, 3:42 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
                      >jerrygarciuh wrote:
                      >>Hi folks,
                      >>I recently ran into a PHP5 install that rejects the idiom, <? // code ?
                      >>>and in fact renders that in the output that is sent to the browser.
                      >>Yikes!
                      >>The sysadmins could not say why this was but suggested it was a PHP5
                      >>thing.
                      >>So my question to you: is <?php going to become required? And if it
                      >>is will we not be allowed to echo by the shorthand <?php=$foo? as we
                      >>used to <?=$bar?? As that was broken too.
                      >>Thanks for any advice,
                      >>JG
                      >This is PHP short_open_tag setting in your php.ini file. In PHP5 it is
                      >set to off.
                      >>
                      >Off is recommended because the short tag can cause problems with xml,
                      >which uses the same tags.
                      >>
                      >It also means you can't use the <?= syntax.
                      >>
                      >On Apache, you can override this in your .htaccess file, if the host
                      >allows it.
                      >>
                      >--
                      >============== ====
                      >Remove the "x" from my email address
                      >Jerry Stuckle
                      >JDS Computer Training Corp.
                      >jstuck...@attg lobal.net
                      >============== ====
                      >
                      Thanks Jerry! You are always the man with the answers in clphp! If
                      you find yourself in New Orleans I owe you some beers!
                      >
                      JG
                      >
                      Ah, yes, New Orleans. One of my favorite cities. Is Pat O'Brians back
                      in business after Katrina? :-)

                      --
                      =============== ===
                      Remove the "x" from my email address
                      Jerry Stuckle
                      JDS Computer Training Corp.
                      jstucklex@attgl obal.net
                      =============== ===

                      Comment

                      • lawrence k

                        #12
                        Re: '&lt;?' versus '&lt;?php'

                        On Oct 23, 6:49 pm, FutureShock <futuresho...@a tt.netwrote:
                        Jerry Stuckle wrote:
                        jerrygarciuh wrote:
                        Hi folks,
                        >
                        I recently ran into a PHP5 install that rejects the idiom, <? // code ?
                        >and in fact renders that in the output that is sent to the browser.
                        Yikes!
                        >
                        The sysadmins could not say why this was but suggested it was a PHP5
                        thing.
                        >
                        So my question to you: is <?php going to become required? And if it
                        is will we not be allowed to echo by the shorthand <?php=$foo? as we
                        used to <?=$bar?? As that was broken too.
                        >
                        Thanks for any advice,
                        >
                        JG
                        >
                        This is PHP short_open_tag setting in your php.ini file. In PHP5 it is
                        set to off.
                        >
                        Off is recommended because the short tag can cause problems with xml,
                        which uses the same tags.
                        >
                        It also means you can't use the <?= syntax.
                        >
                        On Apache, you can override this in your .htaccess file, if the host
                        allows it.
                        >
                        I think what is really disturbing is he stated that his sysadmins did
                        not know what the problem was.

                        I guess one could argue that this is a programming question, not a
                        sysadmin question. Though that is not a sysadmin I'd want on any of my
                        projects.

                        Comment

                        • jerrygarciuh

                          #13
                          Re: '&lt;?' versus '&lt;?php'

                          On Oct 23, 8:48 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
                          jerrygarciuh wrote:
                          On Oct 23, 3:42 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
                          jerrygarciuh wrote:
                          >Hi folks,
                          >I recently ran into a PHP5 install that rejects the idiom, <? // code ?
                          >>and in fact renders that in the output that is sent to the browser.
                          >Yikes!
                          >The sysadmins could not say why this was but suggested it was a PHP5
                          >thing.
                          >So my question to you: is <?php going to become required? And if it
                          >is will we not be allowed to echo by the shorthand <?php=$foo? as we
                          >used to <?=$bar?? As that was broken too.
                          >Thanks for any advice,
                          >JG
                          This is PHP short_open_tag setting in your php.ini file. In PHP5 it is
                          set to off.
                          >
                          Off is recommended because the short tag can cause problems with xml,
                          which uses the same tags.
                          >
                          It also means you can't use the <?= syntax.
                          >
                          On Apache, you can override this in your .htaccess file, if the host
                          allows it.
                          >
                          --
                          =============== ===
                          Remove the "x" from my email address
                          Jerry Stuckle
                          JDS Computer Training Corp.
                          jstuck...@attgl obal.net
                          =============== ===
                          >
                          Thanks Jerry! You are always the man with the answers in clphp! If
                          you find yourself in New Orleans I owe you some beers!
                          >
                          JG
                          >
                          Ah, yes, New Orleans. One of my favorite cities. Is Pat O'Brians back
                          in business after Katrina? :-)
                          >
                          --
                          =============== ===
                          Remove the "x" from my email address
                          Jerry Stuckle
                          JDS Computer Training Corp.
                          jstuck...@attgl obal.net
                          =============== ===
                          I don't think Pat O's was ever out of business! ;-)

                          Comment

                          • FutureShock

                            #14
                            Re: '&lt;?' versus '&lt;?php'

                            lawrence k wrote:
                            On Oct 23, 6:49 pm, FutureShock <futuresho...@a tt.netwrote:
                            >Jerry Stuckle wrote:
                            >>jerrygarciu h wrote:
                            >>>Hi folks,
                            >>>I recently ran into a PHP5 install that rejects the idiom, <? // code ?
                            >>>>and in fact renders that in the output that is sent to the browser.
                            >>>Yikes!
                            >>>The sysadmins could not say why this was but suggested it was a PHP5
                            >>>thing.
                            >>>So my question to you: is <?php going to become required? And if it
                            >>>is will we not be allowed to echo by the shorthand <?php=$foo? as we
                            >>>used to <?=$bar?? As that was broken too.
                            >>>Thanks for any advice,
                            >>>JG
                            >>This is PHP short_open_tag setting in your php.ini file. In PHP5 it is
                            >>set to off.
                            >>Off is recommended because the short tag can cause problems with xml,
                            >>which uses the same tags.
                            >>It also means you can't use the <?= syntax.
                            >>On Apache, you can override this in your .htaccess file, if the host
                            >>allows it.
                            >I think what is really disturbing is he stated that his sysadmins did
                            >not know what the problem was.
                            >
                            >
                            I guess one could argue that this is a programming question, not a
                            sysadmin question. Though that is not a sysadmin I'd want on any of my
                            projects.
                            >
                            Thats what I was thinking. But I suppose it happens.

                            Comment

                            • Curtis

                              #15
                              Re: '&lt;?' versus '&lt;?php'

                              lawrence k wrote:
                              On Oct 23, 6:49 pm, FutureShock <futuresho...@a tt.netwrote:
                              >Jerry Stuckle wrote:
                              >>jerrygarciu h wrote:
                              >>>Hi folks,
                              >>>I recently ran into a PHP5 install that rejects the idiom, <? // code ?
                              >>>>and in fact renders that in the output that is sent to the browser.
                              >>>Yikes!
                              >>>The sysadmins could not say why this was but suggested it was a PHP5
                              >>>thing.
                              >>>So my question to you: is <?php going to become required? And if it
                              >>>is will we not be allowed to echo by the shorthand <?php=$foo? as we
                              >>>used to <?=$bar?? As that was broken too.
                              >>>Thanks for any advice,
                              >>>JG
                              >>This is PHP short_open_tag setting in your php.ini file. In PHP5 it is
                              >>set to off.
                              >>Off is recommended because the short tag can cause problems with xml,
                              >>which uses the same tags.
                              >>It also means you can't use the <?= syntax.
                              >>On Apache, you can override this in your .htaccess file, if the host
                              >>allows it.
                              >I think what is really disturbing is he stated that his sysadmins did
                              >not know what the problem was.
                              >
                              >
                              I guess one could argue that this is a programming question, not a
                              sysadmin question. Though that is not a sysadmin I'd want on any of my
                              projects.
                              >
                              Although I have no sys admin experience, I would think any decent sys
                              admin should understand how to appropriately configure software on the
                              server(s) for which they are responsible. The apparent lack of
                              adeptness of the OP's sys admins does not bode well for future problems.

                              Also, it seems as if at least some minimal programming experience
                              overlaps, in that they should probably know how to write shell/batch
                              scripts. Perl is also popular among sys admins, from what I've read...
                              --
                              Curtis

                              Comment

                              Working...