WAMP5, short tags and CLI PHP issue

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • comp.lang.php

    WAMP5, short tags and CLI PHP issue

    I installed WAMP5 on my WinXP box which works just fine on its own,
    and I found a practical way of handling my short-tag PHP script
    via .htaccess:

    php_flag short_open_tag on

    To ensure my literally hundreds of PHP scripts will all function
    within the WAMP5 architecture.

    However, there is a case of a series of installer scripts written in
    PHP that are not meant to be run except as CLI PHP that obviously will
    not benefit from .htaccess, furthermore, changing the CLI PHP scripts
    from short to long tags is very much not an option due to both the
    volume of scripts and code complexity as patterns of '<' . '?..' or
    "<" . "?.." or '<' . "?.." will exist within scripts alongside the
    dynamic generation of other PHP scripts by other CLI PHP scripts.

    Realizing that .htaccess is not usable for CLI PHP nor can I use
    ini_set(), and the business requirement of these scripts being fully
    portable installer scripts (tested so far successfully in Win XP/
    Apache 1.33/PHP 5.2.0, Win XP/Apache 2.0.53/PHP 4.3.9, WinXP/Apache
    2.0.53/PHP 5.0.4, Linux/Apache 2.0.54/PHP 4.3.9), what other last-
    minute portable tricks would you suggest (other than the obvious:
    changing php.ini, which I can't do on certain remote host services
    this app will reside in)?

    Phil

  • Erwin Moller

    #2
    Re: WAMP5, short tags and CLI PHP issue

    comp.lang.php wrote:
    I installed WAMP5 on my WinXP box which works just fine on its own,
    and I found a practical way of handling my short-tag PHP script
    via .htaccess:
    >
    php_flag short_open_tag on
    >
    To ensure my literally hundreds of PHP scripts will all function
    within the WAMP5 architecture.
    >
    However, there is a case of a series of installer scripts written in
    PHP that are not meant to be run except as CLI PHP that obviously will
    not benefit from .htaccess, furthermore, changing the CLI PHP scripts
    from short to long tags is very much not an option due to both the
    volume of scripts and code complexity as patterns of '<' . '?..' or
    "<" . "?.." or '<' . "?.." will exist within scripts alongside the
    dynamic generation of other PHP scripts by other CLI PHP scripts.
    >
    Realizing that .htaccess is not usable for CLI PHP nor can I use
    ini_set(), and the business requirement of these scripts being fully
    portable installer scripts (tested so far successfully in Win XP/
    Apache 1.33/PHP 5.2.0, Win XP/Apache 2.0.53/PHP 4.3.9, WinXP/Apache
    2.0.53/PHP 5.0.4, Linux/Apache 2.0.54/PHP 4.3.9), what other last-
    minute portable tricks would you suggest (other than the obvious:
    changing php.ini, which I can't do on certain remote host services
    this app will reside in)?
    >
    Phil
    Hi Phil,

    Are you using php-cgi.exe ?
    If so type:
    php-cgi.exe -h for help

    It lists amongst others the -d option.
    With this option you can tell PHP beforehand to set a certain value for
    anything that you might encounter in php.ini, like short_open_tags .

    If this does for you what you want, you only have to change the way you call
    php-cgi instead of changing all the scripts.

    Hope that helps.
    Good luck. (Migrations are always a pain.)

    Regards,
    Erwin Moller





    Comment

    • comp.lang.php

      #3
      Re: WAMP5, short tags and CLI PHP issue



      On Jan 29, 9:28 am, Erwin Moller
      <since_humans_r ead_this_I_am_s pammed_too_m... @spamyourself.c omwrote:
      comp.lang.php wrote:
      I installed WAMP5 on my WinXP box which works just fine on its own,
      and I found a practical way of handling my short-tag PHP script
      via .htaccess:
      >
      php_flag short_open_tag on
      >
      To ensure my literally hundreds of PHP scripts will all function
      within the WAMP5 architecture.
      >
      However, there is a case of a series of installer scripts written in
      PHP that are not meant to be run except as CLI PHP that obviously will
      not benefit from .htaccess, furthermore, changing the CLI PHP scripts
      from short to long tags is very much not an option due to both the
      volume of scripts and code complexity as patterns of '<' . '?..' or
      "<" . "?.." or '<' . "?.." will exist within scripts alongside the
      dynamic generation of other PHP scripts by other CLI PHP scripts.
      >
      Realizing that .htaccess is not usable for CLI PHP nor can I use
      ini_set(), and the business requirement of these scripts being fully
      portable installer scripts (tested so far successfully in Win XP/
      Apache 1.33/PHP 5.2.0, Win XP/Apache 2.0.53/PHP 4.3.9, WinXP/Apache
      2.0.53/PHP 5.0.4, Linux/Apache 2.0.54/PHP 4.3.9), what other last-
      minute portable tricks would you suggest (other than the obvious:
      changing php.ini, which I can't do on certain remote host services
      this app will reside in)?
      >
      PhilHi Phil,
      >
      Are you using php-cgi.exe ?
      If so type:
      php-cgi.exe -h for help
      >
      It lists amongst others the -d option.
      With this option you can tell PHP beforehand to set a certain value for
      anything that you might encounter in php.ini, like short_open_tags .
      >
      If this does for you what you want, you only have to change the way you call
      php-cgi instead of changing all the scripts.
      Thanx, however, I was unaware that I was using php-cgi.exe as I have
      been using what I thought was php.exe instead. Will have to see if
      that has the same "-d" option, would save a lot of time and effort
      were it to be so, thanx!

      Phil

      >
      Hope that helps.
      Good luck. (Migrations are always a pain.)
      >
      Regards,
      Erwin Moller

      Comment

      • Steve

        #4
        Re: WAMP5, short tags and CLI PHP issue


        "comp.lang. php" <phillip.s.powe ll@gmail.comwro te in message
        news:1170079350 .729027.92780@j 27g2000cwj.goog legroups.com...
        |I installed WAMP5 on my WinXP box which works just fine on its own,
        | and I found a practical way of handling my short-tag PHP script
        | via .htaccess:
        |
        | php_flag short_open_tag on
        |
        | To ensure my literally hundreds of PHP scripts will all function
        | within the WAMP5 architecture.
        |
        | However, there is a case of a series of installer scripts written in
        | PHP that are not meant to be run except as CLI PHP that obviously will
        | not benefit from .htaccess, furthermore, changing the CLI PHP scripts
        | from short to long tags is very much not an option due to both the
        | volume of scripts and code complexity as patterns of '<' . '?..' or
        | "<" . "?.." or '<' . "?.." will exist within scripts alongside the
        | dynamic generation of other PHP scripts by other CLI PHP scripts.

        volume is not important, nor is the pattern complex. you will either look
        for:

        <?

        or

        <?=

        i'd suggest making a script that recurses your directory structure that does
        a regex replace on all the files where that pattern matches. i'd have made a
        backup of all the files first, then after having done the replacements,
        attempt to install it on a test computer and bang on its functionality until
        you are satisfied everything is working properly.

        this is where foresight would have come in handy...althoug h i usually don't
        fuss to much about short-tagging as, like i have suggested, the fix is
        painfully easy.

        hth,

        me


        Comment

        • comp.lang.php

          #5
          Re: WAMP5, short tags and CLI PHP issue



          On Jan 29, 9:45 am, "Steve" <no....@example .comwrote:
          "comp.lang. php" <phillip.s.pow. ..@gmail.comwro te in messagenews:117 0079350.729027. 92780@j27g2000c wj.googlegroups .com...
          |I installed WAMP5 on my WinXP box which works just fine on its own,
          | and I found a practical way of handling my short-tag PHP script
          | via .htaccess:
          |
          | php_flag short_open_tag on
          |
          | To ensure my literally hundreds of PHP scripts will all function
          | within the WAMP5 architecture.
          |
          | However, there is a case of a series of installer scripts written in
          | PHP that are not meant to be run except as CLI PHP that obviously will
          | not benefit from .htaccess, furthermore, changing the CLI PHP scripts
          | from short to long tags is very much not an option due to both the
          | volume of scripts and code complexity as patterns of '<' . '?..' or
          | "<" . "?.." or '<' . "?.." will exist within scripts alongside the
          | dynamic generation of other PHP scripts by other CLI PHP scripts.
          >
          volume is not important, nor is the pattern complex. you will either look
          for:
          >
          <?
          >
          or
          >
          <?=
          [snip]

          Um, bad news, that's not all you're going to find in these installer
          scripts. You're also going to find lines like this:

          $php .= '<' . "?\n echo 'hello world'; ?" . '>';

          And

          if (preg_match('/<' . '\?/', $php)) // DO STUFF WITH $php CONTAINING
          PHP CODE

          Don't say I didn't warn you [re: "simplicity "]

          Comment

          • Kimmo Laine

            #6
            Re: WAMP5, short tags and CLI PHP issue

            "comp.lang. php" <phillip.s.powe ll@gmail.comwro te in message
            news:1170079350 .729027.92780@j 27g2000cwj.goog legroups.com...
            php_flag short_open_tag on
            and
            the business requirement of these scripts being fully
            portable installer scripts
            ....is just something you can't have. A set of scripts relying on short open
            tags is not *fully portable*.

            Sorry if this doesn't help you, but I just wanted to point out the obvious
            flaw in this situation.

            --
            "Ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" - lpk
            http://outolempi.net/ahdistus/ - Satunnaisesti päivittyvä nettisarjis
            spam@outolempi. net | rot13(xvzzb@bhg byrzcv.arg)


            Comment

            • Steve

              #7
              Re: WAMP5, short tags and CLI PHP issue


              "Kimmo Laine" <spam@outolempi .netwrote in message
              news:dvFvh.154$ wj7.21@reader1. news.saunalahti .fi...
              | "comp.lang. php" <phillip.s.powe ll@gmail.comwro te in message
              | news:1170079350 .729027.92780@j 27g2000cwj.goog legroups.com...
              | php_flag short_open_tag on
              |
              | and
              |
              | the business requirement of these scripts being fully
              | portable installer scripts
              |
              | ...is just something you can't have. A set of scripts relying on short
              open
              | tags is not *fully portable*.
              |
              | Sorry if this doesn't help you, but I just wanted to point out the obvious
              | flaw in this situation.

              and your obvious lack of reading comprehension skills. he was *describing*
              the obvious and how to resolve the short tag problem. you also missed where
              he said 'php_flag short_open_tag on' doesn't solve it on all servers...thus,
              still not fully portable. if it were, then YES, it would be fully
              portable...and it would be something he *COULD* have.

              as it is, you only agree with the op that there is a problem. if you cannot
              provide a solution, why waste everyone's time. 'captain, there's a hole in
              the hull. yes scrub, there is.' a lot of good that does.

              moron


              Comment

              • comp.lang.php

                #8
                Re: WAMP5, short tags and CLI PHP issue

                On Jan 30, 5:56 am, "Kimmo Laine" <s...@outolempi .netwrote:
                "comp.lang. php" <phillip.s.pow. ..@gmail.comwro te in message
                >
                news:1170079350 .729027.92780@j 27g2000cwj.goog legroups.com...
                >
                php_flag short_open_tag on
                >
                and
                >
                the business requirement of these scripts being fully
                portable installer scripts
                >
                ...is just something you can't have. A set of scripts relying on short open
                tags is not *fully portable*.
                >
                Sorry if this doesn't help you, but I just wanted to point out the obvious
                flaw in this situation.
                That can easily be overcome by this:

                php -d short_open_tag= on -q /path/to/your/file.php

                Kiitos!
                >
                --
                "Ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" - lpkhttp://outolempi.net/ahdistus/- Satunnaisesti päivittyvä nettisarjis
                s...@outolempi. net | rot13(x...@bhgb yrzcv.arg)

                Comment

                • DD

                  #9
                  Re: WAMP5, how did youget it to work



                  On 29 Jan 2007 06:02:30 -0800, "comp.lang. php"
                  <phillip.s.powe ll@gmail.comwro te:
                  >I installed WAMP5 on my WinXP box which works just fine on its own,
                  >and I found a practical way of handling my short-tag PHP script
                  >via .htaccess:
                  >


                  I've installed wamp 5 1.6.6. on winXP
                  for a testserver for learning php/mysql

                  it appears to be running
                  from the icon

                  I know that PHP is because localhost pops a page but

                  I get:

                  MySQL version :MySQL not launched or bad phpmyadmin config

                  Also:


                  from http://localhost/phpmyadmin/ i get a page with this error:

                  Welcome to phpMyAdmin 2.9.0.3

                  Error
                  MySQL said:

                  #2003 - The server is not responding

                  Anybod know how to get his up



                  Comment

                  Working...