Whenever I run server.php all services get crashed

Discussion in 'Installation/Configuration' started by direwolf, Jan 18, 2018.

  1. direwolf

    direwolf New Member

    I had to manually start all the services in order to get everything back online (apache2, mysql, postfix, ssh, etc)

    I have this message for quite some time in my ISPConfig dashboard: The following changes are not yet populated to all servers:



      • datalog_status_u_server: 2



      • Update website settings: 1
    ##### SERVER #####
    IP-address (as per hostname): ***.***.***.***
    IP-address(es) (as per ifconfig): ***.***.***.***
    [WARN] ip addresses from hostname differ from ifconfig output. Please check your
    ip settings.
    [INFO] ISPConfig is installed.

    ##### ISPCONFIG #####
    ISPConfig version is 3.1dev


    ##### VERSION CHECK #####

    [INFO] php (cli) version is 7.0.18-0ubuntu***.***.***.***

    ##### 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):
    Apache 2 (PID 2581)
    [INFO] I found the following mail server(s):
    Postfix (PID 3295)
    [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 3401)

    ##### LISTENING PORTS #####
    (only ()
    Local (Address)
    [localhost]:10024 (3454/amavisd-new)
    [localhost]:10025 (3295/master)
    [localhost]:10026 (3454/amavisd-new)
    [localhost]:10027 (3295/master)
    [anywhere]:587 (3295/master)
    [anywhere]:465 (3295/master)
    [anywhere]:21 (3401/pure-ftpd)
    [anywhere]:22 (2521/sshd)
    [anywhere]:25 (3295/master)
    *:*:*:*::*:10024 (3454/amavisd-new)
    *:*:*:*::*:10026 (3454/amavisd-new)
    *:*:*:*::*:3306 (2799/mysqld)
    *:*:*:*::*:587 (3295/master)
    *:*:*:*::*:8080 (2581/apache2)
    *:*:*:*::*:80 (2581/apache2)
    *:*:*:*::*:465 (3295/master)
    *:*:*:*::*:8081 (2581/apache2)
    *:*:*:*::*:21 (3401/pure-ftpd)
    *:*:*:*::*:22 (2521/sshd)
    *:*:*:*::*:25 (3295/master)
    *:*:*:*::*:443 (2581/apache2)




    ##### 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

    I comment out server.php from root crontab, deleted the lock file (rm -f /usr/local/ispconfig/server/temp/.ispconfig_lock) and tried running the script manually. Here's the output:
    _

    18.01.2018-15:50 - DEBUG - Calling function 'check_phpini_changes' from plugin 'webserver_plugin' raised by action 'server_plugins_loaded'.
    18.01.2018-15:50 - DEBUG - Found 11 changes, starting update process.
    18.01.2018-15:50 - DEBUG - Calling function 'ssl' from plugin 'apache2_plugin' raised by event 'web_domain_update'.
    18.01.2018-15:50 - DEBUG - Calling function 'update' from plugin 'apache2_plugin' raised by event 'web_domain_update'.
    18.01.2018-15:50 - DEBUG - Creating fastcgi starter script: /var/www/php-fcgi-scripts/web4/.php-fcgi-starter
    18.01.2018-15:50 - DEBUG - Writing the vhost file: /etc/apache2/sites-available/example.com.vhost
    18.01.2018-15:50 - DEBUG - Apache status is: running
    18.01.2018-15:50 - DEBUG - Calling function 'restartHttpd' from module 'web_module'.
    18.01.2018-15:52 - DEBUG - Restarting httpd: systemctl restart apache2.service
    18.01.2018-15:52 - DEBUG - Apache restart return value is: 1
    18.01.2018-15:52 - DEBUG - Apache online status after restart is: down
    PHP Warning: mysqli_connect(): (HY000/2002): No such file or directory in /usr/local/ispconfig/server/lib/classes/db_mysql.inc.php on line 200
    PHP Warning: mysqli_connect(): (HY000/2002): No such file or directory in /usr/local/ispconfig/server/lib/classes/db_mysql.inc.php on line 200
    PHP Warning: mysqli_connect(): (HY000/2002): No such file or directory in /usr/local/ispconfig/server/lib/classes/db_mysql.inc.php on line 200
    PHP Warning: mysqli_connect(): (HY000/2002): No such file or directory in /usr/local/ispconfig/server/lib/classes/db_mysql.inc.php on line 200
    PHP Warning: mysqli_connect(): (HY000/2002): No such file or directory in /usr/local/ispconfig/server/lib/classes/db_mysql.inc.php on line 200
    PHP Warning: mysqli_connect(): (HY000/2002): No such file or directory in /usr/local/ispconfig/server/lib/classes/db_mysql.inc.php on line 200
    PHP Warning: mysqli_connect(): (HY000/2002): No such file or directory in /usr/local/ispconfig/server/lib/classes/db_mysql.inc.php on line 200
    PHP Warning: mysqli_connect(): (HY000/2002): No such file or directory in /usr/local/ispconfig/server/lib/classes/db_mysql.inc.php on line 200
    PHP Warning: mysqli_connect(): (HY000/2002): No such file or directory in /usr/local/ispconfig/server/lib/classes/db_mysql.inc.php on line 200
    PHP Warning: mysqli_connect(): (HY000/2002): No such file or directory in /usr/local/ispconfig/server/lib/classes/db_mysql.inc.php on line 200
    DB::query -> reconnectPHP Warning: mysqli_connect(): (HY000/2002): No such file or directory in /usr/local/ispconfig/server/lib/classes/db_mysql.inc.php on line 200
    PHP Warning: mysqli_connect(): (HY000/2002): No such file or directory in /usr/local/ispconfig/server/lib/classes/db_mysql.inc.php on line 200
    PHP Warning: mysqli_connect(): (HY000/2002): No such file or directory in /usr/local/ispconfig/server/lib/classes/db_mysql.inc.php on line 200
    PHP Warning: mysqli_connect(): (HY000/2002): No such file or directory in /usr/local/ispconfig/server/lib/classes/db_mysql.inc.php on line 200
    PHP Warning: mysqli_connect(): (HY000/2002): No such file or directory in /usr/local/ispconfig/server/lib/classes/db_mysql.inc.php on line 200
    PHP Warning: mysqli_connect(): (HY000/2002): No such file or directory in /usr/local/ispconfig/server/lib/classes/db_mysql.inc.php on line 200

    Please guide what to do now.

    ISPConfig Version: 3.1
     
    Last edited: Jan 19, 2018
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    There seems to be a problem with your mysql server, the socket cannot be reached and therefore PHP is unable to connect to mysql.
     
  3. direwolf

    direwolf New Member

    How can I debug this issue? My PHP websites are working fine and are able to connect to mysql server. Also, please note that all my other running services like apache2, ssh, postfix, etc, exit automatically.
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    You can try this: Create a file 'info.php' on the shell, e.g. in /tmp, which contains:

    <?php
    phpinfo();

    Then run as root:
    php info.php | grep sock

    and check the output, if a mysqli.default_socket exists there, check that it really exists in that location on the shell, if it shows a pdo_mysql.default_socket, then xheck if the mysql socket exists in that path. Ceside that, search in the mysql config files to sewhichch socket path is configured there and then check if the socket really exists in that location.
     
  5. direwolf

    direwolf New Member

    Code:
    [email protected]:/tmp# php info.php | grep sock
    /etc/php/7.0/cli/conf.d/20-sockets.ini,
    mysqli.default_socket => no value => no value
    pdo_mysql.default_socket => /var/run/mysqld/mysqld.sock => /var/run/mysqld/mysql  d.sock
    sockets
    default_socket_timeout => 60 => 60
    [email protected]:/tmp# cd /var/run/mysqld/
    [email protected]:/var/run/mysqld# ls
    mysqld.pid  mysqld.sock
    
    Searching mysql configuration file has the same path as above.
    Code:
    [email protected]:~# grep sock /etc/mysql/mariadb.conf.d/50-server.cnf
    socket  = /var/run/mysqld/mysqld.sock
    # * Unix socket authentication plugin is built-in since 10.0.22-6
    # See https://mariadb.com/kb/en/unix_socket-authentication-plugin/
    
    Code:
    [email protected]:~# grep sock /etc/mysql/debian.cnf
    socket  = /var/run/mysqld/mysqld.sock
    socket  = /var/run/mysqld/mysqld.sock
    
     
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    Please try to change 'localhost' to '127.0.0.1' in the DB connection settings in /usr/local/ispconfig/server/lib/config.inc.php
     
  7. direwolf

    direwolf New Member

    Same thing again.
     
  8. till

    till Super Moderator Staff Member ISPConfig Developer

    The exact same error message:

    PHP Warning: mysqli_connect(): (HY000/2002): No such file or directory in /usr/local/ispconfig/server/lib/classes/db_mysql.inc.php on line 200

    ?
     
  9. direwolf

    direwolf New Member

    Yes the exact same. Actually when this line DEBUG - Calling function 'restartHttpd' from module 'web_module'. is executed my running services get killed automatically too including apache2, mysql, postfix, ssh, mailman, etc. I am guessing this is the reason for mysqli_connect() error as mysql service gets killed.
     
  10. till

    till Super Moderator Staff Member ISPConfig Developer

    This function simply runs apache2 restart, either by executing the apache init script or by using systemd, in case systemd is installed. so there must be something wrong either in the init script or systemd when other services are affected by a restart of apache.
     
  11. direwolf

    direwolf New Member

    Does this help?
    Looks like something is wrong with systemd or something. Please help me to debug this.
     
  12. till

    till Super Moderator Staff Member ISPConfig Developer

    Which exact os do you use and what's in this manual start script?
     
  13. till

    till Super Moderator Staff Member ISPConfig Developer

    And what is the result of the command:

    which systemd

    when you run it as root.
     
  14. direwolf

    direwolf New Member

    OS: Ubuntu 16.04
    The script just has the commands to run my services that are required to run my websites.
    Code:
    #!/bin/bash
    sudo service apache2 start
    sudo service mysql start
    sudo service ssh start
    sudo service postfix start
    sudo service mailman start
    sudo service pure-ftpd-mysql start
    sudo service amavis start
    Result of the command which systemd
    Code:
    [email protected]:~# which systemd
    /bin/systemd
    
     
  15. till

    till Super Moderator Staff Member ISPConfig Developer

    Ok, s systemd is the init system of your server. What happens when you restart apache with systemd?

    systemctl restart apache2.service
     
  16. direwolf

    direwolf New Member

    Returned this:
    Code:
    [email protected]:~# systemctl restart apache2.service
    Job for apache2.service canceled.
    And as expected, the running services got killed with it.
     
  17. till

    till Super Moderator Staff Member ISPConfig Developer

    Ok, so there is something fundamentally wrong in your overall setup when the init system fails and the issue is not directly related to ISPConfig. I've never seen that issue before, so I don't have the solution at hand. You might have to look into the syslog file, maybe it contains further details and try to search for an issue with system / canceled job / that kills all other services at google.
     

Share This Page