Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

SOLVED DB connection from different domain/subdomain

Discussion in 'Database Discussion' started by Nicola Urbinati, Apr 30, 2019.

  1. Nicola Urbinati

    Nicola Urbinati Well-Known Member

    Joined:
    Feb 1, 2017
    Messages:
    73
    Likes Received:
    10
    Trophy Points:
    8
    Location:
    Italy
    cPanel Access Level:
    Root Administrator
    Hi,

    I'm trying to install Wordpress (via Softaculous) in a subdomain (new.domain.com).
    DB connection is not working, even with the testdb file.

    PHP:
    <?php
    $link 
    mysqli_connect('localhost''db_user''db_password');
    if (!
    $link) {
    die(
    'Could not connect: ' mysqli_error());
    }
    echo 
    'Connected successfully';
    mysqli_close($link);
    ?>
    The very same file works from the main domain (www.domain.com)

    What can I check to solve this?

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. cPanelMichael

    cPanelMichael Technical Support Community Manager Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    47,272
    Likes Received:
    2,154
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello @Nicola Urbinati,

    Have you checked to verify the subdomain resolves to the correct IP address?

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. Nicola Urbinati

    Nicola Urbinati Well-Known Member

    Joined:
    Feb 1, 2017
    Messages:
    73
    Likes Received:
    10
    Trophy Points:
    8
    Location:
    Italy
    cPanel Access Level:
    Root Administrator
    Hi,

    Actually, it begun working the day after.
    Might have been a DNS propagation delay or something like that, following your insight.

    Thank you very much.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
    cPanelMichael likes this.
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice