Error 500 after some updates on Ubuntu 18.04

Discussion in 'Installation/Configuration' started by labsy, Aug 1, 2024.

Tags:
  1. labsy

    labsy Member

    Hi,
    I've probably hit some PHP CGI update missing or misalign, as existing ISPConfig (even after update) onlydisplays ERROR 500, and in nginx logs I can see this:
    Code:
    2024/08/01 11:07:24 [error] 16759#16759: *23025 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught TypeError: Argument 1 passed to IDS\Init::__construct() must be of the type array, null given, called in /usr/local/ispconfig/interface/lib/classes/IDS/Init.php on line 99 and defined in /usr/local/ispconfig/interface/lib/classes/IDS/Init.php:76
    Stack trace:
    #0 /usr/local/ispconfig/interface/lib/classes/IDS/Init.php(99): IDS\Init->__construct(NULL)
    #1 /usr/local/ispconfig/interface/lib/classes/ids.inc.php(62): IDS\Init::init('/usr/local/ispc...')
    #2 /usr/local/ispconfig/interface/lib/app.inc.php(418): ids->start()
    #3 /usr/local/ispconfig/interface/web/index.php(32): require_once('/usr/local/ispc...')
    #4 {main}
      thrown in /usr/local/ispconfig/interface/lib/classes/IDS/Init.php on line 76" while reading response header from upstream, client: 12.34.56.78, server: _, request: "GET / HTTP/2.0", upstream: "fastcgi://unix:/var/lib/php7.2-fpm/ispconfig.sock:", host: "11.22.33.44:8080"
    
    Any idea which PHP module must I install/upgrade?
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Strontium likes this.
  3. labsy

    labsy Member

    Hi Till,
    thank you for link to instructions. I went through diag and PHP selection, and all looks OK there. But still ERROR 500.
    This got broken with one of latest Ubuntu updates obviously, as it was working just fine in past years. Hosted WEB pages, however, work just fine.

    Code:
    cat htf_report.txt
    
    ##### SERVER #####
    IP-address (as per hostname): ***.***.***.***
    [WARN] could not determine server's ip address by ifconfig
    [INFO] OS version is Ubuntu 18.04.6 LTS
    
    [INFO] uptime:  08:49:06 up 1 day, 43 min,  1 user,  load average: 0.03, 0.14, 0.16
    
    [INFO] memory:
                  total        used        free      shared  buff/cache   available
    Mem:           9.8G        3.2G        1.1G        181M        5.5G        6.1G
    Swap:          4.0G          0B        4.0G
    
    [INFO] ISPConfig is installed.
    
    ##### ISPCONFIG #####
    ISPConfig version is 3.2.12p1
    
    
    ##### VERSION CHECK #####
    
    [INFO] php (cli) version is 7.2.33-1+ubuntu18.04.1+deb.sury.org+1
    [INFO] php-cgi (used for cgi php in default vhost!) is version 7.2.33
    
    ##### PORT CHECK #####
    
    [WARN] Port 143 (IMAP server) seems NOT to be listening
    [WARN] Port 993 (IMAP server SSL) seems NOT to be listening
    [WARN] Port 110 (POP3 server) seems NOT to be listening
    [WARN] Port 995 (POP3 server SSL) seems NOT to be listening
    
    ##### MAIL SERVER CHECK #####
    
    
    ##### RUNNING SERVER PROCESSES #####
    
    [INFO] I found the following web server(s):
            Unknown process (nginx:) (PID 1666)
    [INFO] I found the following mail server(s):
            Postfix (PID 1994)
    [WARN] I could not determine which pop3 server is running.
    [WARN] I could not determine which imap server is running.
    [INFO] I found the following ftp server(s):
            PureFTP (PID 16818)
    
    ##### LISTENING PORTS #####
    (only           ()
    Local           (Address)
    [anywhere]:80           (1666/nginx:)
    [anywhere]:8080         (1666/nginx:)
    [anywhere]:465          (1994/master)
    [anywhere]:8081         (1666/nginx:)
    ***.***.***.***:53              (29580/named)
    [localhost]:53          (29580/named)
    [anywhere]:21           (16818/pure-ftpd)
    ***.***.***.***:53              (929/systemd-resolve)
    [anywhere]:22           (1375/sshd)
    [localhost]:953         (29580/named)
    [anywhere]:25           (1994/master)
    ***.***.***.***:443             (1666/nginx:)
    [localhost]:10023               (1859/postgrey)
    [localhost]:10024               (2201/amavisd-new)
    [localhost]:10025               (1994/master)
    [localhost]:10026               (2201/amavisd-new)
    [localhost]:10027               (1994/master)
    [anywhere]:587          (1994/master)
    [localhost]:6379                (1203/redis-server)
    [localhost]:11211               (1091/memcached)
    *:*:*:*::*:80           (1666/nginx:)
    *:*:*:*::*:8080         (1666/nginx:)
    *:*:*:*::*:465          (1994/master)
    *:*:*:*::*:8081         (1666/nginx:)
    *:*:*:*::*:53           (29580/named)
    *:*:*:*::*:21           (16818/pure-ftpd)
    *:*:*:*::*:22           (1375/sshd)
    *:*:*:*::*:953          (29580/named)
    *:*:*:*::*:25           (1994/master)
    *:*:*:*::*:10024                (2201/amavisd-new)
    *:*:*:*::*:3306         (16697/mysqld)
    *:*:*:*::*:10026                (2201/amavisd-new)
    *:*:*:*::*:587          (1994/master)
    *:*:*:*::*:6379         (1203/redis-server)
    
    
    
    
    ##### IPTABLES #####
    Chain INPUT (policy ACCEPT)
    target     prot opt source               destination
    
    Chain FORWARD (policy ACCEPT)
    target     prot opt source               destination
    
    Chain OUTPUT (policy ACCEPT)
    target     prot opt source               destination
    
    
    
    
    ##### LET'S ENCRYPT #####
    Certbot is installed in /usr/bin/letsencrypt
    
    
    
    And ifconfig:
    Code:
     ifconfig
    ens192: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
            inet 10.10.11.150  netmask 255.255.255.0  broadcast 10.10.11.255
            inet6 fe80::20c:29ff:fe7a:eb47  prefixlen 64  scopeid 0x20<link>
            ether 00:0c:29:7a:eb:47  txqueuelen 1000  (Ethernet)
            RX packets 1429861  bytes 299321807 (299.3 MB)
            RX errors 0  dropped 28  overruns 0  frame 0
            TX packets 1293029  bytes 2617271794 (2.6 GB)
            TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
    
    
     
    Last edited: Aug 2, 2024
  4. ahrasis

    ahrasis Well-Known Member HowtoForge Supporter

    Is nginx working? Output of nginx -t ok? Check your enabled ispconfig.vhost whether the unix socket is correct in there.

    Try force update ispconfig reconfiguring all services.
     
  5. labsy

    labsy Member

    Hi,
    thanx for your input!
    nginx is running, nginx -t shows configuration is OK.

    Socket seems correct path from ispconfig.vhost:
    Code:
    # ls -al /var/lib/php7.2-fpm/
    total 8
    drwxr-xr-x  2 root      root      4096 Aug  1 08:05 .
    drwxr-xr-x 65 root      root      4096 Oct  5  2023 ..
    srw-rw----  1 ispapps   ispapps      0 Aug  1 08:05 apps.sock
    srw-rw----  1 ispconfig ispconfig    0 Aug  1 08:05 ispconfig.sock
    srw-rw----  1 web10     www-data     0 Aug  1 08:05 web10.sock
    srw-rw----  1 web11     www-data     0 Aug  1 08:05 web11.sock
    srw-rw----  1 web15     www-data     0 Aug  1 08:05 web15.sock
    srw-rw----  1 web16     www-data     0 Aug  1 08:05 web16.sock
    
    Regarding force reinstall with reconfiguring services... I did that already, but did not help.
     
    Last edited: Aug 3, 2024
  6. labsy

    labsy Member

    Workaround: how can I safely disable one of web pages, until I fix this ISPConfig failure? If I just move @100-domain-name.com.vhost file away and reload nginx, server will instead of domain-name.com show first other website alphabetically, which is not desired behaviour.
     
  7. till

    till Super Moderator Staff Member ISPConfig Developer

    You can try to run an ISPConfig update with reconfigure services = yes and see if it fixes the issue be reconfiguring your PHP setup during update.

    Delete the symlink for the site in the /etc/nginx/sites-enabled/ folder.

    This is the way nginx works. If you point a domain in DNS to a Nginx server and you do not create a website for that domain in Nginx, then Ngix must show the first website in alphabetical order.
     
    ahrasis likes this.
  8. ahrasis

    ahrasis Well-Known Member HowtoForge Supporter

    I mean open your ispconfig.vhost and check in there for that line. Is it correct that it is using php7.2 in there?
     
  9. labsy

    labsy Member

    @ahrasis and @till, thank you both for your inputs.
    I resolved the sub-part for disabling web site, but did not resolve ISPConfig functionality :(
    If I lookup /etc/nginx/sites-available/ispconfig.vhost I can see path for PHP socket:
    Code:
    server {
            listen 8080 ssl http2;
            listen [::]:8080 ssl http2 ipv6only=on;
    
                    ssl_protocols TLSv1.2;
            ssl_certificate /usr/local/ispconfig/interface/ssl/ispserver.crt;
            ssl_certificate_key /usr/local/ispconfig/interface/ssl/ispserver.key;
            ssl_ciphers 'ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS';
            ssl_prefer_server_ciphers on;
    
                    # redirect to https if accessed with http
                    error_page 497 https://$host:8080$request_uri;
    
            server_name _;
    
            root   /usr/local/ispconfig/interface/web/;
    
            client_max_body_size 20M;
    
            location / {
                   index index.php index.html;
            }
    
            # serve static files directly
            location ~* ^.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt)$ {
                   access_log        off;
            }
    
            location ~ \.php$ {
                   try_files $uri =404;
                   include /etc/nginx/fastcgi_params;
                   fastcgi_pass unix:/var/lib/php7.2-fpm/ispconfig.sock;
                   fastcgi_index index.php;
                   fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                   #fastcgi_param PATH_INFO $fastcgi_script_name;
                   fastcgi_buffer_size 128k;
                   fastcgi_buffers 256 4k;
                   fastcgi_busy_buffers_size 256k;
                   fastcgi_temp_file_write_size 256k;
                   fastcgi_read_timeout 1200;
                               fastcgi_param HTTP_PROXY "";
            }
    
            location ~ /\. {
                   deny  all;
            }
    
    Then in directory /var/lib/php7.2-fpm/ I can see all socket files, for ISPConsif and for other web sites:
    Code:
    # ls -al /var/lib/php7.2-fpm/
    total 8
    drwxr-xr-x  2 root      root      4096 Aug  1 08:05 .
    drwxr-xr-x 65 root      root      4096 Oct  5  2023 ..
    srw-rw----  1 ispapps   ispapps      0 Aug  1 08:05 apps.sock
    srw-rw----  1 ispconfig ispconfig    0 Aug  1 08:05 ispconfig.sock
    srw-rw----  1 web10     www-data     0 Aug  1 08:05 web10.sock
    srw-rw----  1 web11     www-data     0 Aug  1 08:05 web11.sock
    srw-rw----  1 web15     www-data     0 Aug  1 08:05 web15.sock
    
    ispconfig_update.sh --force with Reconfigure Services = YES does not help.
    Ubuntu is 18.04 and default PHP php-cgi (used for cgi php in default vhost!) is version 7.2.33
    Should work in theory, but still I have no clue what went wrong.

    Whatever I try, I still get nginx error:
    Code:
    2024/08/04 09:59:46 [error] 12656#12656: *560652 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught TypeError: Argument 1 passed to IDS\Init::__construct() must be of the type array, null given, called in /usr/local/ispconfig/interface/lib/classes/IDS/Init.php on line 99 and defined in /usr/local/ispconfig/interface/lib/classes/IDS/Init.php:76
    Stack trace:
    #0 /usr/local/ispconfig/interface/lib/classes/IDS/Init.php(99): IDS\Init->__construct(NULL)
    #1 /usr/local/ispconfig/interface/lib/classes/ids.inc.php(62): IDS\Init::init('/usr/local/ispc...')
    #2 /usr/local/ispconfig/interface/lib/app.inc.php(418): ids->start()
    #3 /usr/local/ispconfig/interface/web/index.php(32): require_once('/usr/local/ispc...')
    #4 {main}
      thrown in /usr/local/ispconfig/interface/lib/classes/IDS/Init.php on line 76" while reading response header from upstream, client: 1.2.3.4, server: _, request: "GET / HTTP/2.0", upstream: "fastcgi://unix:/var/lib/php7.2-fpm/ispconfig.sock:", host: "ispconfig.domain-name.com:8080"
    
     
    Last edited: Aug 4, 2024
  10. till

    till Super Moderator Staff Member ISPConfig Developer

    You can work around the issue temporarily by disabling the IDS. Edit the file /usr/local/ispconfig/security/security_settings.ini and set:

    Code:
    ids_anon_enabled=mo
    ids_user_enabled=no
    This disables the IDS so the code where the error occurs does not get executed.
     
    labsy and ahrasis like this.
  11. labsy

    labsy Member

    Thanx, Till! That did the trick, ISPConfig interface is now accessible again! :)
    BTW...if it means anything - there were 2 security_settings.ini files there before I edited one:
    Code:
    # ls -al
    total 52
    drwxr-x--- 3 root ispconfig 4096 Aug  5 02:17 .
    drwxr-xr-x 5 root root      4096 Sep  7  2019 ..
    -rwxr-x--- 1 root ispconfig  248 Aug  3 09:57 apache_directives.blacklist
    -rwxr-x--- 1 root root      4661 Aug  3 09:57 check.php
    drwxr-x--- 2 root root      4096 Aug  3 09:57 data
    -rwxr-x--- 1 root ispconfig  188 Aug  3 09:57 ids.htmlfield
    -rwxr-x--- 1 root ispconfig 3341 Aug  3 09:57 ids.whitelist
    -rwxr-x--- 1 root ispconfig   33 Aug  3 09:57 nginx_directives.blacklist
    -rwxr-x--- 1 root root      4436 Aug  3 09:57 README.txt
    -rwxr-x--- 1 root ispconfig 1145 Aug  5 02:16 security_settings.ini
    -rwxr-x--- 1 root root      1146 Aug  3 09:57 security_settings.ini~
    
     
  12. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    The other one is named with ~ -character at the end. Usually these are made by editor, it copies the old file to this name when saving the edit.
    Timestamp shows file was previously edited 3rd August at 09:57. Was that edit by you?
     
  13. till

    till Super Moderator Staff Member ISPConfig Developer

    It's either from an edit with an editor or an ISPConfig update might have created it. In any case, its nothing to worry about.
     

Share This Page