Ad Widget

Collapse

Broken frontend after upgrade to Ubuntu Bionic + Zabbix 4.0

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • JulioQc
    Junior Member
    • Dec 2018
    • 28

    #1

    Broken frontend after upgrade to Ubuntu Bionic + Zabbix 4.0

    Hi,


    After an upgrade from Ubuntu 16 to 18 and Zabbix 3.4.5 to 4.0 the frontend doesn't work anymore. I get this landing page each time I visit the URL:

    PHP Code:
      <?php /* ** Zabbix ** Copyright (C) 2001-2018 Zabbix SIA ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. **/   require_once dirname(__FILE__).'/include/classes/user/CWebUser.php'CWebUser::disableSessionCookie();  require_once dirname(__FILE__).'/include/config.inc.php'; require_once dirname(__FILE__).'/include/forms.inc.php';  $page['title'] = _('ZABBIX'); $page['file'] = 'index.php';  // VAR    TYPE    OPTIONAL    FLAGS    VALIDATION    EXCEPTION $fields = [     'name' =>        [T_ZBX_STR, O_NO,    null,    null,    'isset({enter}) && {enter} != "'.ZBX_GUEST_USER.'"', _('Username')],     'password' =>    [T_ZBX_STR, O_OPT, null,    null,    'isset({enter}) && {enter} != "'.ZBX_GUEST_USER.'"'],     'sessionid' =>    [T_ZBX_STR, O_OPT, null,    null,    null],     'reconnect' =>    [T_ZBX_INT, O_OPT, P_SYS,    null,    null],     'enter' =>        [T_ZBX_STR, O_OPT, P_SYS,    null,    null],     'autologin' =>    [T_ZBX_INT, O_OPT, null,    null,    null],     'request' =>    [T_ZBX_STR, O_OPT, null,    null,    null],     'form' =>        [T_ZBX_STR, O_OPT, null,    null,    null] ]; check_fields($fields);  if (hasRequest('reconnect') && CWebUser::isLoggedIn()) {     CWebUser::logout(); }  $config = select_config(); $autologin = hasRequest('enter') ? getRequest('autologin', 0) : getRequest('autologin', 1); $request = getRequest('request', '');  if ($request) {     $test_request = [];     preg_match('/^\/?(?<filename>[a-z0-9\_\.]+\.php)(?<request>\?.*)?$/i', $request, $test_request);      $request = (array_key_exists('filename', $test_request) && file_exists('./'.$test_request['filename']))         ? $test_request['filename'].(array_key_exists('request', $test_request) ? $test_request['request'] : '')         : ''; }  if (!hasRequest('form') && $config['http_auth_enabled'] == ZBX_AUTH_HTTP_ENABLED         && $config['http_login_form'] == ZBX_AUTH_FORM_HTTP && !hasRequest('enter')) {     redirect('index_http.php');      exit; }  // login via form if (hasRequest('enter') && CWebUser::login(getRequest('name', ZBX_GUEST_USER), getRequest('password', ''))) {     if (CWebUser::$data['autologin'] != $autologin) {         API::User()->update([             'userid' => CWebUser::$data['userid'],             'autologin' => $autologin         ]);     }      $redirect = array_filter([CWebUser::isGuest() ? '' : $request, CWebUser::$data['url'], ZBX_DEFAULT_URL]);     redirect(reset($redirect));      exit; }  if (CWebUser::isLoggedIn() && !CWebUser::isGuest()) {     redirect(CWebUser::$data['url'] ? CWebUser::$data['url'] : ZBX_DEFAULT_URL); }  $messages = clear_messages();  (new CView('general.login', [     'http_login_url' => $config['http_auth_enabled'] == ZBX_AUTH_HTTP_ENABLED         ? (new CUrl('index_http.php'))->setArgument('request', getRequest('request'))         : '',     'guest_login_url' => CWebUser::isGuestAllowed() ? (new CUrl())->setArgument('enter', ZBX_GUEST_USER) : '',     'autologin' => $autologin == 1,     'error' => hasRequest('enter') && $messages ? array_pop($messages) : null ]))->render();

    The MySQL DB is on a different machine, only server and frontend are installed. Server is working fine, only the frontend is not working.
    Note I did a complete purge of all apache & php package followed by a DPkg::Options::="--force-confmiss" install of zabbix frontend. Same issue persist.

    Any help in understanding this landing page would be appreciated.

    Thanks,

  • kmpm
    Junior Member
    • Dec 2018
    • 11

    #2
    Looks as if something is wrong with the apache+php configuration.
    I did the same upgrade a week ago but a new server+frontend and old postgres server without any issues. But I used the ubuntu packages.

    But yet again, since you see the
    <?php
    -tag it's most likely not interpreted by apache (or nginx) as php code at all.

    Comment

    • JulioQc
      Junior Member
      • Dec 2018
      • 28

      #3
      Yes, makes sense, but why?

      Comment

      • JulioQc
        Junior Member
        • Dec 2018
        • 28

        #4
        Followed this guide and got it working: https://websiteforstudents.com/how-t...4-18-04-18-10/

        Comment

        • ingus.vilnis
          Senior Member
          Zabbix Certified Trainer
          Zabbix Certified SpecialistZabbix Certified Professional
          • Mar 2014
          • 908

          #5
          I stopped reading that guide after this line: CREATE DATABASE zabbix;
          Congratulations in creating yourself a plethora of DB related errors in the future just because the database is not UTF8 and not with utf8_bin collation.

          Comment

          • dimir
            Zabbix developer
            • Apr 2011
            • 1080

            #6
            Creat catch, Ingus. I'll just post the link to correct database instructions: https://www.zabbix.com/documentation...all/db_scripts

            Comment

            • ingus.vilnis
              Senior Member
              Zabbix Certified Trainer
              Zabbix Certified SpecialistZabbix Certified Professional
              • Mar 2014
              • 908

              #7
              Cheers Dimir

              Yeah, that is unfortunately not the first online tutorial which actually has this incorrect command among other flaws.

              Comment

              • JulioQc
                Junior Member
                • Dec 2018
                • 28

                #8
                Sorry, should of specified the DB part was ignored in the tutorial since it already migrated(server+schema were successfully updated).
                Only the apache2/php setup was followed to solve the issue (step 1 and step 3). So probably some php module missing or misconfigured, also HTTPS stopped working so accessing the frontend that way was problematic.

                Comment

                • dimir
                  Zabbix developer
                  • Apr 2011
                  • 1080

                  #9
                  If you already have properly created database, indeed, just ignore the part about database. But in general, I'd recommend to use official Zabbix documentation and if something is missing/not working for you, report an issue.

                  Comment

                  • JulioQc
                    Junior Member
                    • Dec 2018
                    • 28

                    #10
                    oooh I went over and over the doc, both upgrade and install, to see what I missed and turned out useless for the issue I have here. That's what the internets (with some common sense) are for, no?

                    Comment

                    • dimir
                      Zabbix developer
                      • Apr 2011
                      • 1080

                      #11
                      Sure!
                      But that's weird, I mean, do we miss something from instructions here?

                      Comment

                      • JulioQc
                        Junior Member
                        • Dec 2018
                        • 28

                        #12
                        Well that's the install procedure. For a standalone server. But yes in that context it's fine.
                        I was using this doc instead: https://www.zabbix.com/documentation.../debian_ubuntu
                        I'd say it's probably missing some exhaustive list of mandatory PHP dependencies / configurations but that's just me; perhaps my initial 3.4 install was missing something or had something misconfigured which caused the issue during the upgrade.

                        Comment

                        Working...