SOLVED DB connection from different domain/subdomain

Nicola Urbinati

Well-Known Member
Feb 1, 2017
73
10
8
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.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,909
2,228
463
Hello @Nicola Urbinati,

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

Thank you.