Getting connection failed: php_network_getaddresses: getaddrinfo failed: Name or service not known

后端 未结 3 1216
日久生厌
日久生厌 2020-12-20 16:36

Im using POST method to insert some data to db on my server.This is my connection.php file that is stored in my http://www.url.com/public_html.

    

        
相关标签:
3条回答
  • 2020-12-20 17:07

    The value you've specified for $servername is not a host name but rather a URL, or resource name. The host name would be just www.url.com.

    Of course, as you've already discovered, localhost is the correct host name if the client and server reside on the same box.

    0 讨论(0)
  • 2020-12-20 17:08

    Make changes in bellow file config-db.php

    nano  /etc/phpmyadmin/config-db.php 
    

    change db server as localhost

    $dbserver='localhost';
    

    Its works for me.

    0 讨论(0)
  • 2020-12-20 17:15

    Thanks Prerak,

    This is the answer, my database is on the same machine so I just needed to edit:

    $servername = "localhost"
    

    Now everything is working just fine.

    0 讨论(0)
提交回复
热议问题