PHP parser error only on production box

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

    #1

    PHP parser error only on production box

    Hi

    Here is my code snippet:

    <?php
    error_reporting (E_ERROR | E_PARSE);
    ?>
    <html>
    <body>
    <form action = "<?php$_SER VER['php_self']?>" method = "GET" >
    <?php
    echo "adasd";
    ?>
    </form>
    </body>
    </html>


    if you see form action of the above lines, semicolon wont be there and
    also the word 'echo'. If i execute this, it supposed to throw an
    parser error and script should get terminated at that point.

    It is happening in my production/staging environment but it not the
    case in development server.

    So I compared the error_reporting , display_html_er rors, etc values of
    both the environments and it is same interms of error level mechanism.


    Is there any constants in php.ini which tells php interpreter not able
    to produce parse error in my development server?

    Thx in advance

  • Janwillem Borleffs

    #2
    Re: PHP parser error only on production box

    Mani wrote:
    <form action = "<?php$_SER VER['php_self']?>" method = "GET" >
    >
    This will just throw a notice because the $_SERVER array doesn't contain a
    php_self key (only a PHP_SELF key). The semicolon is not mandatory in this
    case, because of the closing tag and the absence of trailing code. Not using
    echo or print, won't trigger alarms either...


    JW


    Comment

    • Mani

      #3
      Re: PHP parser error only on production box

      On Jun 21, 1:57 am, "Janwillem Borleffs" <j...@jwscripts .comwrote:
      Mani wrote:
      <form action = "<?php$_SER VER['php_self']?>" method = "GET" >
      >
      This will just throw a notice because the $_SERVER array doesn't contain a
      php_self key (only a PHP_SELF key). The semicolon is not mandatory in this
      case, because of the closing tag and the absence of trailing code. Not using
      echo or print, won't trigger alarms either...
      >
      JW

      I changed the key from php_self to PHP_SELF and executed the script in
      both environments. Like earlier, production box is throwing

      PHP Parse error: syntax error, unexpected T_VARIABLE in SCRIPTPATH on
      line 6

      and script execution is getting terminated whereas in local
      development environment, it is not throwing any error and notices.

      Following are the details of both environments.


      Local environment:

      1. SUSE LINUX 10.0 (i586)
      2. PHP 5.2.1 with Suhosin-Patch 0.9.6.2 (cli) (built: Apr 4 2007
      07:31:59)
      Copyright (c) 1997-2007 The PHP Group
      Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies

      php.ini error constants:

      error_reporting = E_ALL
      display_errors = Off
      ;html_errors = Off

      Production environment:

      1. SUSE LINUX 10.0 (i586)
      2. PHP 5.2.1 with Suhosin-Patch 0.9.6.2 (cli) (built: Apr 4 2007
      07:31:59)
      Copyright (c) 1997-2007 The PHP Group
      Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
      with Suhosin v0.9.18, Copyright (c) 2002-2006, by Hardened-PHP
      Project

      php.ini error constants:

      error_reporting = E_ALL
      display_errors = Off
      ;html_errors = Off



      I compared the both php.ini's and found no difference interms of error
      reporting perspective.

      I am just thinking, Is there any problem in php module ?

      Thanks








      Comment

      • Toby A Inkster

        #4
        Re: PHP parser error only on production box

        Mani wrote:
        Following are the details of both environments.
        Compare outputs of php_info() function in both environments. php.ini is
        one of many places where PHP settings can hide.

        --
        Toby A Inkster BSc (Hons) ARCS
        [Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
        [OS: Linux 2.6.12-12mdksmp, up 10:28.]

        dict, thes & ency

        Comment

        • Mani

          #5
          Re: PHP parser error only on production box

          I got the reason behind this strange behaviour. The short_open_tag
          value is "Off" in my production box, whereas it is "On" in development
          environment.



          Comment

          Working...