Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

PedroFumero's avatar

Connect with remote database on CPANEL?

I've deploy an application on heroku, but I want to use a database hosted on a CPANEL. On env variables I fill:

DB_CONNECTION DB_HOST DB_PORT DB_DATABASE DB_USERNAME DB_PASSWORD

With my data, and when I try to run a migrations with: heroku run:detached php artisan migrate --force I receive the follow errors:

2020-03-24T17:37:52.841721+00:00 heroku[run.3073]: Starting process with command php artisan migrate --force 2020-03-24T17:37:53.574707+00:00 heroku[run.3073]: State changed from starting to up 2020-03-24T17:37:55.116793+00:00 heroku[run.3073]: State changed from up to complete 2020-03-24T17:37:55.040723+00:00 app[run.3073]: 2020-03-24T17:37:55.041174+00:00 app[run.3073]: In Connection.php line 664: 2020-03-24T17:37:55.041191+00:00 app[run.3073]: 2020-03-24T17:37:55.041194+00:00 app[run.3073]: SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name or service not known (SQL: select * from information_schema.tables where table_schema = 2020-03-24T17:37:55.041195+00:00 app[run.3073]: esrr4dmc_donaciones_alesco and table_name = migrations) 2020-03-24T17:37:55.041215+00:00 app[run.3073]: 2020-03-24T17:37:55.041215+00:00 app[run.3073]: 2020-03-24T17:37:55.041364+00:00 app[run.3073]: In Connector.php line 70: 2020-03-24T17:37:55.041376+00:00 app[run.3073]: 2020-03-24T17:37:55.041380+00:00 app[run.3073]: SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name or service not known 2020-03-24T17:37:55.041398+00:00 app[run.3073]: 2020-03-24T17:37:55.041398+00:00 app[run.3073]: 2020-03-24T17:37:55.041507+00:00 app[run.3073]: In Connector.php line 70: 2020-03-24T17:37:55.041525+00:00 app[run.3073]: 2020-03-24T17:37:55.041544+00:00 app[run.3073]: PDO::__construct(): php_network_getaddresses: getaddrinfo failed: Name or service not known 2020-03-24T17:37:55.041547+00:00 app[run.3073]: 2020-03-24T17:37:55.041550+00:00 app[run.3073]: 2020-03-24T17:37:55.095664+00:00 heroku[run.3073]: Process exited with status 1

Someone can explain me what is my error please?

0 likes
3 replies
artcore's avatar

Did you enable "remote DB" in cpanel? And if you have a firewall you may need to allow your remote IP to access udp on port 3306

PedroFumero's avatar

Yes, I've done both of this actions, I don't know where is the problem

artcore's avatar

If you have root access to .users table you can check if the host is your home IP

Please or to participate in this conversation.