Ad Widget

Collapse

Frontend HTTP error 500

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • markfree
    Senior Member
    • Apr 2019
    • 868

    #1

    Frontend HTTP error 500

    I've set a new installation of Zabbix 5.4 from sources using:
    Code:
    ./configure --enable-server --enable-agent --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2 --with-openssl --with-ldap --with-ssh
    Initially everything went well. I was able to start the server with no errors.
    Then, I copied Zabbix UI to "/var/www/html".
    Code:
    cp -a ./ui /var/www/zabbix/
    When I tried to open Zabbix's frontend I got an "HTTP ERROR 500".

    Looking at "/var/log/httpd/error_log", it shows me the error bellow.
    Code:
    [Sun Nov 21 20:03:12.845099 2021] [:error] [pid 5938] [client 192.168.1.3:2511] PHP Parse error: syntax error, unexpected ':', expecting ';' or '{' in /var/www/html/zabbix/include/classes/user/CWebUser.php on line 48
    This error line points to this code excerpt:

    PHP Code:
    /**
    * Tries to login a user and populates self::$data on success.
    *
    * @param string $login user login
    * @param string $password user password
    *
    * @throws Exception if user cannot be logged in
    *
    * @return bool
    */
    public static function login(string $loginstring $password): bool {    /** << ACTUAL LINE 48*/
    try {
    self::$data API::User()->login([
    'username' => $login,
    'password' => $password,
    'userData' => true
    ]); 

    That's unusual to me.
    Any idea on what that is?
    Last edited by markfree; 22-11-2021, 03:34.
  • tim.mooney
    Senior Member
    • Dec 2012
    • 1427

    #2
    This is almost certainly a httpd configuration issue, probably relating to PHP.

    How are you processing PHP? mod_php7, or PHP-FPM?

    Show us the virtual host configuration, and if PHP is configured in a different file, show us the httpd config for PHP.

    You can obfuscate any sensitive hostnames or IP addresses, if you need.

    Also, have you verified that you have all the required PHP extensions loaded?

    Comment

    • Glencoe
      Zabbix developer
      • Oct 2019
      • 152

      #3
      Also, check your PHP version. It must be 7.2.5+.

      Comment

      • markfree
        Senior Member
        • Apr 2019
        • 868

        #4
        This is more of an experimental installation.

        Show us the virtual host configuration, and if PHP is configured in a different file, show us the httpd config for PHP.
        What virtual host configuration do you mean?

        I installed PHP 7.3 FPM.
        Code:
        # systemctl status rh-php73-php-fpm
        ● rh-php73-php-fpm.service - The PHP FastCGI Process Manager
        Loaded: loaded (/usr/lib/systemd/system/rh-php73-php-fpm.service; enabled; vendor preset: disabled)
        Active: active (running) since Mon 2021-11-22 10:22:14 -03; 10min ago
        Main PID: 32438 (php-fpm)
        Status: "Processes active: 0, idle: 5, Requests: 0, slow: 0, Traffic: 0req/sec"
        CGroup: /system.slice/rh-php73-php-fpm.service
        ├─32438 php-fpm: master process (/etc/opt/rh/rh-php73/php-fpm.conf)
        ├─32439 php-fpm: pool www
        ├─32440 php-fpm: pool www
        ├─32441 php-fpm: pool www
        ├─32442 php-fpm: pool www
        └─32443 php-fpm: pool www
        
        Nov 22 10:22:14 centos7 systemd[1]: Starting The PHP FastCGI Process Manager...
        Nov 22 10:22:14 centos7 systemd[1]: Started The PHP FastCGI Process Manager.
        Code:
        # grep -v "^\;" /etc/opt/rh/rh-php73/php-fpm.conf | grep .
        include=/etc/opt/rh/rh-php73/php-fpm.d/*.conf
        [global]
        pid = /var/opt/rh/rh-php73/run/php-fpm/php-fpm.pid
        error_log = /var/opt/rh/rh-php73/log/php-fpm/error.log
        daemonize = yes
        PHP configuration has has a zabbix rpmsave file from a previous package installation.
        Code:
        # ls -lah /etc/opt/rh/rh-php73/php-fpm.d/zabbix.conf.rpmsave
        -rw-r--r-- 1 root root 620 Nov 21 10:14 /etc/opt/rh/rh-php73/php-fpm.d/zabbix.conf.rpmsave
        This "zabbix.conf" file points to a "zabbix.sock" that does not exist.
        Code:
        # grep listen /etc/opt/rh/rh-php73/php-fpm.d/zabbix.conf.rpmsave
        listen = /var/opt/rh/rh-php73/run/php-fpm/zabbix.sock
        I'm not sure it is doing anything.

        Current modules are:
        Code:
        # php -m
        [PHP Modules]
        bcmath, bz2, calendar, Core, ctype, curl, date, dom, ereg, exif, fileinfo, filter, ftp, gd, gettext, gmp, hash, iconv, json, ldap, libxml, mbstring, mhash, mysql, mysqli, openssl, pcntl, pcre, PDO, pdo_mysql, pdo_sqlite, Phar, readline, Reflection, session, shmop, SimpleXML, sockets, SPL, sqlite3, standard, tokenizer, wddx, xml, xmlreader, xmlwriter, xsl, zip, zlib
        Last edited by markfree; 22-11-2021, 16:01.

        Comment


        • tim.mooney
          tim.mooney commented
          Editing a comment
          I'm sorry I wasn't clear. When I said "virtual host", I meant your web server virtual host, i.e your apache httpd configuration, especially the stuff inside the <Server> block.
      • markfree
        Senior Member
        • Apr 2019
        • 868

        #5
        I think I might have messed up this installation. I might have not updated PHP and its dependencies correctly. Also, Zabbix UI copy was probably misplaced.
        So I decided to start all over again.
        I created a fresh CentOS VM and started installation.

        This time, instead of installing centos-release-scl, I decided to install PHP 7.4 from Remi's repository.
        I followed this steps (not necessarily in this order).
        Code:
        yum install -y epel-release yum-utils
        
        rpm -Uvh https://dev.mysql.com/get/mysql80-community-release-el7-4.noarch.rpm
        yum install -y mysql-community-server
        yum -y upgrade
        systemctl start mysqld
        MYSQLTEMPPASS=`grep 'temporary password' /var/log/mysqld.log | awk '{print $13}'`
        mysql -uroot -p$MYSQLTEMPPASS
        # AJUSTED ROOT PASS AND CREATED ZABBIX DB, then
        mysql_secure_installation
        mysql -uzabbix -pzabbix zabbix < database/mysql/schema.sql
        mysql -uzabbix -pzabbix zabbix < database/mysql/images.sql
        mysql -uzabbix -pzabbix zabbix < database/mysql/data.sql
        
        
        yum install -y http://rpms.remirepo.net/enterprise/remi-release-7.rpm
        yum-config-manager --enable remi-php74
        yum install -y php php-opcache php-mcrypt php-gd php-curl php-mysqlnd php-bcmath php-mbstring php-xml php-ldap
        
        
        rh-php73-php-ldap
        yum install -y gcc gcc-c++ mysql-devel libxml2 libxml2-devel net-snmp net-snmp-utils net-snmp-devel libcurl libcurl-devel libssh2-devel openldap-devel libevent libevent-devel
        
        
        groupadd --system zabbix
        useradd --system -g zabbix -d /usr/lib/zabbix -s /sbin/nologin -c "Zabbix Monitoring System" zabbix
        
        ./configure --enable-server --enable-agent --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2 --with-openssl --with-ldap --with-ssh2
        make install
        
        
        mkdir /var/www/zabbix/
        cp -a ./ui/* /var/www/html/zabbix/
        systemctl enable httpd
        systemctl restart httpd
        
        sed -i 's|post_max_size = 8M|post_max_size = 16M|' /etc/php.ini
        sed -i 's|max_execution_time = 30|max_execution_time = 300|' /etc/php.ini
        sed -i 's|max_input_time = 60|max_input_time = 300|' /etc/php.ini
        
        
        firewall-cmd --zone=public --add-service=http --permanent
        sed -i 's|SELINUX=enforcing|SELINUX=disabled|' /etc/selinux/config
        reboot
        Oddly enough, after quite some work, the frontend's installation could not create the configuration file, but it was offered as a download.
        I then copied the new conf file to its "/var/www/html/zabbix/conf/", restarted HTTPD and everything started working.
        Finally!
        Last edited by markfree; 22-11-2021, 20:28.

        Comment


        • tim.mooney
          tim.mooney commented
          Editing a comment
          I'm surprised you were able to get Zabbix server 5.4 to build on CentOS 7 / RHEL 7. Server 5.4 isn't supported on RHEL 7 or CentOS 7, and it requires OpenSSL 1.1.1.
      • markfree
        Senior Member
        • Apr 2019
        • 868

        #6
        tim.mooney commented
        I'm surprised you were able to get Zabbix server 5.4 to build on CentOS 7 / RHEL 7. Server 5.4 isn't supported on RHEL 7 or CentOS 7, and it requires OpenSSL 1.1.1.

        It would be nice to have full support for Zabbix 5.4 or higher with CentOS 7 since it still has some years left of official support.

        I tried using packages recommended in documentation, but dependencies were not satisfied correctly.

        Anyhow, Zabbix configuration is great for instructing us on what it needs to work.
        With the documentation by my side, I managed to circumvent OS requirements, mainly PHP upgrade, and install Zabbix 5.4 from sources.
        Then, I pointed a previous 5.0 DB to the new installation and it updated correctly.

        Comment

        • reekjohns
          Junior Member
          • Nov 2019
          • 4

          #7
          The error is too generic and does not tell you exact problem. What you need is to find out what is the real issue. If your site is serving a Internal Server Error, this can be caused by a number of things, such as:
          • Server permission
          • Server timeout
          • Script timeout
          • Errors in .htaccess files
          • Exceeded PHP memory limit.
          • Or some other Web Server Issues

          Normally, a permissions issue on the file (or files) would be one cause of the 500 internal server error. The simple solution is to run chmod 644 on the problem file(s) or chmod 755 on the directories.

          HTML Code:
          $ sudo chmod -R 777 /"your files location"
          The best way to debug the error depends upon the server and what’s actually running at the time. Consider some debugging tips to help diagnose and fix common causes of this problem.

          Comment

          Working...