Default database host.

Discussion in 'Installation/Configuration' started by Udson Assis, Mar 4, 2022.

  1. Udson Assis

    Udson Assis Member

    Default database host.

    Friends, when installing Wordpress, it suggests using localhost as the database address, however, my ISPConfig only accepts changing it to 127.0.0.1.

    I would like to make it possible with both 127.0.0.1 and localhost.

    If it's not possible both ways, I prefer localhost.

    Can you help me how can I achieve this in ISPConfig?
     
  2. Th0m

    Th0m ISPConfig Developer Staff Member ISPConfig Developer

    Are you using chrooted PHP-FPM? In that case, 127.0.0.1 should be used.
     
    Udson Assis likes this.
  3. ahrasis

    ahrasis Well-Known Member

    Instead of just using either localhost or 127.0.0.1, you can also use this as well as it will automatically detect the right one to be used:
    Code:
    define( 'DB_HOST', $_ENV{DATABASE_SERVER});
    
     
    Udson Assis likes this.
  4. Udson Assis

    Udson Assis Member

    I'm using FPM and chroot enabled.

    After all, which chroot is enabled? I turned it on but I don't know what it's for.
     
  5. till

    till Super Moderator Staff Member ISPConfig Developer

    PHP-FPM Chroot is a chroot environment for PHP-FPM. And from within that chroot, you can't access the MySQL socket as MySQL is outside of the chroot. So when you enable chrooting in PHP, you must use 127.0.0.1 as MySQL hostname to connect to MySQL over the network. When you disable chrooting, then you can either use localhost or 127.0.0.1 as MySQL hostname.
     
    Udson Assis likes this.

Share This Page