Ad Widget

Collapse

Problem with frontend 1.4.4

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • AndreyHammer
    Member
    • Nov 2007
    • 57

    #1

    Problem with frontend 1.4.4

    When I try to open frontend, I recieve this result:

    Parse error: syntax error, unexpected T_STATIC, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /var/www/zabbix.new/include/copt.lib.php on line 112
  • rickardp
    Junior Member
    • Dec 2004
    • 27

    #2
    Confirmed

    I too have this problem when I today upgraded from 1.4.3 to 1.4.4

    Comment

    • spage
      Junior Member
      • Jul 2007
      • 3

      #3
      work around

      I believe this a php4 problem. The frontend appears to work fine with php5 on my test box (CentOS 4.5 w/ php-5.1.6 from centosplus repo)

      I fixed it by coping the include/copt.lib.php from my 1.4.3 install.

      Comment

      • sterno
        Junior Member
        • Jan 2006
        • 24

        #4
        PHP4 doesn't like the "static" keyword for method declarations. It doesn't look like any of that code is needed unless you're trying to do profiling anyway.

        Comment

        • Aly
          ZABBIX developer
          • May 2007
          • 1126

          #5
          Thanks for report. Problem related only to PHP4. PHP5 users doesn't need it.

          Here is patch.
          Attached Files
          Last edited by Aly; 21-12-2007, 15:34.
          Zabbix | ex GUI developer

          Comment

          • skogan
            Member
            • Nov 2007
            • 70

            #6
            This patch is wrong - it actually REVERSES the necessary change.

            Here is the correct patch:

            Code:
            --- zabbix-1.4.4.orig/frontends/php/include/copt.lib.php        2007-12-17 13:19:04.000000000 +0000
            +++ zabbix-1.4.4/frontends/php/include/copt.lib.php     2007-12-20 22:17:21.000000000 +0000
            @@ -109,7 +109,7 @@
                    class COpt{
                            /* protected static $starttime[]=array(); */
            
            -               /* protected */ static function getmicrotime() {
            +               /* protected static */ function getmicrotime() {
                                    if(defined('USE_TIME_PROF')) {
                                            list($usec, $sec) = explode(' ',microtime());
                                            return ((float)$usec + (float)$sec);
            @@ -120,7 +120,7 @@
                            }
            
            
            -               /* public */ static function showmemoryusage($descr=null){
            +               /* public static */ function showmemoryusage($descr=null){
                                    if(defined('USE_MEM_PROF')) {
                                            $memory_usage = COpt::getmemoryusage();
                                            $memory_usage = $memory_usage.'b | '.($memory_usage>>10).'K | '.($memory_usage>>20).'M';
            @@ -128,7 +128,7 @@
                                    }
                            }
            
            -               /* protected */ static function getmemoryusage() {
            +               /* protected static */ function getmemoryusage() {
                                    if(defined('USE_MEM_PROF')) {
                                            return memory_get_usage('memory_limit');
                                    } else {
            @@ -136,7 +136,7 @@
                                    }
                            }
            
            -               /* public */ static function counter_up($type=NULL){
            +               /* public static */ function counter_up($type=NULL){
                                    if(defined('USE_COUNTER_PROF')){
                                            global $perf_counter;
                                            global $starttime;
            @@ -150,7 +150,7 @@
                                    }
                            }
            
            -               /* public */ static function profiling_start($type=NULL){
            +               /* public static */ function profiling_start($type=NULL){
                                    global $starttime;
                                    global $memorystamp;
                                    global $sqlmark;
            @@ -175,7 +175,7 @@
                                    }
                            }
            
            -               /* public */ static function savesqlrequest($sql){
            +               /* public static */ function savesqlrequest($sql){
                                    if(defined('USE_SQLREQUEST_PROF')){
                                            global $sqlrequests;
                                            if(defined('SHOW_SQLREQUEST_DETAILS')){
            @@ -187,7 +187,7 @@
                                    }
                            }
            
            -               /* public */ static function profiling_stop($type=NULL){
            +               /* public static */ function profiling_stop($type=NULL){
                                    global $starttime;
                                    global $memorystamp;
                                    global $sqlrequests;
            @@ -245,11 +245,11 @@
                            }
            
            
            -               /* public */ static function set_memory_limit($limit='8M'){
            +               /* public static */ function set_memory_limit($limit='8M'){
                                    ini_set('memory_limit',$limit);
                            }
            
            -               /* public */ static function compare_files_with_menu($menu=null){
            +               /* public static */ function compare_files_with_menu($menu=null){
                                    if(defined('USE_MENU_PROF')){
            
                                            $files_list = glob('*.php');

            Comment

            • drose12
              Junior Member
              • Apr 2007
              • 27

              #7
              Neither work for me:

              [root@appprd02 src]# patch -p0 < patch5198.patch
              patching file zabbix-1.4.4/frontends/php/include/copt.lib.php
              Hunk #1 FAILED at 109.
              Hunk #2 FAILED at 120.
              Hunk #3 FAILED at 128.
              Hunk #4 FAILED at 136.
              Hunk #5 FAILED at 150.
              Hunk #6 FAILED at 175.
              Hunk #7 FAILED at 187.
              patch unexpectedly ends in middle of line
              Hunk #8 FAILED at 245.
              8 out of 8 hunks FAILED -- saving rejects to file zabbix-1.4.4/frontends/php/include/copt.lib.php.rej

              Comment

              • mwegner
                Junior Member
                • Feb 2008
                • 1

                #8
                I had the exact same problem

                I'm on Solaris 10, running php 4.4.2, and had the exact same problem. The patch didn't work for me either - I got the same hunk error failures. I took a look at the patch, saw that it was replacing the string

                Code:
                /* protected */ static
                at the beginning of every function with the string

                Code:
                /* protected static */

                So I updated all of the function headers by hand in copt.lib.php, and now I'm not seeing that bug anymore. It looks to me like there is something wrong with the patch, but the fix does work.

                Mathias

                Comment

                • bisbell
                  Junior Member
                  • May 2008
                  • 14

                  #9
                  Here's my fix. Basically just a simple sed command that does what MWEGNER suggested above.

                  # sed '/\/\* p[a-z]* \*\/ static/s/*\/ static/static *\//' /opt/csw/apache2/share/htdocs/include/copt.lib.php > /tmp/copt.lib.php

                  # cp /tmp/copt.lib.php /opt/csw/apache2/share/htdocs/include/copt.lib.php

                  Comment

                  Working...