parse errors being surpressed

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

    #1

    parse errors being surpressed

    I have two servers that have had PHP installed on them and...

    <?php
    echo 'hello, world!
    ?>

    ....displays a parse error on server A and doesn't display anything on
    server B.

    Any ideas as to what the problem is?

  • flamer die.spam@hotmail.com

    #2
    Re: parse errors being surpressed


    yawnmoth wrote:
    I have two servers that have had PHP installed on them and...
    >
    <?php
    echo 'hello, world!
    ?>
    >
    ...displays a parse error on server A and doesn't display anything on
    server B.
    >
    Any ideas as to what the problem is?
    yes, you need have the echo line ending with a colon like so:

    echo "Sup world??";

    why does it work on one server and not the other.. well not sure off
    the top of my head but will be soemthing in the php.ini config. Do a
    phpinfo(); on each machine to compare.

    Flamer.

    Comment

    • Rik

      #3
      Re: parse errors being surpressed

      yawnmoth wrote:
      I have two servers that have had PHP installed on them and...
      >
      <?php
      echo 'hello, world!
      >>
      <?php
      echo 'hello, world!';
      ?>
      ...displays a parse error on server A and doesn't display anything on
      server B.
      Run:
      <?php
      ini_set('displa y_errors', 1);
      error_reporting (E_ALL);
      echo 'hello, world!
      ?>

      Grtz,
      --
      Rik Wasmus


      Comment

      • flamer die.spam@hotmail.com

        #4
        Re: parse errors being surpressed


        yawnmoth wrote:
        I have two servers that have had PHP installed on them and...
        >
        <?php
        echo 'hello, world!
        ?>
        >
        ...displays a parse error on server A and doesn't display anything on
        server B.
        >
        Any ideas as to what the problem is?
        Oh sorry, just read your question, thought you meant it worked on one
        and not the other now I see it doesnt work on either, yes it wont, use
        code as above, one php is set to output error to screen, the other, you
        will probably find a file in the dir the script is in called error.log
        and that will contain the error message there (which is a better option
        for production servers).

        Flamer.

        Comment

        • yawnmoth

          #5
          Re: parse errors being surpressed


          Rik wrote:
          yawnmoth wrote:
          <snip>
          >
          Run:
          <?php
          ini_set('displa y_errors', 1);
          error_reporting (E_ALL);
          echo 'hello, world!
          ?>
          That doesn't seem to help with parse errors (as evidenced by the fact
          that that script displays nothing, as well), but it did get me thinking
          that maybe I could try setting it in the .htaccess file.
          Unfortunately, it'd appear that I can't create .htaccess files on this
          server. I also tried dropping a php.ini file there with
          display_errors= 1 but that didn't help...

          Comment

          • Richard Levasseur

            #6
            Re: parse errors being surpressed


            flamer die.spam@hotmai l.com wrote:
            yawnmoth wrote:
            >
            I have two servers that have had PHP installed on them and...

            <?php
            echo 'hello, world!
            ?>

            ...displays a parse error on server A and doesn't display anything on
            server B.

            Any ideas as to what the problem is?
            >
            Oh sorry, just read your question, thought you meant it worked on one
            and not the other now I see it doesnt work on either, yes it wont, use
            code as above, one php is set to output error to screen, the other, you
            will probably find a file in the dir the script is in called error.log
            and that will contain the error message there (which is a better option
            for production servers).
            >
            Flamer.
            Errors are also logged to the apache log file, usually someplace in
            /var/log. if you're on a shared host or something, they usually
            provide a symlink or something to the logging directory.

            Comment

            • william.clarke

              #7
              Re: parse errors being surpressed

              As several others have noted, your code has errors in it.

              This code is giving parse errors because you are missing a quotation
              mark ( ' ) and a semi-colon to end the statement.

              <?php
              echo 'hello, world!
              ?>

              as posted by others try this instead:

              <?php
              echo 'hello, world!';
              ?>

              As for the errors messages, check each server's php.ini and see what
              level of error reporting each is setup for.

              Comment

              • yawnmoth

                #8
                Re: parse errors being surpressed


                william.clarke wrote:
                As several others have noted, your code has errors in it.
                >
                This code is giving parse errors because you are missing a quotation
                mark ( ' ) and a semi-colon to end the statement.
                >
                <?php
                echo 'hello, world!
                ?>
                >
                as posted by others try this instead:
                >
                <?php
                echo 'hello, world!';
                ?>
                When you're _trying_ to get parse errors, using syntactically correct
                code isn't such a great idea ;)

                Comment

                • william.clarke

                  #9
                  Re: parse errors being surpressed


                  yawnmoth wrote:
                  william.clarke wrote:
                  As several others have noted, your code has errors in it.

                  This code is giving parse errors because you are missing a quotation
                  mark ( ' ) and a semi-colon to end the statement.

                  <?php
                  echo 'hello, world!
                  ?>

                  as posted by others try this instead:

                  <?php
                  echo 'hello, world!';
                  ?>
                  When you're _trying_ to get parse errors, using syntactically correct
                  code isn't such a great idea ;)
                  Ah, I see. I don't habitually try to get parse errors...silly me, these
                  new trends in coding make me feel so old.

                  Comment

                  • yawnmoth

                    #10
                    Re: parse errors being surpressed


                    william.clarke wrote:
                    yawnmoth wrote:
                    <snip>
                    When you're _trying_ to get parse errors, using syntactically correct
                    code isn't such a great idea ;)
                    >
                    Ah, I see. I don't habitually try to get parse errors...silly me, these
                    new trends in coding make me feel so old.
                    If you're currious as to why I was trying to do this... I
                    recreationally write modifications to open source projects in PHP.
                    Someone had applied the changes that one of my modifications required
                    but found their site not to be working after the changes were made.
                    The problem, as it turned out, was that they replaced a } with a ), but
                    since their website didn't display syntax errors, it took me more time
                    to figure it out than it might have otherwise taken me.

                    Call it a new trend if you like. I wouldn't.

                    Comment

                    • william.clarke

                      #11
                      Re: parse errors being surpressed

                      yawnmoth wrote:
                      If you're currious as to why I was trying to do this... I
                      recreationally write modifications to open source projects in PHP.
                      Someone had applied the changes that one of my modifications required
                      but found their site not to be working after the changes were made.
                      The problem, as it turned out, was that they replaced a } with a ), but
                      since their website didn't display syntax errors, it took me more time
                      to figure it out than it might have otherwise taken me.
                      Ah, that makes sense, because I was thinking "why would code with parse
                      errors ever leave your development environment?", but now I can see how
                      it would happen :) That sort of thing occasionally happens where I
                      work too, but the fact totally broken code gets released still
                      surprises me. I hope you've managed to sort out all the newly
                      introduced parse errors now.

                      Comment

                      Working...