command-line php displays code instead of executing code

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

    command-line php displays code instead of executing code

    I am using CLI PHP to run a PHP script, c:\wamp\php\php .exe, but
    instead of executing my script, it's actually displaying the raw code
    instead.

    How can I run my code using CLI PHP? I installed WAMP5 on WinXP.


    Thanx
    Phil

  • Jerry Stuckle

    #2
    Re: command-line php displays code instead of executing code

    comp.lang.php wrote:
    I am using CLI PHP to run a PHP script, c:\wamp\php\php .exe, but
    instead of executing my script, it's actually displaying the raw code
    instead.
    >
    How can I run my code using CLI PHP? I installed WAMP5 on WinXP.
    >
    >
    Thanx
    Phil
    >
    php example.php

    Your code must be surrounded with <?php and ?>, just like in a web page.

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

    Comment

    • comp.lang.php

      #3
      Re: command-line php displays code instead of executing code



      On Jan 28, 1:58 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
      comp.lang.php wrote:
      I am using CLI PHP to run a PHP script, c:\wamp\php\php .exe, but
      instead of executing my script, it's actually displaying the raw code
      instead.
      >
      How can I run my code using CLI PHP? I installed WAMP5 on WinXP.
      >
      Thanx
      Phil
      php example.php
      >
      Your code must be surrounded with <?php and ?>, just like in a web page.
      install.php is indeed surrounded with PHP tags, just like in a web
      page. As I can see when I do "php -q install.php" and see the source
      code instead of the executions.

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

      Comment

      • Jerry Stuckle

        #4
        Re: command-line php displays code instead of executing code

        comp.lang.php wrote:
        >
        On Jan 28, 1:58 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
        >comp.lang.ph p wrote:
        >>I am using CLI PHP to run a PHP script, c:\wamp\php\php .exe, but
        >>instead of executing my script, it's actually displaying the raw code
        >>instead.
        >>How can I run my code using CLI PHP? I installed WAMP5 on WinXP.
        >>Thanx
        >>Phil
        >
        php example.php
        >Your code must be surrounded with <?php and ?>, just like in a web page.
        >
        install.php is indeed surrounded with PHP tags, just like in a web
        page. As I can see when I do "php -q install.php" and see the source
        code instead of the executions.
        >
        Phil
        >
        >--
        >============== ====
        >Remove the "x" from my email address
        >Jerry Stuckle
        >JDS Computer Training Corp.
        >jstuck...@attg lobal.net
        >============== ====
        >
        Then it should work. Or at least it does on every system I've used.

        But since you haven't posted the script or anything else about your
        installation, any answer is a guess.

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

        Comment

        • comp.lang.php

          #5
          Re: command-line php displays code instead of executing code



          On Jan 28, 2:56 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
          comp.lang.php wrote:
          >
          On Jan 28, 1:58 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
          comp.lang.php wrote:
          >I am using CLI PHP to run a PHP script, c:\wamp\php\php .exe, but
          >instead of executing my script, it's actually displaying the raw code
          >instead.
          >How can I run my code using CLI PHP? I installed WAMP5 on WinXP.
          >Thanx
          >Phil
          >
          php example.php
          Your code must be surrounded with <?php and ?>, just like in a web page.
          >
          install.php is indeed surrounded with PHP tags, just like in a web
          page. As I can see when I do "php -q install.php" and see the source
          code instead of the executions.
          >
          Phil
          >
          --
          =============== ===
          Remove the "x" from my email address
          Jerry Stuckle
          JDS Computer Training Corp.
          jstuck...@attgl obal.net
          =============== ===Then it should work. Or at least it does on every system I've used.
          >
          But since you haven't posted the script or anything else about your
          installation, any answer is a guess.

          I tried with a very simple one-liner script:

          <?php

          print_r("hello world");

          ?>

          And that is exactly what I see instead of "hello world"

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

          Comment

          • Paul Lautman

            #6
            Re: command-line php displays code instead of executing code

            comp.lang.php wrote:
            On Jan 28, 2:56 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
            >comp.lang.ph p wrote:
            >>
            >>On Jan 28, 1:58 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
            >>>comp.lang.ph p wrote:
            >>>>I am using CLI PHP to run a PHP script, c:\wamp\php\php .exe, but
            >>>>instead of executing my script, it's actually displaying the raw
            >>>>code instead.
            >>>>How can I run my code using CLI PHP? I installed WAMP5 on WinXP.
            >>>>Thanx
            >>>>Phil
            >>
            >>php example.php
            >>>Your code must be surrounded with <?php and ?>, just like in a web
            >>>page.
            >>
            >>install.php is indeed surrounded with PHP tags, just like in a web
            >>page. As I can see when I do "php -q install.php" and see the
            >>source code instead of the executions.
            >>
            >>Phil
            >>
            >>>--
            >>>============ ======
            >>>Remove the "x" from my email address
            >>>Jerry Stuckle
            >>>JDS Computer Training Corp.
            >>>jstuck...@at tglobal.net
            >>>============ ======Then it should work. Or at least it does on
            >>>every system I've used.
            >>
            >But since you haven't posted the script or anything else about your
            >installation , any answer is a guess.
            >
            >
            I tried with a very simple one-liner script:
            >
            <?php
            >
            print_r("hello world");
            >
            >>
            >
            And that is exactly what I see instead of "hello world"
            >
            Phil
            You said earlier that your code was "surrounded with PHP tags", but what you
            have posted has no ending tag.


            Comment

            • comp.lang.php

              #7
              Re: command-line php displays code instead of executing code



              On Jan 28, 3:18 pm, "Paul Lautman" <paul.laut...@b tinternet.com>
              wrote:
              comp.lang.php wrote:
              On Jan 28, 2:56 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
              comp.lang.php wrote:
              >
              >On Jan 28, 1:58 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
              >>comp.lang.p hp wrote:
              >>>I am using CLI PHP to run a PHP script, c:\wamp\php\php .exe, but
              >>>instead of executing my script, it's actually displaying the raw
              >>>code instead.
              >>>How can I run my code using CLI PHP? I installed WAMP5 on WinXP.
              >>>Thanx
              >>>Phil
              >
              >php example.php
              >>Your code must be surrounded with <?php and ?>, just like in a web
              >>page.
              >
              >install.php is indeed surrounded with PHP tags, just like in a web
              >page. As I can see when I do "php -q install.php" and see the
              >source code instead of the executions.
              >
              >Phil
              >
              >>--
              >>============= =====
              >>Remove the "x" from my email address
              >>Jerry Stuckle
              >>JDS Computer Training Corp.
              >>jstuck...@att global.net
              >>============= =====Then it should work. Or at least it does on
              >>every system I've used.
              >
              But since you haven't posted the script or anything else about your
              installation, any answer is a guess.
              >
              I tried with a very simple one-liner script:
              >
              <?php
              >
              print_r("hello world");
              >
              And that is exactly what I see instead of "hello world"
              >
              PhilYou said earlier that your code was "surrounded with PHP tags", but what you
              have posted has no ending tag.
              blah.php:

              <?php print_r("hello world"); ?>

              That is literally what I have. The end tag didn't paste onto this
              message thread for some wacko reason, however, it still prints out
              source code instead of "hello world"

              Comment

              • Jerry Stuckle

                #8
                Re: command-line php displays code instead of executing code

                comp.lang.php wrote:
                >
                On Jan 28, 2:56 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
                >comp.lang.ph p wrote:
                >>
                >>On Jan 28, 1:58 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
                >>>comp.lang.ph p wrote:
                >>>>I am using CLI PHP to run a PHP script, c:\wamp\php\php .exe, but
                >>>>instead of executing my script, it's actually displaying the raw code
                >>>>instead.
                >>>>How can I run my code using CLI PHP? I installed WAMP5 on WinXP.
                >>>>Thanx
                >>>>Phil
                >>php example.php
                >>>Your code must be surrounded with <?php and ?>, just like in a web page.
                >>install.php is indeed surrounded with PHP tags, just like in a web
                >>page. As I can see when I do "php -q install.php" and see the source
                >>code instead of the executions.
                >>Phil
                >>>--
                >>>============ ======
                >>>Remove the "x" from my email address
                >>>Jerry Stuckle
                >>>JDS Computer Training Corp.
                >>>jstuck...@at tglobal.net
                >>>============ ======Then it should work. Or at least it does on every system I've used.
                >But since you haven't posted the script or anything else about your
                >installation , any answer is a guess.
                >
                >
                I tried with a very simple one-liner script:
                >
                <?php
                >
                print_r("hello world");
                >
                ?>
                >
                And that is exactly what I see instead of "hello world"
                >
                Phil
                OK, and you are entering from a command line:

                php example.php

                -q shouldn't affect the execution of the program, but you should try
                leaving it off.

                Also, ensure you don't have ANY other file with the filename "php" - it
                could be php.exe, php.bat or php.com, for instance.

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

                Comment

                • Rik

                  #9
                  Re: command-line php displays code instead of executing code

                  Paul Lautman <paul.lautman@b tinternet.comwr ote:
                  ><?php
                  >>
                  > print_r("hello world");
                  >>
                  >>>
                  >>
                  >And that is exactly what I see instead of "hello world"
                  >>
                  >Phil
                  You said earlier that your code was "surrounded with PHP tags", but what
                  you
                  have posted has no ending tag.
                  Oh yes there was. Please do not trust Google Groups in this... It has the
                  tendancy to replace ?on the first line to a simple >

                  Unfortunately, I have no further insights for the OP.
                  --
                  Rik Wasmus

                  Comment

                  • comp.lang.php

                    #10
                    Re: command-line php displays code instead of executing code



                    On Jan 28, 3:34 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
                    comp.lang.php wrote:
                    >
                    On Jan 28, 2:56 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
                    comp.lang.php wrote:
                    >
                    >On Jan 28, 1:58 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
                    >>comp.lang.p hp wrote:
                    >>>I am using CLI PHP to run a PHP script, c:\wamp\php\php .exe, but
                    >>>instead of executing my script, it's actually displaying the raw code
                    >>>instead.
                    >>>How can I run my code using CLI PHP? I installed WAMP5 on WinXP.
                    >>>Thanx
                    >>>Phil
                    >php example.php
                    >>Your code must be surrounded with <?php and ?>, just like in a web page.
                    >install.php is indeed surrounded with PHP tags, just like in a web
                    >page. As I can see when I do "php -q install.php" and see the source
                    >code instead of the executions.
                    >Phil
                    >>--
                    >>============= =====
                    >>Remove the "x" from my email address
                    >>Jerry Stuckle
                    >>JDS Computer Training Corp.
                    >>jstuck...@att global.net
                    >>============= =====Then it should work. Or at least it does on every system I've used.
                    But since you haven't posted the script or anything else about your
                    installation, any answer is a guess.
                    >
                    I tried with a very simple one-liner script:
                    >
                    <?php
                    >
                    print_r("hello world");
                    >
                    ?>
                    >
                    And that is exactly what I see instead of "hello world"
                    >
                    PhilOK, and you are entering from a command line:
                    >
                    php example.php
                    >
                    -q shouldn't affect the execution of the program, but you should try
                    leaving it off.
                    >
                    Also, ensure you don't have ANY other file with the filename "php" - it
                    could be php.exe, php.bat or php.com, for instance.
                    Nope, all there is is php.exe, I checked
                    >
                    --
                    =============== ===
                    Remove the "x" from my email address
                    Jerry Stuckle
                    JDS Computer Training Corp.
                    jstuck...@attgl obal.net
                    =============== ===

                    Comment

                    • Jerry Stuckle

                      #11
                      Re: command-line php displays code instead of executing code

                      comp.lang.php wrote:
                      >
                      On Jan 28, 3:34 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
                      >comp.lang.ph p wrote:
                      >>
                      >>On Jan 28, 2:56 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
                      >>>comp.lang.ph p wrote:
                      >>>>On Jan 28, 1:58 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
                      >>>>>comp.lang. php wrote:
                      >>>>>>I am using CLI PHP to run a PHP script, c:\wamp\php\php .exe, but
                      >>>>>>instead of executing my script, it's actually displaying the raw code
                      >>>>>>instead .
                      >>>>>>How can I run my code using CLI PHP? I installed WAMP5 on WinXP.
                      >>>>>>Thanx
                      >>>>>>Phil
                      >>>>php example.php
                      >>>>>Your code must be surrounded with <?php and ?>, just like in a web page.
                      >>>>install.p hp is indeed surrounded with PHP tags, just like in a web
                      >>>>page. As I can see when I do "php -q install.php" and see the source
                      >>>>code instead of the executions.
                      >>>>Phil
                      >>>>>--
                      >>>>>========== ========
                      >>>>>Remove the "x" from my email address
                      >>>>>Jerry Stuckle
                      >>>>>JDS Computer Training Corp.
                      >>>>>jstuck...@ attglobal.net
                      >>>>>========== ========Then it should work. Or at least it does on every system I've used.
                      >>>But since you haven't posted the script or anything else about your
                      >>>installation , any answer is a guess.
                      >>I tried with a very simple one-liner script:
                      >><?php
                      >> print_r("hello world");
                      >>?>
                      >>And that is exactly what I see instead of "hello world"
                      >>PhilOK, and you are entering from a command line:
                      > php example.php
                      >>
                      >-q shouldn't affect the execution of the program, but you should try
                      >leaving it off.
                      >>
                      >Also, ensure you don't have ANY other file with the filename "php" - it
                      >could be php.exe, php.bat or php.com, for instance.
                      >
                      Nope, all there is is php.exe, I checked
                      >
                      >--
                      >============== ====
                      >Remove the "x" from my email address
                      >Jerry Stuckle
                      >JDS Computer Training Corp.
                      >jstuck...@attg lobal.net
                      >============== ====
                      >
                      Well, if everything is as you say, it should work. It does on every
                      system I've used.

                      Obviously there is something else going on, or something you're not
                      telling us - probably because you don't know - but there's something
                      different.

                      It does work.

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

                      Comment

                      • Curtis

                        #12
                        Re: command-line php displays code instead of executing code

                        On Sun, 28 Jan 2007 13:17:21 -0800, comp.lang.php
                        <phillip.s.powe ll@gmail.comwro te:
                        >
                        >
                        On Jan 28, 3:34 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
                        >comp.lang.ph p wrote:
                        >>
                        On Jan 28, 2:56 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
                        >comp.lang.ph p wrote:
                        >>
                        >>On Jan 28, 1:58 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
                        >>>comp.lang.ph p wrote:
                        >>>>I am using CLI PHP to run a PHP script, c:\wamp\php\php .exe, but
                        >>>>instead of executing my script, it's actually displaying the raw
                        >code
                        >>>>instead.
                        >>>>How can I run my code using CLI PHP? I installed WAMP5 on WinXP.
                        >>>>Thanx
                        >>>>Phil
                        >>php example.php
                        >>>Your code must be surrounded with <?php and ?>, just like in a web
                        >page.
                        >>install.php is indeed surrounded with PHP tags, just like in a web
                        >>page. As I can see when I do "php -q install.php" and see the
                        >source
                        >>code instead of the executions.
                        >>Phil
                        >>>--
                        >>>============ ======
                        >>>Remove the "x" from my email address
                        >>>Jerry Stuckle
                        >>>JDS Computer Training Corp.
                        >>>jstuck...@at tglobal.net
                        >>>============ ======Then it should work. Or at least it does on
                        >every system I've used.
                        >But since you haven't posted the script or anything else about your
                        >installation , any answer is a guess.
                        >>
                        I tried with a very simple one-liner script:
                        >>
                        <?php
                        >>
                        print_r("hello world");
                        >>
                        ?>
                        >>
                        And that is exactly what I see instead of "hello world"
                        >>
                        PhilOK, and you are entering from a command line:
                        >>
                        > php example.php
                        >>
                        >-q shouldn't affect the execution of the program, but you should try
                        >leaving it off.
                        >>
                        >Also, ensure you don't have ANY other file with the filename "php" - it
                        >could be php.exe, php.bat or php.com, for instance.
                        >
                        Nope, all there is is php.exe, I checked
                        >
                        >>
                        >--
                        >============== ====
                        >Remove the "x" from my email address
                        >Jerry Stuckle
                        >JDS Computer Training Corp.
                        >jstuck...@attg lobal.net
                        >============== ====
                        >
                        What version of PHP are you using? If you're using PHP 4, then you need to
                        use the php-cli.exe executable, rather than php.exe. Also, there is a CLI
                        related DLL that needs to be in the same directory.

                        Also, is your PHP installation running on a server? If so, do you have the
                        same problem?

                        --
                        Curtis

                        Comment

                        • comp.lang.php

                          #13
                          Re: command-line php displays code instead of executing code

                          On Jan 31, 9:35 pm, Curtis <dyers...@veriz on.netwrote:
                          On Sun, 28 Jan 2007 13:17:21 -0800, comp.lang.php
                          >
                          >
                          >
                          <phillip.s.pow. ..@gmail.comwro te:
                          >
                          On Jan 28, 3:34 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
                          comp.lang.php wrote:
                          >
                          On Jan 28, 2:56 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
                          comp.lang.php wrote:
                          >
                          >On Jan 28, 1:58 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
                          >>comp.lang.p hp wrote:
                          >>>I am using CLI PHP to run a PHP script, c:\wamp\php\php .exe, but
                          >>>instead of executing my script, it's actually displaying the raw
                          code
                          >>>instead.
                          >>>How can I run my code using CLI PHP? I installed WAMP5 on WinXP.
                          >>>Thanx
                          >>>Phil
                          >php example.php
                          >>Your code must be surrounded with <?php and ?>, just like in a web
                          page.
                          >install.php is indeed surrounded with PHP tags, just like in a web
                          >page. As I can see when I do "php -q install.php" and see the
                          source
                          >code instead of the executions.
                          >Phil
                          >>--
                          >>============= =====
                          >>Remove the "x" from my email address
                          >>Jerry Stuckle
                          >>JDS Computer Training Corp.
                          >>jstuck...@att global.net
                          >>============= =====Then it should work. Or at least it does on
                          every system I've used.
                          But since you haven't posted the script or anything else about your
                          installation, any answer is a guess.
                          >
                          I tried with a very simple one-liner script:
                          >
                          <?php
                          >
                          print_r("hello world");
                          >
                          ?>
                          >
                          And that is exactly what I see instead of "hello world"
                          >
                          PhilOK, and you are entering from a command line:
                          >
                          php example.php
                          >
                          -q shouldn't affect the execution of the program, but you should try
                          leaving it off.
                          >
                          Also, ensure you don't have ANY other file with the filename "php" - it
                          could be php.exe, php.bat or php.com, for instance.
                          >
                          Nope, all there is is php.exe, I checked
                          >
                          --
                          =============== ===
                          Remove the "x" from my email address
                          Jerry Stuckle
                          JDS Computer Training Corp.
                          jstuck...@attgl obal.net
                          =============== ===
                          >
                          What version of PHP are you using? If you're using PHP 4, then you need to
                          use the php-cli.exe executable, rather than php.exe. Also, there is a CLI
                          related DLL that needs to be in the same directory.
                          Sorry using PHP 5.2.0
                          >
                          Also, is your PHP installation running on a server? If so, do you have the
                          same problem?
                          I am using WAMP5, if that helps you any. I have to use this option to
                          get it to work:

                          php -d short_open_tag= on -q "/path/to/my.php"

                          Phil
                          >
                          --
                          Curtis

                          Comment

                          Working...